Subscribe to Test & Measurement World
RSS
Reprints/License
Print
Email
Average Rating:
  • (0)
    Rate this:
  • 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 version of thie article appeared in the February 2012 issue of Test & Measurement World. See the PDF.
    Many industrial systems use the 4–20-mA loop to transmit measurements from sensors to displays, dataloggers, computers, PLCs (programmable logic controllers), and other devices. Unlike sending a voltage, sending a current eliminates losses in long wires and reduces interference from outside sources that can impair measurements. Plus, by using a measurement range that starts at 4 mA rather than 20 mA, the system can detect a failure should the current drop below 4 mA and take appropriate action that can prevent runaway conditions.

    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.

     TMW_1202_F2_Loop_Fig1

    FIGURE 1. In a 4–20-mA measurement loop, the amount of current represents the measured value of a sensor, such as temperature, pressure, or weight.
     
    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.

    TMW_1202_F2_Loop_Fig2
    FIGURE 2. The Fluke 707 loop calibrator sells for around $700 to $800.
    Before designing our calibrator, we studied commercial calibration devices and found that they have these general properties:

    • 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.

    TMW_1202_F2_Loop_Fig3

    FIGURE 3. The microcontroller-based design uses a DAC, an ADC, a keypad, and a display.
     
    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.

    TMW_1202_F2_Loop_Fig4

    FIGURE 4. Embedded software lets the calibrator both produce current and measure loop current.
     
    TMW_1202_F2_Loop_Fig5
    FIGURE 5. Software checks that the user input falls within the range of 4–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.

    TMW_1202_F2_Loop_Fig6
    FIGURE 6. Microcontroller software converts a digitized voltage across a known resistor into units of current for the display.
    In current-measurement mode (Figure 6), the calibrator’s ADC reads the level resulting from the voltage amplification layer, and the screen displays the measured current value.

    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.

    Current source and measurement

    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).

     TMW_1202_F2_Loop_Fig7
    FIGURE 7. A DAC takes a digital value from the microcontroller and converts it into a 4–20-mA loop current.
      
    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:

    Equation 1

     
    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:

    Equation 2
     
    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:

    Equation 3
     
    As a result, we can calculate the measurement sensitivity (SM) with the following equation:

    Equation 4
     
    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

     
    Table 1. Specifications of the microcontroller-based loop calibrator.
     Parameter Value
     Type 4–20-mA digital current-loop calibrator
     Input and output range
    4–20 mA
     Current output error (Note 1)
    ±0.15% @ TA = 25ºC
     Current source resolution
    0.001 mA
     Measurement sensitivity (SM)
    9.18 nV
     Temperature deviation (Note 1)
    0.003% full-scale/ºC
     Maximum load (drive capacity)
    600 Ω @12 V
     Voltage compliance
    10.5 V
     External conversion loop
    Maximum 32 VDC
     Display 16x2 LCD (3.00x5.23-mm
    character font)
     Keypad 4x3 numerical keypad
     Feedback warning indicator (LED)
    Output-error recognition and open-loop recognition
     Power supply
    220 V/12 VAC adapter
     Note 1: These parameters were determined based on the ADC data sheet.




    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.
    Average Rating:
  • (0)
    Rate this:
  • RSS
    Reprints/License
    Print
    Email
    Talkback
    Similar Content from T&MW

    No related content found.

    »MORE

    • 0 rated items found.

    Datasheets.com Electronic Parts & Inventory Search

    185 million searchable parts
    • Part Number
    • Description
    • Inventory
    • Products
    • Manufacturers
    Canon Resource Center

    Featured Company


    Most Recent Resources

    Featured Job On
    Scroll for More Jobs
    Advertisement
    More Content
    • Blogs
    • Webcasts

    Sorry, no blogs are active for this topic.

    » VIEW ALL BLOGS RSS
    • All


    Advertisement
    Advertisement
    About Us   |   Advertising Info   |   Site Map   |   Contact Us   |   FREE Subscription
    © 2011 UBM Electronics . All rights reserved.
    Use of this Web site is subject to its Terms of Use | Privacy Policy

    Feedback Form
    Feedback Analytics