Microcontroller circuit calibrates current loops
A team of engineers designed a 4–20-mA loop calibrator that costs less than $100.
Abdulkadir Çakır, Fırat Yücel, and Hakan Çalış -- Test & Measurement World, 1/25/2012 2:33:53 PM
|
A 4–20-mA current loop circuit consists of a sensor, a transmitter, a receiver, and a current source (Figure 1). The sensor measures a physical attribute and converts it to a voltage. The current-loop transmitter converts the voltage into 4–20-mA current. The receiver converts the current back to voltage and most often sends the voltage to a digitizer embedded in the receiver for processing.
|
Like any measurement system, though, 4–20-mA loops need calibrating. There are many loop calibrators on the market (Figure 2), but they can cost up to $2000. As an alternative, we’ve designed and built a low-cost calibrator based on a microcontroller. The calibrator we designed can be adjusted to the desired current level through a keypad. The calibrator can produce current with adequate precision and can automatically or manually perform a calibration on a measurement system.
|
- current production and reading in the interval of 4–20 mA,
- an operating voltage of 0–20 V,
- 0.001-mA (1-µA) resolution of current source,
- 0.012% accuracy of current reading,
- powered by a 9-V alkaline battery,
- 240-VAC tolerance,
- indication of current level as percentage (%) on the LCD indicator, and
- used with a two-wire transmitter.
Design of current-loop calibration device
Our calibrator consists of a numerical keypad, an encoder, a microcontroller, a DAC, an ADC, current sources, and an LCD indicator (Figure 3). We use a PIC16F877 microcontroller to control the system. We chose this microcontroller because it has a sufficient number of input ports for the LCD, keypad, and DAC. It also has an SPI (serial peripheral interface) port, an interrupt property for the keypad, and an internal ADC.
|
For the current source, the calibrator needs a microcontroller-controlled DAC with a current output range between 4 mA and 20 mA. We use a digitally programmable AD420 chip, which has a sigma-delta architecture with 16-bit precision, a current-output capability, and an SPI port.
We also use an ADC to measure current. The PIC16F877’s ADC has 10-bit resolution and can measure voltage values between 0 V and 5 V. Current passes through a 0.47-Ω resistor and is amplified to 0–5 V by means of a noninverting amplifier. In addition, the calibrator uses a 4x3 numerical keypad and a 16x2-sized GDM1602B LCD module with an HD44780 LCD interface.
The calibrator has two modes. First, it produces current at the level of the entered value, and second, it reads the current sensed from the external current loop. In the current-source mode, the current information the user enters with the keypad is sent to the microcontroller, which analyzes it with a decoder.
The decoded current information is then transmitted to the DAC over the SPI bus, and the calibrator produces the desired current. In the measurement mode, the calibrator displays the value of the external current loop on an LCD.
We developed the microcontroller using Code Composer Studio in the PIC C language. The software sets the calibrator to work in the current-source or current-measurement modes. Figure 4 shows the flow chart of the main program.
In the current-source mode, the embedded program runs according to the flow chart in Figure 5. The user enters a current value with two digits to the left of decimal point and three digits to the right of decimal point (at precision of 0.1%). If the user wants to use a step-base proceeding, the calibrator can produce five step values: 4 mA, 8 mA, 12 mA, 16 mA, and 20 mA.
|
|
Once the third digit to the right of decimal point of current value is entered, the data for generating current transfers to the AD420 using SPI protocol. The calibrator generates the output current and “OK” appears near the current value on the LCD. If the user enters a current value out of the allowed range (below 4 mA or above 20 mA), the message “Output range is exceeded” appears on the display.
|
When designing the keypad interface, we used the “change on-state” interrupt property of the PIC16F877 for sensing when a key is pressed. With this property, when the state is changed on the B input ports of the microcontroller, an interrupt is started automatically. Thus, when the device is not in use, the microcontroller passes to sleeping mode to save power.
Two important keys in the keypad are the * and # keys:
- When a user presses the * key, the system will return to the mode-selection menu (main menu).
- When a user presses the # key, the device will cancel the current operation and display a clean screen on which the user can enter a new current value.
Figure 7 shows the digital outputs of the microcontroller that connect to a DAC circuit (AD420) with 16-bit CMOS current output using the SPI protocol. With this circuit, the device acquires a current output value in the range of 4–20 mA (according to range selection).
|
The DAC has 16-bit resolution and this resolution is used at the 4–20-mA range. We can determine the acquired current source sensitivity (Ss) with this equation:
![]() |
Thus, a change of ±1 LSB (least-significant bit) in data transmitted to the DAC produces a change in the output current of ±244.14 nA. But because the user can enter a current value with three digits after the decimal point, the calibrator’s current-sourcing resolution is 0.001 mA. We can adjust this precision value through software.
For the current measurement, we use the ADC module inside the microcontroller. The conversion process is achieved over the resolution of 10 bits. To measure the current, the calibrator passes the current over a very low-value resistance and sends it to the ADC. During the current measurement, the device is connected in series with the measurement loop. We assume that the internal impedance of the device won’t affect the circuit or that, at the least, the effect of that impedance is very low. For the current-to-voltage conversion, we use a resistance of RX = 0.47 Ω. As a result of using the low-value resistance, the acquired voltage level (VACQ) at the maximum current level (IMAX = 20 mA) is very low:
![]() |
In order to increase this low voltage level to 0–5 V, we designed a noninverting amplifier circuit with an LF351. The gain of this amplifier (G) is calculated in the following equation, where VO defines output voltage, and VI defines input voltage:
![]() |
As a result, we can calculate the measurement sensitivity (SM) with the following equation:
![]() |
This value corresponds to a high enough sensitivity value for the 4–20-mA range. But due to the characteristics of the op amp and because of noise effects, this sensitivity ratio decreases.
At the end of the digital-to-analog conversion process, the calibrator produces a DC current. But there are limits for this current to drive the connected load and keep the linearity. One of these limits is current-loop voltage compliance, which is the maximum voltage projected over the load that can be connected to current output.
Basic properties of the calibration device
During our first experiments, we used a DAC908 IC, which has 8-bit resolution, to create the output current. The output compliance limit for this IC is between –1.0 V and +1.25 V, which means a maximum load resistance of 1.25 V / 20 mA = 62.5 Ω can be connected to the current output. This value is too low for a process-control system using a voltage of 24 V for the current loop. Additionally, the DAC908 is a high-speed DAC Making it difficult to acquire signal at such low frequencies. For these reasons, we chose the AD420 instead.
Our resulting calibration device has an input and output range of 4–20 mA. The current output error is ±1 nA in experiments done at room temperature. The maximum load drive capacity is 600 Ω for a 12-V loop voltage.
For the 4–20-mA current production range, a 24-V operating voltage level is required. The externally applicable loop voltage is 32 V at maximum. The total cost of the implemented calibrator is about $50 to $100 (US$).
The device has only English language support for now. In the future, we hope to make several improvements: add a percentage mode to the display, provide support for multiple languages, and enable input through a touch pad. Table 1 summarizes the calibrator’s specifications. T&MW
| ||||||||||||||||||||||||||||||||
ACKNOWLEDGEMENT
The authors thank Süleyman Demirel University, Scientific Research Projects Coordination Center for the financial support of this work under grant #1022-M-05.
FOR FURTHER READING
“4−20mA Current Loop Primer,” Application Note (DMS-AN20), Datel. www.datel.com/data/meters/dms-an20.pdf.
AD420 Datasheet (Rev. G), Analog Devices, 2009. analog.com.
Cerid, O., et al., “Novel CMOS Reference Current Generator,” International Journal of Electronics, 1985, 78, (6). pp. 1362–3060.
Fernqvist, G., et al., “A Novel Current Calibration System up to 20 kA,” IEEE Transactions on Instrumentation and Measurement, 2003, 52, (2). pp. 445–448.
Fernqvist, G., et al., “Design and Evaluation of a 10-mA DC Current Reference Standard,” IEEE Transactions on Instrumentation and Measurement, 2003, 52, (2). pp. 440–444.
Miljanic, P.N., “Calibrator for Alternating Voltage, Current, and Power,” IEEE Transactions on Instrumentation and Measurement, 1989, 38, (2). pp. 384–389.
Moller, M., “How They Work: The 4−20mA Current Loop.” www.sensorland.com/HowPage028.html.
PIC16F877 Microcontroller Datasheet (DS30292C), Microchip, 2001.
Sams, S., and J. Lyday, “Implementing a 4-mA to 20-mA Current Loop on TI DSPs,” Application Report (SZZA045), Signal Processing Solutions/Semiconductor Group, Texas Instruments, January 2004.
Sheepard, D., “Build Your Own AutoCal/Automatic Loop Calibrator,“ Shepard Engineering Concepts, 1999. home.att.net/~dennis.shepard.
Dr. Hakan Çaliş and Dr. Abdülkadir Çakir are professors in the Department of Electrical and Electronics Engineering at Süleyman Demirel University in Isparta, Turkey.
Fırat Yücel is a lecturer in the Department of Informatics at Akdeniz University in Antalya, Turkey. He is also a PhD student in the Department of Electrical and Electronics Engineering at Pamukkale University in Denizli, Turkey. fyucel@akdeniz.edu.tr.
Talkback
No related content found.
- 0 rated items found.
Datasheets.com Electronic Parts & Inventory Search
185 million searchable parts
- Part Number
- Description
- Inventory
- Products
- Manufacturers
Sponsored Links


































