1
\$\begingroup\$

The following signal is presented to me, and will vary in freq, but not amplitude from 10Hz up to around 25 KHz.

Any ideas for a simple circuit that will convert this into a clean 3V3 square wave for feeding into an MCU? Ideally, avoiding phase shift as freq increases (though not as important.)

I am thinking of some sort of schmitt trigger with a large hyst and 1v/3v cross over points, but open to suggestions!

It should also have some noise immunity being an automotive environment.

enter image description here

\$\endgroup\$
6
  • 1
    \$\begingroup\$ Given that the rising waveform is likely an RC time constant of some type or other it seems highly unlikely that across the whole range of frequencies stated that the shape and amplitude will remain constant. Please justify otherwise. \$\endgroup\$
    – Andy aka
    Commented Dec 13, 2018 at 14:54
  • \$\begingroup\$ Some microcontroller inputs have built-in Schmitt hysteresis - perhaps you could use such an input? Some microcontrollers have built-in comparators that could be employed as in @analogsystemsrf answer. \$\endgroup\$
    – glen_geek
    Commented Dec 13, 2018 at 16:06
  • \$\begingroup\$ At 25kHz you have a cycle time of 40us, the rise time on this signal looks to be about 120us if that's a 100us/div setting, so you won't be getting full amplitude swings at the maximum frequency. That'll affect what thresholds you can use - if you can use fixed thresholds at all. Presumably this is an open collector output being pulled up against some cap or other filtering. I've done something like this, some error is bound to be present on the leading edge detection. - are you looking for just synchronization, frequency measurement, PWM? \$\endgroup\$
    – Phil G
    Commented Dec 13, 2018 at 16:09
  • \$\begingroup\$ Looking for sync to the falling edge - thats all we ened to know about :) \$\endgroup\$
    – MattyT2017
    Commented Dec 13, 2018 at 16:46
  • \$\begingroup\$ So the falling edge is far sharper than the rising one, so any timing errors will likely be small, so long as you reliably capture the change of state on the rising edge before. I've done one that just uses the Schmitt levels on a microcontroller input for this, with the advantage of the microcontroller being able to ignore any transitions that occur from noise at times that couldn't be intentionally generated within the defined frequency range by blanking the input for a period after each transition. There are better filtering mechanisms, but all carry some delay penalty. \$\endgroup\$
    – Phil G
    Commented Dec 13, 2018 at 16:54

1 Answer 1

1
\$\begingroup\$

How about this

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
3
  • \$\begingroup\$ What would the thresholds be on this particular exmaple? \$\endgroup\$
    – MattyT2017
    Commented Dec 13, 2018 at 15:43
  • 1
    \$\begingroup\$ Threshold would be Vdd/2, changed by adjusting R1 and R2. I don't think you need R3 though as you're using this as a comparator. What is your end goal with this? I recently used the LM2907 Frequency to Voltage converter to count pulses from a fan tachometer. It gives a voltage output proportional to the input frequency, essentially using the circuit posted above to charge/discharge a cap. \$\endgroup\$
    – Stiddily
    Commented Dec 13, 2018 at 21:05
  • 1
    \$\begingroup\$ If the comparator output swings 0/vdd, the thresholds will be 1/3 and 2/3 of VDD. \$\endgroup\$ Commented Dec 14, 2018 at 3:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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