3
\$\begingroup\$

enter image description here

To make my problem easier to describe, I drew the above figures (abbreviated as Fig.).

The sinusoidal input comes from a rotating device, from a small alternator(a permanent magnet AC generator).

My aim is to convert these incoming sinusoidal inputs to pulses with nice sharp edges as in Fig. B. A DAQ hardware will read these pulses to obtain the frequencies...

As you see above, Fig. A is the input to the Schmitt trigger circuit(Fig. D). The input has some noise and its frequency varies between 4Hz up to 20Hz and its amplitude varies from 1V up to 12V. So the input will vary in this range and I want the circuit to work in any scenarios in this range.

My problem is my circuit works perfectly in simulation but fails in real life sometimes. Some outputs results as in Fig. C randomly. I do not remember if this was happening under particular inputs. But the frequency and the amplitude both increase with rotation speed of this alternator.

How can I fix this issue here? I asked a related question before but since I were not able to provide enough data I couldn't find a solution. The only suggestion was to choose C2 as 10uF and connect the negative end of this cap to the input signal, since according to the suggester the input was coming from an alternator.

If I use another Schimtt trigger as cascade at the output of this one the pulses becomes less noisy. But a pulse like in Fig. C looks very problematic. Is that because this circuit's upper and lower trigger limits are not arranged for the input range. I really need help at the moment and would be very glad for any adjustment suggestion in this circuit.

\$\endgroup\$
  • 1
    \$\begingroup\$ It looks to me as though you need to low-pass filter your signal before feeding it to your schmitt trigger. If the amplitude of the noise on the signal is larger than your schmitt trigger threshold then you'll get those little runt pulses around the threshold point. \$\endgroup\$ – brhans Feb 25 '16 at 22:25
  • \$\begingroup\$ RC filter? Any ideas of picking the typical cap value and the place to insert? thanks \$\endgroup\$ – user16307 Feb 25 '16 at 22:28
  • \$\begingroup\$ How fast (ie what is the width in seconds) of your 'runt' pulse? \$\endgroup\$ – Voltage Spike Feb 25 '16 at 22:50
  • \$\begingroup\$ Im at home right now and didnt measure it but it was shorter as in Fig. C maybe 2.5ms but Im not sure. Can we just call it X and elaborate on that? \$\endgroup\$ – user16307 Feb 25 '16 at 22:55
4
\$\begingroup\$

You got a lot right.

The basic problem is that the noise is larger than your hysteresis range. The obvious fixes are to reduce the noise component and increase the hysteresis range. In this case, doing both seems appropriate.

You say the highest frequency of interest is 20 Hz. That means you can safely remove frequencies above that since you know they aren't part of the real signal. Your trace shows significant high frequency noise, which a simple R-C filter should be able to attenuate nicely.

Since your input has about 5 kΩ impedance, a 1 kΩ resistor followed by a 4.7 µF capacitor to ground should help a lot. This filter would go to the left of C2. 1 kΩ and 4.7 µF has a rolloff of 34 Hz, so won't get in the way of your real signal. You should see a significant difference in the signal just from this alone.

The next step is to adjust the hysteresis. You have 220 kΩ feedback against 2.35 kΩ, so 1.06%. The output swing is 24 V, so that amounts to 254 mV hysteresis. Since your minimum amplitude is 1 V, you can double that to 500 mV to get more noise immunity. The easiest way to do that is to change R1 from 220 kΩ to half that or around 110 kΩ.

Again, you had the right idea and were actually pretty close. The only changes are to add a low pass filter on the input and to double the hystersis.

Added

I was in a rush last night when I wrote the answer above. Now I'm looking at your circuit more closely. What you have, with the changes described above, should work fine. However:

  1. R7 and R6 make no sense. They don't do much harm either, except a little unnecessary loading on the opamp that might not let it swing as far to the rails as it otherwise could. Get rid of them.

  2. R9 and R10 seem very high. Are you sure that whatever follows this circuit is OK with the signal having 50 kΩ impedance? I haven't looked up what this opamp can drive, but likely a lot less than 200 kΩ.

Added 2

I someone mentioned in a comment that U1 is actually a comparator with open collector output. In that case you need a pullup, like R7, but a pulldown like R6 still makes no sense. A opamp or comparator with push/pull outputs would be easier to use. Then you don't have the assymetric output impedance between high/low of the open collector, making it easier to adjust the hysteresis feedback.

What you have can be made to work too, but you need to think about these issues on your own now. I've spent enough time on this problem already.

\$\endgroup\$
  • \$\begingroup\$ Thanks a lot for nice suggestions! Just one more thing. I might need Vcc to be 12V what would you recommend R1 to be in that case for the noise immunity? I just don't know how you calculated these and have a bit hurry to implement it. Thanks. \$\endgroup\$ – user16307 Feb 25 '16 at 23:12
  • \$\begingroup\$ As the comparator output is Open-Collector the voltage swing is only half the supply voltage. To get full output swing you must remove R6. \$\endgroup\$ – Bruce Abbott Feb 26 '16 at 0:03
  • \$\begingroup\$ @Bruce Abbott ok I will remove it. But R7 is 10k, so should I change R9 and R10 as well? You also suggested me to chose C2 as 10uF and connect the negative end of this cap to the input signal, since the input was coming from an alternator. This still holds right? I will just add an RC filter to the right of this cap as Olin suggests. Will that cap's negative end should be connected to input as well? \$\endgroup\$ – user16307 Feb 26 '16 at 0:17
  • \$\begingroup\$ R7, R9 and R10 are OK as is. Put the low pass RC filter between the junction of C2/R2/R4 and comparator inverting (-) input. C2 must still have its -ve end to the generator and +ve end to R2/R4. This is required to bias the capacitor with the correct polarity. \$\endgroup\$ – Bruce Abbott Feb 26 '16 at 0:28
  • \$\begingroup\$ @BruceAbbott What I dont get is the alernator has a swing up to +-12.8V and C2 provides a DC offset as Vcc/2 both in simulation and the measurement. So the voltage to the comparator's - input can exceed Vcc. Is that a problem? I tried this circuit with 5V Vcc and get uneven pulses over some amplitudes. Should the Vcc > Valternator_max + Vcc/2 ? Do you agree? \$\endgroup\$ – user16307 Feb 26 '16 at 10:17
1
\$\begingroup\$

Your hysteresis is too low: the 220 kΩ resistor is too high.

There's a good calculator at Random Science Tools and the screen-grab below shows the results for 0.6 V hysteresis.

enter image description here

Figure 1. Screengrab from Random Science Tools.

Update

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 2. Input over-voltage protection with low-pass filter option (C2).

\$\endgroup\$
  • \$\begingroup\$ How does that explain the runts? The comparator should end up at the same value every time. \$\endgroup\$ – Voltage Spike Feb 25 '16 at 23:42
  • \$\begingroup\$ If the hysteresis is too low it will switch on the noise intermittently. Do you think I'm missing something else? \$\endgroup\$ – Transistor Feb 25 '16 at 23:45
  • \$\begingroup\$ @laptop2d Do you also agree that C2 negative end should be connected to input as in my circuit. This was suggested by another user in another question. The suggester claimed that since the input is coming from alternator thats the reason I hooked up C2 that way. Do you also agree with this? The reason Im asking I want to eliminate other possible factors. \$\endgroup\$ – user16307 Feb 25 '16 at 23:47
  • \$\begingroup\$ You should check your Vcc\vref if you haven't yet. And get a multimeter and see if the AC current across R10 is close to 0 \$\endgroup\$ – Voltage Spike Feb 26 '16 at 2:56
  • \$\begingroup\$ @user16307: C2 won't introduce noise but it's a polarised capacitor and could get damaged if inserted with wrong polarity. Just check the DC voltage across it and reverse if necessary. \$\endgroup\$ – Transistor Feb 26 '16 at 7:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.