4
\$\begingroup\$

I tried to measure inductance by using a colpitts oscillator to generate sine wave. It works. I need to convert the sine wave to 5V square wave to feed to a microprocessor. The sine wave is coupled with a capacitor 0.47uF to eliminate the signal offset. The signal after the capacitor is zero crossing sinewave. When the signal connected to a zero-crossing detection comparator, I got problem. The zero- crossing sine wave drifts to about 10mV above 0 V. The output of the comparator is flat no square wave, since the input signal always higher than 0V. How should I do to avoid the signal drift, to convert the sine wave to TTL.
enter image description here

\$\endgroup\$
1
  • \$\begingroup\$ I like that circulating-current design ----- very localized ------ for excellent phase noise. \$\endgroup\$ – analogsystemsrf Jun 9 '17 at 15:34
7
\$\begingroup\$

How should I do to avoid the signal drift, to convert the sine wave to TTL.

You need to set DC voltage levels on both comparator inputs to (nominally) half supply rail. You can do this with a potential resistive divider on both inputs: -

enter image description here

For the input that connects to the capacitor use high value resistors to avoid low frequencies from your Colpitts oscillator being attenuated too much. Alternatively make a direct connection to the emitter and use a type of data slicer circuit like this: -

enter image description here

Your emitter connected sinewave is likely to be biased up sufficiently for the + comparator input and, R1 and C1 form a low pass filter to produce the same DC level on the other input but without significant AC signal content. Make R1 = 100 kohm and C1 = 1 uF - this will be OK down to frequencies as low as 10 Hz but if problems make C1 bigger.

You cannot expect an op-amp or comparator input to function correctly with just a capacitive connection AND you cannot expect (most) op-amps and comparators to work with an input connected to the supply rails.

Finally, it's a good idea (as pointed out in the comments) to add a pinch of hysteresis to prevent the output stuttering as the input crosses through the reference point. This is usually achieved by two resistors supplying a bit of positive feedback. Here's how you'd implement it for the data slicer type configuration (shown earlier): -

enter image description here

\$\endgroup\$
6
  • 1
    \$\begingroup\$ Best use some hysteresis, a "sharply tuned" comparator will turn something like a slow sine wave ... from an unshielded LC oscillator that likely will pick up mains hum and am radio ... into all kinds of jitter and errant pulses. \$\endgroup\$ – rackandboneman Jun 9 '17 at 15:22
  • \$\begingroup\$ @rackandboneman yes, adding a small amount of hysteresis is a good idea. I shall footnote it into the answer. \$\endgroup\$ – Andy aka Jun 9 '17 at 17:35
  • \$\begingroup\$ Or a massive amount - I can only imagine a few hundred ways you might get unexpected frequency multiplication with that kind of inductance meter design ... Oh, and some overvoltage protection might also be a good idea with inductors of unknown Q factor... \$\endgroup\$ – rackandboneman Jun 10 '17 at 21:49
  • \$\begingroup\$ It's a colpitts oscillator and shouldn't need over voltage protection. \$\endgroup\$ – Andy aka Jun 10 '17 at 22:02
  • \$\begingroup\$ Thanks Andy, The data slicer circuit is a very interesting idea. wondering if I can use single power supplyed (+5V only) comparator with the data slicer circuit. definitely I will use add hysterisis to my circuit. the frequencies of my application are 200KHz to a few Mega Hz. Is there any speciall concern I should pay attention? \$\endgroup\$ – hjiang1213 Jun 12 '17 at 6:21
5
\$\begingroup\$

Turn your output OP-Amp into a Schmitt trigger by placing a positive feedback resistor between output and positive input. You can adjust the trigger levels by adjusting the feedback and input/ground resistors.

\$\endgroup\$

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.