4-20mA sensor read by an arduino

Discussion in 'Embedded Systems and Microcontrollers' started by Nicolas Chalhoub, Jul 20, 2015.

  1. Nicolas Chalhoub

    Thread Starter New Member

    Jul 20, 2015
    3
    0
    Good morning everyone.
    In my company we have a chlorine sensor that gives a 4-20mA output and a controller that displays the output on a screen with specific units.
    How can i replace this controller and use an Arduino Uno (That's what i have right now). I know it has an analog inputs, but any more information about the program i must write?
    In summary, i want to replace the chlorine controller with an Arduino, that can read the Chlorine sensor's 4-20mA output.

    Thanks in advance.
     
  2. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,800
    1,103
    Welcome to AAC!
    In principle you need to pass that current through a resistor chosen such that 20mA gives a voltage across the resistor no more than the supply voltage of the Arduino, then use the ADC converter in the Arduino to read the resistor voltage. Sorry, I don't do Arduino, so can't help with the program, but others here hopefully can.
     
    Nicolas Chalhoub likes this.
  3. strantor

    AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    Do you have any good reason to replace an industrial grade, purpose-built controller that has been designed and approved for use in control of hazardous processes, with a generic consumer-level hobbyist platform that is required to meet absolutely none of the same criteria? Do you have any good reason to take that kind of liability onto yourself? Do you have the money to pay people's children and spouses for the rest of their lives when you kill their breadwinners by hazardizing a deadly chlorine operation?

    If the answer to all of those questions is "yes," then simply place a precision 250 ohm resistor across the 4-20mA output and it turns into a 1-5V output.
     
    cmartinez, #12 and djsfantasi like this.
  4. Nicolas Chalhoub

    Thread Starter New Member

    Jul 20, 2015
    3
    0
    Hehe, Thanks for your concern, but i want just to read the Chlorine amount, i just need to put a LCD on the bread board next the arduino.
    And the dosing pump that pumps aqua chlorine runs independently.
    I just need to know the necessary program to convert this 4-20mA signal coming from the sensor to a well read ppm unit.
    Thanks.
     
  5. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,539
    1,251
    Max and others know more about industrial controls than I do, but as I understand things a 4-20 mA loop can originate at either end of a sensor - display system. If the sensor generates the current loop with the information modulated onto it, then indeed a single precision resistor at the A/D input might be all that is needed. But if the sensor expects the remote controller/display to generate the current loop, which it then derives operating power from and modulates its data onto, then you need to create the current loop as well as extract the analog data for the A/D. Do you know where the 4-20 mA loop source is?

    ak
     
    Nicolas Chalhoub likes this.
  6. strantor

    AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    True, but this is trivial. The sensor will (in all likelihood) be either a 2-wire or 3-wire 24VDC sensor. If 2-wire, connect the positive sensor lead to +24V, negaive to 250ohm resistor, other end of resistor to GND. If 3-wire, connect the positive sensor lead to +24V, negaive to GND, and SIG to 250ohm resistor, other end of resistor to GND.
     
    Nicolas Chalhoub likes this.
  7. sirch2

    Well-Known Member

    Jan 21, 2013
    1,008
    351
    Nicolas Chalhoub likes this.
  8. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,392
    497
    like others already said, Uno does not have facility/feature to read analog current.

    you have to convert current into voltage, then feed the voltage to Uno ADC. the use of the resistor is by far the simplest way to do it. but you will have to figure out how precise you need to be.
     
    Nicolas Chalhoub likes this.
  9. Nicolas Chalhoub

    Thread Starter New Member

    Jul 20, 2015
    3
    0
    Oh okay got it.
    Thanks a lot.
     
Loading...