Projects Research & Design Hub

4-20mA Transmitter Test Board Project

Written by Mandar Bagul

Programmable 2-Wire 4-20mA Design

The 4-20mA transmitter has become entrenched as popular method for interfacing between control systems and I/O. In this article, Mandar provides an in-depth look at 4-20mA transmitter technologies, including a deep dive into his test board design.

  • How to build 2-wire 4-20mA current transmitter test board

  • How to understand the background of 4-20mA current loop-based field instrumentation

  • How to integrate the 1296 4-20mA T Click board from MikroElektronika,

  • How to do an interface analysis of an MCU

  • How to verify accuracy and repeatability of a test board

  • Analog Devices ADuM1411 digital isolator

  • Microchip MCP4921 12-bit DAC 

  • Texas Instruments XTR116 is a precision current output converter

  • SMBJ33A TVS diode

  • 1N4007 diode bridge

  • 1296 4-20mA T Click board from MikroElektronika,

  • BCP56 external transistor

  • Adafruit Breakout Board (Part#296)

  • Fluke 707 loop calibrator

  • DIP switches

  • LEDs

In the world of industrial controls and automation, the 2─wire 4-to- 20mA (4-20mA) current transmitter is very common. For years the 4-20mA transmitter has become an accepted, standard technique for transmitting information between field I/O and control systems. They are popular because they allow a remote process to be controlled with only two analog signal wires. The two wires carry both the power for the sensor/valve and the analog output signal. 2-wire 4-20mA transmitters are commonly used to operate valve positioners, control valves and for pneumatic and hydraulic control. Other applications for 2-wire loop-powered sensor transmitters include pressure sensors, gas sensors, chemical sensors, level sensors, temperature sensors and many more.

First appearing in mid 1950s with the advent of electrical and electronic controls, the 4-20mA signal standard reigns as one of the most popular mediums for control and signal transmission in industrial environment. A large number of hardware current transmitter ICs available, and new ICs are still launched by leading semiconductor companies today. So, it appears that the 4-20mA current loop technology is holding its own against alternative options such as fieldbus interfaces.

The longevity of 4-20mA current loop-based field instrumentation is driven in large part due its simplicity for the user: a power supply, a transmitter and a receiver (2-wire or 4-wire). Moreover, the solution is also inherently resistant to induced noise because of its differential nature of the current loop.

There’s also a wide acceptance for 4-20mA current loop-based field instrumentation in the offshore subsea oil and gas industry. In that industry, Subsea Instrumentation Interface Standard (SIIS) Level 1 defines the requirements for the 4-20mA subsea instruments. And the ISO 13628 and API 17F standards cover 4-20mA interfacing for the subsea oil and gas industry. And the technology is not only popular underwater. There’s also widespread use of 4-20mA instruments in the onshore oil and gas industry.

Figure 1 shows the types of 4-20mA current loop transmitters for communication between the process control system and the actuator. Besides being cost effective, these circuits offer the industry a low power solution. The 4-20mA current loop has being used extensively in programmable logic controllers (PLC) and distributed control systems (DCS) with digital or analog input or output. The 4-20mA current loop interface is usually preferred because they offer the most cost-effective approach to long distance noise immune data transmission.

FIGURE 1 – 4-20mA transmitter types (Courtesy: Dataforth)

As Figure 1 shows, Type 2 is a 2- wire transmitter energized by the loop powered and the loop source voltage (compliance) is in the receiver. Meanwhile, Type 3 is a 2- wire transmitter energized by the supply voltage at the transmitter—the transmitter sources the loop current.

I worked on the High Integrity Pressure Protection System (HIPPS) Logic Solver development program. For that program, one key requirement was to test the hysteresis threshold level of HIPPS Logic Solver’s ability to reject the spurious increments or spikes at output of pressure transducer (2-wire 4-20mA loop powered). Those spurious increments or spikes are generated from to fluctuations in the pipeline pressure. To simulate a test scenario, a test jig was required that would generate a pulse of 15mA for a settable duration in range of 200ms to 1,000ms, and then return to an 8mA level—the trip threshold was 12.5mA.

At first, we looked at whether Fluke’s 707 Loop Calibrator device—or any other test instrument or commercial off-the-shelf (COTS) unit—could offer the programming flexibility we needed. But I couldn’t shortlist any 4-20mA unit that would meet our requirements.

Meanwhile, when assisting a team working on a valve positioner, one of their test requirements was to generate ramp-up and ramp-down of 4mA-to-20mA output to operate from 0% to 100% valve operation. The firmware developer also added yet another requirement: that the test jig have a conventional setting option to increment and decrement, so that you didn’t have to disconnect the test jig and connect the Fluke 707 handheld and vice versa. Even in this case, a COTS unit wasn’t available that would fulfill our test requirements.


Advertise Here

With all that in mind, we decided we needed to develop a test jig to so we could meet all those requirements. Because of the growing widespread availability of rapid prototyping solutions in recent years, my inclination was to build the test jig using readily available breakout boards.

Because I had used Click boards from MikroElektronika in the past, I was pretty sure I’d be able to select a solution from its Mikroe Click product line that would meet our needs. I chose the MIKROE-1296 4-20mA T Click board. Fortunately supporting firmware program examples are available for it. That would make the implementation easy, especially using my mikroC PRO for AVR compiler. That helped drive my decision to use an AVR-based breakout board. I have working experience on Microchip Technology (formerly Atmel) AVR 8-bit microcontrollers (MCUs). The AVR breakout board I chose was Adafruit part# 296.

On the connection side, among our requirements was that this test jig had to have some flexibility. It has to be wired to either emulate a 2-wire loop powered 4-20mA device as shown in Figure 2 or wired to emulate a 2-wire 4-20mA current transmitter as illustrated in Figure 3. The floating connection relative to ground makes 2-wire transmitters somewhat flexible in the way they connect to various receiver devices. In most common installations the loop power supply will be local to the current transmitter.

FIGURE 2 – This shows the connections required for a 4-20mA, 2-wire loop powered test board.

FIGURE 3 – Shown here are the connections required for a 4-20mA, 2-wire current transmitter.

Given that this 4-20mA programmable test board was used extensively for type testing, validation and verification of HIPPS systems and valve positioners. Here’s some background of each.

High Integrity Pressure Protection System (HIPPS): When operating in high pressure environment and production field, an overpressure event can cause damage to the environment, to infrastructure and to personnel. Mitigating that risk on production wells and flowlines is a challenge that can be met with HIPPS.


Advertise Here

The primary function of the HIPPS Logic Solver is to detect the high-pressure conditions from the 4-20mA pressure transmitters and close the isolation valves to protect the lower rated pipeline system. HIPPS are fail-close by design, based on the signal of an overpressure event.

HIPPS is a self-contained, independent system operated on demand with 1oo2 or 2oo3 voting pressure transmitter input (4- 20mA) to a logic solver and two spring return hydraulically actuated safety valves. HIPPS is a safety instrumented system (SIS) to prevent or reduce hazardous events by taking a process to a safe state when fault condition occurs (Figure 4a). A SIS will have a Safety Integrity Level (SIL) which is measure of the system performance in terms of Probability of Failure on Demand (PFD). For additional information and deep dive reading on SIL and Safety functions you can read the article “Risk Analysis: Establish Required Risk Reduction” from PEPPEERL+FUCHS magazine [1].

FIGURE 4a (top) -This illustrates a single line diagram of HIPPS system. b (bottom) Shown here is a single line diagram of the valve positioner.

Valve Positioner: This is a device used for manipulating and operating a control valve more accurately than it would otherwise. Physically, a valve positioner is bolted onto the yoke of the valve. Electro-pneumatic valve positioners are used with rotary air actuators to accurately position control valves used in throttling applications. These valve positioners convert a 4-20mA input control signal to a proportional pneumatic output. This output is fed to an air actuator which in turn controls the valve position and flow (combined with mechanical feedback).

A valve positioner is used to improve the performance of a pneumatically operated actuator, by adding a position control loop around the actuator as shown in Figure 4b. To set the desired percentage valve opening, a 4-20mA current transmitter is interfaced with the valve positioner as input.


Advertise Here

To understand the operation of the two-wire current transmitter, let’s consider each elements of the current transmitter.

Power Supply: The current loop uses a DC power source—the typical VLOOP defined for field instruments is in a range of 9VDC to 24 VDC. Therefore, I selected a power supply main input adapter delivering 24VDC. This COTS power supply supplied by Sparktron is built around the TNY product family from Power Integrations. The input power supply filter on the board is a standard arrangement: 47µF tantalum capacitor in parallel with 0.1µF MLCC capacitor.

Transmitter: There are quite a few ICs that accomplish this requirement, and some of the them have very narrow target applications—like RTD sensor or bridge. There are some with a built-in DAC for direct interfacing with MCU. The selected Click MIKROE-1296 4-20mA current loop transmitter is designed with XTR116 from Texas Instruments (TI).

Note that the transmitter is not the source of current, but simply regulates the flow and magnitude of the current through it. The current is sourced by the power supply, flows in controlled fashion through the transmitter, then into the receiver and returns to the power supply. The current flowing through the receiver produces a voltage that is easily measured by the analog input channel of an ADC

Receiver: This device is at the other end of the transmission line (wire). In a 4-20mA process loop, the receiver could be located hundreds of meters away from the transmitter. Receiving a 4-20mA signal is normally done by passing the current through a resistor and processing the voltage. It’s rather common to see a 250Ω resistor used that generates a voltage of 1V to 5V. That voltage is fed to a differential amplifier and then to an ADC.

An important parameter associated with 4-20mA loop that’s worth discussing here is compliance voltage. Compliance voltage is defined as the amount of voltage available for correct operation. To bias the +5VDC supply to the Adafruit ATmega32-U4 breakout board a isolated DC/DC module (XP Power IMA0115S5) was soldered on the board, therefore now we have a isolated +5V DC supply for the test board operation derived from +15V DC Loop Voltage.

Subsequently, while experimenting with the assembled test board, I had applied 15VDC to bias the circuit. the loop voltage was 14.60VDC and I had connected a resistive load of 330Ω to simulate the role of a receiver. I was incrementing and decrementing the value with the rotatory encoder and my observation was that the transmitter current value never linearly exceeded the value of 18.687mA. That’s because the voltage drop across the resistance load was 6.2VDC, so the required compliance voltage of 7.5V was not stable or available for the XTR116.

TI’s E2E community has blog piece about its XTR116 device and compliance voltage. It says that the XTR116 has a minimum power supply voltage—Vcompliance—of 7.5V required between V+ (Pin# 07) and IO (Pin# 04) for proper operation. If the resistive load and/or resistive losses due to the cable length cause the supply voltage to decrease below +7.5V, the XTR116 will lose its ability to regulate the output current. This is the most common issue that people encounter with 2-wire transmitter systems results when violating the compliance voltage of the system.

The Voltage compliance issue is directly related to Ohm’s law. The product of the output and the resistance in the loop can’t exceed the supply voltage applied to the system. If the Vcompliance and VLoop is known, the maximum loop resistance RLoop can be calculated as follows:

What I’ve faced while experimenting with the 15V loop power supply shows the best example of the voltage compliance issues that can occur in the field during testing due to a wrong value resistance placed in the circuit as a load resistance. If the output current of the transmitter stops increasing during testing, measure the voltage drop across the resistive load. If the load voltage drop is higher than excepted, the load resistance value is the likely cause of output current issues.

The XTR116’s low compliance voltage rating of 7.5V permits the use of various voltage protection methods without compromising operating range. The MIKROE-1296 4-20mA T Click board’s schematic [2] shows a diode bridge circuit, which allows normal operation, even when the voltage connection lines are reversed. The bridge causes a two-diode drop (approximately 1.4V) loss in loop supply voltage. This results in a compliance voltage of approximately 9V—satisfactory for most applications.

Most industrial systems use a 24V system power supply, which means there is generally a fairly large voltage range for the compliance. With that in mind, all of our future experiments were carried out with 24V loop power supply and the same was implemented when interfacing our programmable 4-20mA test board with the Valve Position Indicator. As a result, the issue of compliance voltage was resolved. Therefore, to derive 5V for the MCU breakout board from the 24V loop voltage, I had to change the DC/DC module to Murata Power Solutions’ CMR118C (Digi-Key Part No. 811-2897-5-ND).

At the start of this project I had decided that I would integrate the 1296 4-20mA T Click board from MikroElektronika, evaluate the proof of concept and then complete the application around it. This Click has all the attributes that an industrial design requires. It has isolation between field side and the MCU side. And it features industrial grade operating temperature range for all of its components.

The 1296 4-20mA T Click features an Analog Devices ADuM1411 Quad-channel digital isolator, a Microchip MCP4921 12-bit DAC and the XTR116 4-20mA current loop transmitter. The 1296 4-20mA T Click communicates with target board MCU via three mikroBUS SPI lines (SDI, SCK, CS). mikroBUS is MikroElektronika’s add-on board socket standard [3]. The mikroBUS interface consist of three groups of communication interface: SPI, UART and I2C. There are six additional pins: PWM, interrupt, analog input, reset and chip select. The power supply connection pins include +3.3V, +5.0V and apparently a ground pin.

A hallmark of any good design is providing a good user interface. As a first choice we often think that a push button or tactile switch is the better option to increment or decrement the value. But another method for user interfacing is to use a rotary encoder as you input device. For all their simplicity, rotary encoders provide good resolution and responsive control. In addition, most users are comfortable with the concept of turning a knob.

A quadrature rotary encoder generates two digital signals out of phase by 90 degrees to encode their clockwise (CW) or counter-clockwise (CCW) movement. Their interface is simple, and the output is not tied to the absolute position of the rotary encoder, making them ideal for setting a 4-20mA transmitter’s value.

For this project, I selected a Bourns digital contacting encoder with 2-bit quadrature output and 24 detents/revolution (Part#: ECW1J-B24-BC0024). Signals that are 90 degrees out of phase with each other are called quadrature. That’s where the name quadrature encoder comes from. This type of encoder’s two outputs are labelled as channel A and channel B. As shown in Figure 5, the “X” axis can be considered the passage of time during which the encoder is being turned in a CW direction. Note that the channel A is always logic High with respect to channel B. During CCW rotation of the shaft, channel B is always logic High with respect to channel A.

FIGURE 5 – Channel A is leading channel B by 90 degrees electrically when the shaft is rotated clockwise (CW) and vice-versa when rotated counterclockwise (CCW).

The encoder channel A and B outputs are pulled-up (High) to +5V through a 2,200Ω resistors, and the common pin is connected to ground. You can monitor the quadrature encoder output by watching for the falling edge of channel A and then quickly checking to see if the B signal is High or Low. The state of the B signal then indicates the direction in which the encoder is turning and dictates whether you should increment or decrement the parameter—in other words, the 4-20mA output value.

Here is the simplest way to implement this functionality: Connect the channel A signal to the external interrupt pin INT0 and channel B to the port pin of the MCU. Configure the AVR MCU interrupt INT0 to accept falling edge and enable. The interrupt service routine (ISR) of INT0 merely reads the state of the port pin connected to signal B and then increments or decrements the 4-20mA output value accordingly. With that set up, interfacing the rotary encoder with the MCU is straightforward.

For use in human-to machine (HMI) interface applications, the Bourns rotary contacting encoders have two major parts in their construction: The coded element and a contacting sensor or wiper. Because of its mechanical construction, debounce pulses are generated at the output of the channel A and B when the encoder shaft is rotated either CW or CCW.

To avoid nuisance multiple interrupts, you have to eliminate debounce pulses. The easiest way to do that is to connect a 100nF MLCC between the channel output and the ground. A more deluxe way is to interface a switch debounce IC between the output of the rotary encoder output channels and MCU port lines. For example, you could interface using Maxim Integrated’s MAX6817 ±15kV ESD-Protected, Single/Dual/Octal, CMOS Switch debouncers. A couple of waveforms are captured to demonstrate the debounce pulses generated at channel A (Figure 6 and Figure 7).

FIGURE 6 – This shows the output of the rotary encoder. Debounce pulses are prominent with Channel A (CH_A) -orange trace.

FIGURE 7 – The output of the rotary encoder is shown here again. With 100nF capacitor add to channel A & B the falling edge is crisp and no debounce pulses are observed.

Now we’ve covered most the key accepts related to 4-20mA current loop technology and the requirements for our test jig. Now we will deep dive into the finer details of our design. Figure 8 shows the schematic of my programmable 2-wire 4-20mA current transmitter test board. Figure 9 shows a photo of the board assembly. As explained earlier, at the heart of the design is MIKROE-1296 4-20mA T Click board from MikroElektronika. Its main components are the ADuM1411, the MCP4921, the XTR116 and a diode bridge. Let’s look at each of these is more detail.

FIGURE 8 – Schematic of my programmable 2-wire 4-20mA current transmitter test board.

FIGURE 9 – Photo of my programmable 2-wire 4-20mA current transmitter test board assembly

Analog Devices ADuM1411: There are advantages to having a quad channel digital isolator in a system using an MCU powered from a voltage source referenced to another external potential. In this type of system, the sensor and MCU can’t be connected directly to the 2-wire transmitter GND pin (IRET) pin 3 of XTR116. So, using the ADuM1411 as the digital isolator for interfacing SPI lines with the 4-20mA T Click, the MCU ground is isolated from VLOOP GND. This prevents fault propagation from one section to another, while also protecting the MCU section unit in an environment with hazardous voltages, noise immunity transient signals, common-mode voltages and fluctuating ground potentials— ground potentials capable of damaging and ruining the 4-20mA transmitter capabilities.

Microchip MCP4921: This 12-bit DAC meets the 4-20mA transmitter’s requirement. In summary, the MCP4921 is a single channel, 12-bit DAC with an external voltage reference and an SPI interface which use external voltage reference (VREF). These devices provide very high accuracy and low noise performance, and are suitable for industrial applications—such as set point control, offset adjustment and sensor calibration applications.

Typically, in a flow control valve operation, the percentage of opening is proportional to a 4-20mA signal feed to the valve. Therefore:


TI XTR116: The XTR116 is a fundamental building block of smart sensors using 4-20mA current transmission. The XTR116 is a precision current output converter designed to transmit analog 4-20mA signals over an industry standard current loop. They provide accurate current scaling and output current limit functions.

SMBJ33A (Transit Voltage Protection) (various vendors): Remote connections to current transmitters can sometimes be subjected to voltage surges. It is prudent to limit the maximum surge voltage applied to the XTR116 to as low as practical. Various TVS diode and surge clamping diodes are specially designed for this purpose. Select a clamp diode with as low a voltage rating as possible for best protection. For example, a 36V protection diode will assure proper transmitter operation at normal loop voltages yet will provide an appropriate level of protection against voltage surges.

1N4007 diode bridge (various vendors): A diode bridge can be inserted in series with the loop supply voltage and the V+ pin to protect against reverse output connection lines with only a 1.4V loss in loop supply voltage.

BCP56 external transistor (various vendors): The external transistor, BCP56: Q1, conducts the majority of the full-scale output current. The XTR116 is designed to drive any NPN transistor with sufficient voltage, current and power rating. A MOSFET transistor will not improve the accuracy of the XTR116 and is NOT recommended.

Adafruit Breakout Board (Part#296): Based around the Microchip ATmega32U4 MCU, some key features:

• Atmega32u4 MCU: AVR core with USB capability. 32KB flash, 2.5KB RAM running at 16MHz
• Standard AVR 6-pin ISP connector for direct programming (when you need the extra space)
• Big Bootload/Reset button
• 500mA fuse on the USB power line
• Power LED and ‘user’ LED (also indicates when the bootloader is active)
• Fits nicely in any breadboard
• 4 mounting holes

The Adafruit breakout board is interfaced to the 1296 4-20mA T Click board via SPI lines. In other words, the ATmega32U4 MCU SPI lines are interfaced with the ADuM1411 quad channel digital isolators present on the 1296 Click board. All CMOS electronic devices have precisely defined operating conditions. And, as long as these devices are used within its defined operating parameter limits, they should continue to operate correctly. However, if the allowable conditions are violated, spurious results may result.

Any time a device is interfaced to an MCU, careful interface analysis must be performed. Semiconductor manufacturers readily provide electrical characteristics data necessary to complete this analysis. To perform the interface analysis, there are eight different electrical specifications required for electrical interface analysis. These electrical parameters are listed in Table 1. These electrical characteristics are required for both the MCU and the external components. If external circuitry is connected such that the MCU acts as a current source (current leaving MCU) or current sink (current entering MCU), the voltage parameters listed in Table 1 will also be affected.

TABLE 1 – Listed here, there are eight different electrical specifications required for electrical interface analysis.

In the current source case, an output voltage VOH is provided at the output pin of the MCU when the load connected to this pin draws a current of IOH. If a load draws more current from the output pin than the IOH specification, the value of VOH is reduced. If the load current becomes too high, the value of VOH falls below the value of VIH for the subsequent logic circuit stage and will not be recognized as an acceptable logic high signal. When this situation occurs, erratic and unpredictable circuit behavior results.

In the current sink case, an output voltage VOL is provided at the output pin of the MCU when the load connected to this pin delivers a current of IOL to this logic pin. If a load delivers more current to the output pin of the MCU than the IOL specification, the value of VOL increases. If the load current becomes too high, the value of VOL rises above the value of VIL for the subsequent logic circuit stage and will not be recognized as an acceptable logic low signal. As before, when this situation occurs, erratic and unpredictable circuit behavior results. For additional reference and reading on this topic, download “Little Logic Guide” from Texas Instruments [4].

Now, let’s examine the various peripherals interfaced to our MCU.

DIP switches: For mode selection two 2-way DIP switches are added so that we can have 16 selection in all.

LED: An amber color LED is interfaced with PORTD.7 output. This LED is switched ON for 50ms to flash for every rotation of the rotary encoder either CW or CCW, thus giving the responsive feedback to the user.

Test Points: Whether you’re working on hardware or firmware problems, figure on adding test points for critical signals and for port I/Os for toggling the bit for firmware testing.

SPI: Now, a quick overview of the SPI interface because this is the principal interface between the MCU and the 4-20mA T Click board The SPI bus has master and slave configurations. In SPI interfaces, the master can connect to one or more slave devices and in cases when multiple slave devices are used, the master will use multiple chip select (CS) lines as shown in Figure 10.

FIGURE 10 – Serial Peripheral Interface (SPI) interface between master and slave

SPI has data and control lines. CS (chip select) is sometimes referred to as slave select. CS is driven by the master and arbitrates over the SPI bus. When driven low, the SPI bus is active. SDO/SDI (serial data in and serial data out) are names describing data flow for the device. The system names describe the data flow relationship between the master and slave. System names: MOSI = Master Out Slave In and MISO = Master In Slave Out. Example: SDO on a slave is MISO in the system and SDI is MOSI in the system. SCLK (serial clock) is a square wave driven by the SPI master. Data on SDO and SDI have relative timing to the SCLK signal, which controls the latching of the data on the SPI bus.

Now let’s discuss our test board’s modes of operation. With pair of DIP switches (DIP_Switch_A and DIP_Switch_B , see Figure 7 again), we can have three modes of operation and resolution when in Mode 0 using the rotary encoder.

Mode 0: In this mode the user can increment or decrement mA value with the rotary encoder and, depending upon the setting on DIP Switch A, setting the resolution—in other words, the fine and course settings of the mA value of increment and decrement can be selected: 00=1mA; 00=1mA; 01=500mA: 10= 100mA; 11=0.1mA.

Mode 1: When test jig is set to Mode 1 the mA output will ramp up from 4mA (0%) to 20mA (100%). So, every 15 seconds the output value will increment by 1.0mA and eventually, when it reaches 20mA after 15 seconds it starts to ramp down by decrementing the transmitter value by 1.0mA till it reaches 4mA, this ramp-up and ramp-down function is programmed in a loop, but can be programmed as a single event of ramp up and ramp down after reset.

Mode 2: Pulsed output is achieved in this mode. As mentioned in the initial paragraphs of this article, the requirement of pulsed output is to validate ability of the HIPPS Logic solver (HLS) to reject the spurious spikes from the 4-20mA pressure transmitter. The HLS has a trip threshold of 13mA. Therefore, to simulate the real-world scenario, this 4-20mA test jig will generate pulse of 15mA for a duration of 500ms and then settle down steady state of 7mA. All these three parameters are settable depending upon the trip threshold limits and test cases relate validation of the reaction time of the HIPPS Logic Slover to spurious trips. The oscilloscope screen capture in Figure 11 shows the waveforms captured across load resistance 330Ω. The steady state is 7.00mA

FIGURE 11 – This illustrates a pulsed output of the 4-20mA transmitter

Because this test jig is used for validation and verification, we’re obliged to verify the accurateness of this programmable 4-20mA test board. A calibrated Fluke 707 loop calibrator is used to verify the accuracy. This handheld is interfaced with the 4-20 Test board. The Fluke 707 is set in “measure mode,” and for the entire range, starting from lowest current of 3.75mA to the maximum range of the 20.75mA, the verification is carried out and percent error for the Digital Panel Meter (DPM) is calculated when compared to Fluke 707. Table 2 shows a comparison between MECO DPM and Fluke 707 for the entire range and the % error. You can infer from table that percent error over the entire range is less than 0.125%.

TABLE 2 – This table compares the MECO DPM and Fluke 707 for the entire range and the % error.

To verify the stability, the programable 4-20mA test board was interfaced with valve positioner and was set to 12.5mA—that is, 50% opening for 48 hours, and it was observed that no drift and no variation in valve positioner was observed. To verify the repeatability the output of programable the 4-20mA test board was connected to a calibrated Fluke 707 loop calibrator (again, in measure mode) and two set points were defined: 8mA (25%) and 16mA (75%). Output value was varied between the two set values and reading displayed on the 4½ DPM was compared with the Fluke 707 handheld. A number of readings were jotted down to infer on repeatability and calculate the mean deviation. The results were satisfactory, and the unit performed as per the requirements and expectations.

The firmware code development was completed using MikroElektronika’s mikroC PRO for AVR (version 7.01). The firmware can be segregated into three sections. The first section is the initialization of port lines to interface the Bourns rotary encoder. DIP switches, LED and SPI lines are enabled to interface to the 4-20mA T Click board. The second is the function to write the values to the DAC (MCP4991). DAC_Output(value) is the function to write the value to the DAC. The third section is the ISR to read the rotary encoder channel and increment or decrement the 4-20mA output value accordingly. The well commented code is in file myproject420mA.c  available on Circuit Cellar’s code and files download webpage.

In the present version of the test board, to change the amplitude and the pulse width for Mode 1 and More 2, we have to change parameters in the firmware and then program the board with the AVR ISP programmer and AVR Studio. This is an inconvenient affair when the user is executing multiple test cases, so the future plan is to interface the MCU via USB to a PC and develop a GUI to set the amplitude and pulse width as per the requirement of test cases.

The solution developed in this project is very cost effective, using standard, available off the self-items—an innovative solution that met our test requirements for type testing, validation, verification and regression testing. In the true sense, this design and development activity was an example of rapid prototyping. COTS-modules are the building blocks of this programmable 4-20mA current transmitter test jig. The 4-20mA T Click board from MikroElektronika and the AVR MCU breakout board from Adafruit both helped to expedite the test jig development. Meanwhile, the code development cycle was quick thanks to readily available drivers and routine examples for the 4-20mA T Click provided in the mikroC PRO for AVR environment and in LibStock. In this era of wireless technologies, IIoT and a myriad of fieldbus solutions, the 4-20mA is still the standard solution and it’s holding its ground.

Author’s Note: The views, thoughts and opinions expressed in this article belong solely to the myself, and not necessarily to this author’s employer organization. 



[2] MIKROE-1296 4-20mA T Click board’s schematic
[3] For additional information on mikroBUS – Refer:
[4]  “Little Logic Guide” from Texas Instruments.

Adafruit Industries |
Analog Devices |
Bourns |
Fluke |
Maxim Integrated |
Microchip Technology |
MikroElektronika |
Murata Power Solutions |
Power Integrations |
Sparktron Systems |
Texas Instruments |
XP Power |


Keep up-to-date with our FREE Weekly Newsletter!

Don't miss out on upcoming issues of Circuit Cellar.

Note: We’ve made the Dec 2022 issue of Circuit Cellar available as a free sample issue. In it, you’ll find a rich variety of the kinds of articles and information that exemplify a typical issue of the current magazine.

Would you like to write for Circuit Cellar? We are always accepting articles/posts from the technical community. Get in touch with us and let's discuss your ideas.

Sponsor this Article
Senior Engineer/Technologist at GE Oil & Gas Company | + posts

Mandar Bagul has been working with Baker Hughes, a GE Oil & Gas Company in HTC, Hyderabad, India as a Senior Engineer/Technologist for last 11+ years in the field of Subsea Electronics and Subsea Systems for Oil & Gas production. He is interested in Atmel AVR family MCUs, and pursues his interests related to developing products and projects based around those MCUs. Mandar holds US Patent (US8558550 B2), Title: "Monitoring Of Power Switching Modules." This is his second article published with the magazine, the first being "Interface an SD Memory Card with an MCU" (Circuit Cellar221, December 2008).

Supporting Companies

Upcoming Events

Copyright © KCK Media Corp.
All Rights Reserved

Copyright © 2024 KCK Media Corp.

4-20mA Transmitter Test Board Project

by Mandar Bagul time to read: 22 min