Activity Forums Questions & Troubleshooting 24V 4-20mA industrial temp sensor, how to connect/read?

  • 24V 4-20mA industrial temp sensor, how to connect/read?

  • Grimmie

    March 26, 2021 at 11:59 pm

    Hi all,

    Let me introduce myself, my name is Wouter. I work for a company Sensor Partners in the Netherlands. Through the use of Controllino we are trying to industrialize the use of Arduino paired with our industrial sensors.
    In my spare time I get to play around with Arduino/Controllino to test some of our sensors and combine them with self made sketches.

    Since a lot of our sensors (the analog ones) work with a 4-20mA signal I’m trying to get the Controllino to read this signal, I’m having a hard time getting it to work though.

    I am using a Calex PyroMini OEM sensor, with a 2-wire 4-20mA current loop.
    The one I have here is a -20 – 100°C version.

    I have the Controllino and the sensor connected to the same TDK-Lambda DRL60-24-1 24Vdc power supply.

    From what I gather from the Controllino manual when connected to a 24V supply the analog input measures between 0-26,4V.
    <font face=”inherit”>Am I correct to assume that this means the 0 – 1023 values are scaled over this range?</font>
    <font face=”inherit”>And that therefor I would make the best use of this range if I convert the 4-20mA to as large as possible voltage range within 0-26,4V?</font>

    <font face=”inherit”>Following Ohms law I figured using a 1kOhm resistor would scale my 4-20mA to 4-20V (1-on-1 conversion).</font>

    <font face=”inherit”>So I set out to work. I made the following connection:</font>
    <font face=”inherit”>Sensor + goes directly to V+ (24V)</font>
    <font face=”inherit”>Sensor – goes to V- through a 1kOhm resistor and also goes to A0 directly</font>
    <font face=”inherit”>Sensor shield is grounded to the dinrail</font>
    <font face=”inherit”>Controllino GND is connected to V-</font>
    <font face=”inherit”>Controllino 24V is connected to V+ (24V) </font>

    <font face=”inherit”>The above is what I gathered from Googling and other topics in this forum.</font>

    <font face=”inherit”>Now the problem I face is that the measurement results through an analogRead of the sensorValue are very close to each other and do not run through the entire 0-1023 range as I expected. </font>

    <font face=”inherit”>I tested room temperature (my desk), body temperature (my hand) and a fresh hot cup of tea. The values I get (I do not remember them exactly) are somewhere between 50 and 75.</font>
    <font face=”inherit”>By my calculations I expected the following:</font>
    <font face=”inherit”>-20°C = 4V = 155</font>
    <font face=”inherit”>0°C = 6,66V = 258</font>
    <font face=”inherit”>20°C = 9,33V = 361</font>
    <font face=”inherit”>80°C = 17.33V = 672</font>
    <font face=”inherit”>100°C = 20V = 775</font>

    <font face=”inherit”>So for my desk I expected 361 or something in that </font>neighborhood<font face=”inherit”>, and for the hot cup of tea I expected something between 672 and 775.
    What am I doing wrong?

    • This discussion was modified 3 years, 2 months ago by  Grimmie.
  • Grimmie

    March 27, 2021 at 12:06 am

    Apologies, not sure where these “font” HTML codes came from, I didn’t put them there…

  • Grimmie

    March 27, 2021 at 12:12 am

    To be complete, this is the code I use:



    Reads an analog input on pin 0, converts it to voltage, and prints the result to the Serial Monitor.

    Graphical representation is available using Serial Plotter (Tools > Serial Plotter menu).

    Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.

    This example code is in the public domain.


    // the setup routine runs once when you press reset:

    void setup() {

    // initialize serial communication at 9600 bits per second:



    // the loop routine runs over and over again forever:

    void loop() {

    // read the input on analog pin 0:

    int sensorValue = analogRead(A0);

    // print out the value you read:



    • Azkom

      April 4, 2023 at 7:47 am

      Do you have an OpenPLC example for the same test environment?

  • Grimmie

    March 30, 2021 at 9:30 pm

    Was hoping for at least some replies…

    • This reply was modified 3 years, 1 month ago by  Grimmie.
    • Friedl

      April 1, 2021 at 10:28 pm

      Did you take into account (see datasheet of sensor):

      Minimum Sensor Voltage
      8 V DC (all other models)

      Therefore you’d be better off if you’d be using a MAXI Automation (0-10V input) and a 500 Ohm resistor.

      • This reply was modified 3 years, 1 month ago by  Friedl. Reason: typo fixed
      • Grimmie

        April 2, 2021 at 8:52 pm

        Hi Friedl,

        Thank you for your reply.

        I must admit that I did see minimum supply voltage @8v for the sensor. I ignored that for convenience sake. Because the readings did change with the temperature I asumed the sensor still worked, furthermore @100C the voltage would have been well over 8v, but the reading did not change significantly.

        That being said, you might be right this is an issue. I do however not see how using the Maxi Automation in 0-10v with 500ohm resistor would help my situation, am I missing something?

        The more I think about it I start to see this sensor simply isn’t suited for 4-20mA to 0-10v conversion. Because of it’s two wire construction, the power supply and signal share the same wires.

        Perhaps I should try again with a 3 wire sensor, where power and signal are separated.

        • Friedl

          April 4, 2021 at 4:00 pm

          You need to give the sensor “space to breath” (=enough voltage left), otherwise it just won’t work.

          If you take this setup (from the product page):
          and add the 500 Ohm resistor across the +/- of the instrument shown in the picture, which would then be your Controllino, we can conclude:

          1. 0,020 A * 500 Ohm = 10V
          2. 0,004 A * 500 Ohm = 2V
          3. 24V – 10V = 14V > 8V ! (24V power supply assumed)

          And BTW (see datasheet):

          Max. Loop Impedance
          900 Ω (4-20 mA output)

          Put aside your Controllino, only leave the resistor, take a digital multimeter and verify your setup first. When you know what voltages are to be measured, verifying what you measure with the ADC is much easier.

          • This reply was modified 3 years, 1 month ago by  Friedl. Reason: Stray DIV tags from the editor again. (PLEASE FIX THIS)
          • Friedl

            April 4, 2021 at 4:08 pm

            When you successfully verified the sensors output voltage, you can even
            replace the sensor and the resistor with a lab power supply. This makes verifying your code much easier.

            • Grimmie

              April 5, 2021 at 8:29 am

              Thanks for the tips, I will certainly give it a go!

Viewing 1 - 4 of 4 replies

Log in to reply.

Original Post
0 of 0 posts June 2018