I have a rotary encoder whose output uses an NPN and a PNP transistor to switch between something slightly less than the high input voltage (~17V input) and ground.

I need to trigger 5V TTL from this, so I connected it to a 5.1V Zener diode and a resistor, and the DAQ board to which it is attached has a pull-down resistor.

enter image description here

To run, the rotary encoder requires a voltage between 12 and 24V input, and at around 14V (which I had almost working) the current draw from the power supply is ~100mA (for 3 outputs, A, B and Z, each with their own same resistor R and Zener)

The voltage measured goes between about 400mV and 4.5V in that case. The decay is quite curved - not very sharp corners for my 'square' wave output. Reducing the value of the resistor labelled R improves the corner 'squareness' but I'm concerned that current draw might cause more problems for the diode.

If I increase the current limit on the PSU, the maximum voltage gets closer and closer to 5V but then the output flatlines.

I had worried that the diode was dissipating too much power, so I switched from a 1.3W to 5W zener diode. I'm pretty sure that even if the entirety of the PSU current went through only one of the diodes, with the full voltage drop there, the power dissipated should be less than 5W (14*0.1 << 5).

Why is the circuit output flattening to ground? Should I use larger or smaller R? (Currently at 680 but started with 1k and tried also 3.3k - I'd expect larger R to draw lower current I, but that doesn't seem to be what I'm seeing from the PSU, and larger R is making my wave increasingly curved at corners)

  • \$\begingroup\$ You don't need all this. Simply connect a 1N4148 diode with its cathode to the push-pull output and it's anode to your input. Another 10k resistor goes from the anode to +5V. You now have a signal that goes from 0V to +5V. Done. \$\endgroup\$
    – Janka
    Feb 9 '17 at 2:07
  • \$\begingroup\$ Also see my recent answer to a similar problem here: electronics.stackexchange.com/questions/284005/… \$\endgroup\$
    – Janka
    Feb 9 '17 at 2:53
  • \$\begingroup\$ Thanks - the explanation on the related answer makes it clearer. Will have to find a diode... \$\endgroup\$
    – chrisb2244
    Feb 9 '17 at 2:58
  • \$\begingroup\$ I get the same results with both zener diode (I can see why this wouldn't work) and a PNP transistor with base and collector shorted to act as a diode. My high level is around 4.1V and the 'ground' floats at 1.5V - this is connected only to the 'ground' of the sensor, not to anything related to the output - is this correct? \$\endgroup\$
    – chrisb2244
    Feb 9 '17 at 3:39
  • \$\begingroup\$ For possible clarity, when the PSU is turned off, the output sits at about 2.1V (I guess this is due to the 5V pin being used as my measurement value when the diode isn't passing the current sunk by the device?) \$\endgroup\$
    – chrisb2244
    Feb 9 '17 at 3:41

Your Answer

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

Browse other questions tagged or ask your own question.