3
\$\begingroup\$

I am using an encoder in my circuit operating on 5 V and the maximum output voltage of my optical encoder is 5 V. I am using the TI CC1350 Launchpad MCU to read the encoder signal, but the problem is the MCU maximum input voltage on any pin is 4.1 V, so I want to shift the encoder output voltage to 3.3 V for safe operation.

For that, I found some solutions:

  1. Voltage divider circuit
  2. CD74HC4050 IC
  3. N-FET for level shifting

Which solution can I use for the reliable and safe operation? Or is there another solution I can implement?

\$\endgroup\$
1
  • 1
    \$\begingroup\$ What are the timing requirements? How slow is the level shifter allowed to be? \$\endgroup\$ Commented Jan 24, 2022 at 9:06

4 Answers 4

4
\$\begingroup\$

If your optical encoder has a pull-up resistor on the phototransistor collector, adding only one resistor can solve this issue.

Level shifting by an external resistor

Here, we can calculate the R as, $$ \frac{R}{R + R_c} = \frac{3.3}{5} $$ $$ R = 1.94 \times R_c $$

If your device requires very low power consumption, the external resistor will draw some constant currents. In this case, CD74HC4050 is good, which has a 20 µA current consumption itself.

An n-channel MOSFET level shifting is also a good option if you are not sure about the pull-up resistor value of the encoder.

\$\endgroup\$
4
\$\begingroup\$

Your MCU has built-in ESD protection diodes on the pins, so you could just use those to clamp the voltage. Since they are designed to only protect the device during handling for assembly, you need to put high value resistors in series with the line to limit the current through those diodes and to not overload the driver.

Sizing of resistor should be low enough so that the RC time formed with the diode and pin input capacitance should not be more than 1/3 to 1/5th the required rise time on the signal.

Or you could do the same, but add your external discrete diodes which would be safer.

schematic

simulate this circuit – Schematic created using CircuitLab

This is a diode clamp circuit. When the line voltage exceeds the voltage on the other end of the diode, the diode conducts and shorts out the voltage on the line so it can never rise more than one diode forward drop above the power rail. You just need to limit the current through the diode, so it doesn't overheat (and also to not overload the driver). This also works to clamp the line to ground and negative voltages as well (just make sure the diode is in the correct direction).

Schottky diodes are recommended due to their speed and lower voltage drop which clamps the line closer to the power rail voltage. Also, because other diodes will also have a forward voltage high enough that the internal ESD diodes will turn on first, preventing the external diode from ever conducting (ESD diodes are 0.4~0.5 V I think, lower than your typical 0.7 V).

This method also works at high voltages if you want to do something like feed an AC mains signal to a comparator to detect the zero cross and do not want to step down the entire signal with a voltage divider which would make the zero-cross slope shallow and less crisp for digital detection. Needless to say, at such powers you want external diodes and multiple resistors in series to protect against single point failures and other safety measures.

\$\endgroup\$
2
  • \$\begingroup\$ Perhaps include some timing / capacitance constraints in your answer? The MCU will probably not tolerate switch times above about 1 µsec (1000 ns). \$\endgroup\$ Commented Jan 24, 2022 at 9:27
  • \$\begingroup\$ @PeterMortensen Added a blurb \$\endgroup\$
    – DKNguyen
    Commented Jan 24, 2022 at 14:21
2
\$\begingroup\$

Shift encoder output to MCU input voltage range?

Your encoder datasheet shows that the output of the encoder is CMOS compatible, so it will be active pullup and pulldown.

The easiest way to level shift is to use an N-chan FET, though you must remember that this will invert your signal. Set your Launchpad input pullup resistor on.

For the voltage translation devices you could use a simple 2N7000

If you have a bunch of inputs to handle and you are making your own PCB, then you may be better off with a ULN2003V12. This is possibly the cheapest solution at about $0.54 for 7 FETs.

\$\endgroup\$
0
\$\begingroup\$

I'd just go with the 74HC4050. Simple, no calculations needed, plenty fast for an optical encoder. As with any CMOS, remember to ground any unused inputs.

\$\endgroup\$

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