Simple Interface Connects Sensor Output To Microcontroller

It generally isn’t safe to connect programmable logic controller (PLC) and industrial sensor outputs directly to microcontrollers that need transistor-transistor logic (TTL) or CMOS signals, which can make such sensors difficult to use. This design (see the figure) provides a simple solution to the interface problem when the sensor uses an NPN output stage that can support a pullup resistor to sensor power (10- to 30-V range with 24 V typical). The translated signal output from this design is fully compatible with the input stages of TTL/CMOS circuits, can source 500 µA, and can sink over 100 mA.

 Simple Interface Connects Sensor Output To Microcontroller

With just a few components, you can provide a translated signal from industrial and PLD sensors that connects safely to a microcontroller, with the added bonus of supplying 7.5 mA of regulated power.

The NPN pullup is split into two parts. The top part (R1) is a high-power, 1-W, 1k resistor. The lower part (R2) is a low-power, 1/4-W, 10k resistor that connects to the sensor’s NPN output transistor’s collector. Two additional parts finish the design: Zener diode D1 (with a value of either 5.1 or 3.3 V depending on the logic level required) and capacitor C1. Capacitor C2 is optional and only used for high-frequency noise suppression with sensors having low-frequency signal outputs.

The Zener diode serves two purposes in the design. Its main purpose is to set a constant, safe voltage for the translated signal output to protect the attached microcontroller. The diode’s other purpose is to provide, in combination with C1, a regulated output that can supply power to the microcontroller. The circuit’s current capacity is limited to 7.5 mA, but this is sufficient for running a low-power microcontroller and LCD display.
If used for noise suppression, C2 should have a value so the time constant R2 × C2 corresponds to one-third the sensor or PLC output’s maximum operating frequency. Sensors with a maximum frequency of 10 kHz and above do not need C2 because cable capacitance will provide sufficient filtering. A good quality twisted pair or coaxial cable on the signal output will provide the best results.

electronicdesign.com