Arduino 4–20mA current loop revisited: a simpler calibration procedure

In today’s blog post I will revisit some aspects related to the 4–20mA current loop implemented with Arduino Uno boards, MikroElektronika Arduino Uno click shields and a pair of 4–20mA T and 4–20mA R click boards.

In my previous blog posts regarding the implementation of a 4–20mA bus with MikroElektronika click boards and Arduino Unos I have described a precise calibration procedure (code provided). However, it has come to my attention that the proposed calibration procedure is a bit hard to follow.

So, here there it is: a more straightforward, albeit less precise calibration procedure, that can be performed with just the ubiquitous tools you find in the average maker’s lab. As such, there are some changes and improvements:

  • One needs only one laptop to power one side of the 4–20mA bus and to perform serial debugging.
  • The circuit on the other side of the 4bus needs to be powered on (battery or AC adapter);
  • The usual multimeter with 20mA and 200mA DC ranges will do;
  • One needs an extra potentiometer, connected as a voltage divider to pin A0 of the transmitter circuit.
  • Calibration is less precise but easier to perform.

Why Calibrate?

Some of my readers have used the contact form to ask me about the need to perform calibration.

The answer is simple: you don’t have just a current loop. You are building a 4–20mA current loop. There is a standard which says that the minimum current through the loop is 4mA, and the maximum current that flows through the loop cannot exceed 20mA. Anything below 4mA can indicate a fault (open loop). Anything over 20mA also indicates a fault condition (short circuit).

In our particular case, the calibration procedure aims to find the DAC_4mA value that, when written into the DAC onboard the 4–20mA T click board, leads to a 4mA current flowing through the bus. We also will determine the DAC_20mA value that leads to a 20mA through the current loop.

A simplified calibration procedure

The test rig is simple. In the picture below the transmitter is powered from the laptop. The receiver is battery powered. A multimeter was put in series with the 4–20mA bus, and it was set to the 200mA DC range.

4–20mA current loop with MikroElektronika click boards

Just like in the first series of blog posts, the calibration of the 4–20mA bus is a two-step process. One has to calibrate the transmitter first, then the receiver.

4–20mA T calibration routine

I have simplified the calibration procedure by using a potentiometer connected to pin A0 of the transmitter board. My potentiometer is soldered on a proto board. I might just need it to debug other projects where analog input is needed. One can use wires to connect directly on the mikroBUS connector; it will work fine as well.


The voltage applied on the pin A0 will be read by the internal ADC of the Arduino Uno and will be used to drive the DAC. The value written into the DAC registers is also sent to the serial terminal.
4–20mA transmitter with Arduino Uno

4–20mA transmitter with Arduino Uno

To calibrate the bus, one has to load the code below into the transmitter side and start the serial monitor to watch the values written into the DAC. The receiver needs to be powered on, as it provides power to the 4–20mA bus.

Now, slowly turn the potentiometer knob while watching the current values on your multimeter. Try to find a position of the potentiometer knob that corresponds to a 4mA current through the bus — you may switch to the 20mA range for increased precision. Watch the serial monitor and write down the value it shows — it is the DAC_4mA calibration parameter.

You might not get exactly 4mA, as this calibration method is less precise. For maker/hobby/student projects it might be enough to choose the closest value to 4mA.

Now, switch back to the 200mA range, and play with the potentiometer knob until you get 20mA through the bus. Again, watch the output of the serial monitor. Write down the value — it is the DAC_20mA calibration parameter.

Calibrated transmitter code

Take the above values for DAC_4mA and DAC_20mA. Update the code below with those values and upload the code to the transmitter.
Now, with the potentiometer button turned at one end you should have 4mA through the bus. With the potentiometer button turned at the opposite end you should be able to measure 20mA through the bus.

Now as the transmitter is calibrated, we can further proceed to calibrate the receiver.

4–20mA receiver calibration

The calibration of the receiver aims to restore the initial signal input. The analogRead() function returns values between 0 and 1023. We aim to return the same values in the serial monitor connected to the receiver side.

To calibrate the receiver we have to connect the receiver to the laptop, and power the transmitter from the external supply — the transmitter is already calibrated, no need for serial debugging anymore. The multimeter is still set on the 200mA DC, and in series with the bus.
4–20mA receiver with Arduino Uno

Now, upload the code below in the receiver. Start the serial monitor.

Turn the potentiometer knob until you have 4mA through the bus. Write down the value returned by the receiver in the serial terminal — that is the ADC_4mA calibration parameter.

Do the same for 20mA through the bus, and write down the ADC_20mA calibration values.

Now, take the code below, update the calibration values and upload it to the receiver:

Air quality,2,Arduino code library,2,Arduino projects,23,Buggy,1,Casual stuff,1,ESP8266,2,MikroElektronika,3,PIC projects,7,Review,26,Robots,1,Tutorial,20,
Electronza: Arduino 4–20mA current loop revisited: a simpler calibration procedure
Arduino 4–20mA current loop revisited: a simpler calibration procedure
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content