Circuit provides 4- to 20-mA loop for microcontrollers

Texas Instruments TL032

The 4- to 20-mA current loop is ubiquitous in the world of controls in manufacturing plants. Discrete logic, microprocessors, and microcontrollers easily cover the digital portions of control schemes, such as limit switches, pushbuttons, and signal lights. Interfacing a 4- to 20-mA output to a rudimentary microcontroller can be problematic. A built-in A/D converter would be nice, but such a device is sometimes unavailable in the “economy” line of these processors. Serial 4- to 20-mA chips exist but are relatively expensive and require serial programming and involve microcontroller overhead. Most lower end chips lack dedicated serial ports and require pin-programming.

This circuit is a low-cost alternative that provides not only a 4- to 20-mA output, but also a digital feedback signal that indicates an open wire in the current loop (Figure 1). One output-port pin sets the current, and one input-port pin monitors an open circuit in the loop wire. The circuit does not require the open-loop feedback portion of the circuit for the current loop to operate; you can omit it for further cost savings.

This configuration provides both a 4- to 20-mA loop and an open-circuit indication.
Figure 1. This configuration provides both a 4- to 20-mA loop and an open-circuit indication.

The circuit derives its drive from a simple timer output in the microcontroller. The duty cycle of the timer determines the output current of the circuit. The input RC network in front of the first operational-amplifier signal conditions the pulse train from the processor, so that the op amp interprets it as a dc voltage. In addition, the network ensures that the minimum input voltage is close to 100 mV, even if the input is at ground potential. This minimum voltage ensures that the feedback loop of the first op amp does not fold back to the positive rail when you cut off npn transistor Q1. If you use a dual supply, the transistor has the additional voltage swing below ground potential to keep it in its active region and does not cut off.

The emitter resistor of npn transistor Q1 sets the current span of the circuit. With a 5 V drive from the microcontroller, the output current is 20 mA. A grounded input results in less than 1 mA. A duty cycle of 12.5% drives the loop at 4 mA and exhibits linear control to full scale. Although it may not be mandatory, most current loops prefer a grounded return path. The purpose of the second operational amplifier is to provide a current source, rather than the current sink of the first stage, and the grounded return path. Hence, pnp transistor Q3 provides this high-side drive. Bipolar-junction transistors Q1 and Q3 meet cost considerations, but you could also use MOSFETs for slightly better performance.

The open-loop feedback portion of this circuit lets the microcontroller know that a fault condition exists on the line. The processor can then execute alarm, shutdown, or other control functions to mitigate possible safety concerns. When an open-loop condition occurs, Q3 shunts the entire loop current back through its emitter-base junction and through the 680 Ω resistor to the op amp. The voltage developed across the 680 Ω resistor turns on Q2, resulting in a logic-one feedback to the microcontroller. Note that the open loop requires at least 1 mA of current for the open indication to function, which is below the normal 4 mA – a “zero” output condition for this type of control system.

Response time for a step change is approximately 500 msec, which is acceptable for most current-loop control devices, such as control valves. If the microcontroller you select has a built-in A/D converter, response time can decrease by a couple of orders of magnitude with the elimination of the input-filtering network. Op-amp selection is important if you use a single-supply topology. An operational amplifier that can maintain stability close to its negative, or ground, rail is an important asset.

Materials on the topic

  1. Datasheet Texas Instruments TL032

EDN

1-4 Layer PCBs $2

You may have to register before you can post comments and get full access to forum.
User Name