4-20mA sensor explained with a simple Arduino example!

แชร์
ฝัง
  • เผยแพร่เมื่อ 31 ส.ค. 2022
  • How does a 4-20mA sensor work? How to use it with an Arduino? In this video we explain what a 4-20mA sensor does and how to connect it to an Arduino with a simple example.
    Github link: github.com/WerewolfWu/420mAse...
    Have a question / comment / suggestion? Let me know in the comment section, let's talk!

ความคิดเห็น • 74

  • @dimitrimodderman2215
    @dimitrimodderman2215 หลายเดือนก่อน

    Thanks! Thanks to your video i was able to hook up a 16Bar pressure sensor to my arduino. For some reason my pressure was running from 4mA to 12mA full scale. Also first time i measured 2mA with 0 pressure, after having applied pressure 1 time , funny enough it showed 3.95mA when no pressure was applied. So then it was working as expected. But the max stayed 12mA. The same sensor PT506 exists also in a 25Bar version, maybe they mislabeled mine? However after changing the formule it worked like a charm and the Arduino showed what i was reading on the pressure regulator. Thanks your video was awesome and clear and helped me how to connect 2 wire sensors. So i learned something new. Much appreciated!

  • @marcelogouveia9614
    @marcelogouveia9614 8 หลายเดือนก่อน +1

    I built a "very analog" LED bargraph water level indicator. (A vertical pvc pipe set-up with 10 reed switches outside "encapsulated in silicone" inside the 1' pvc pipe a Styrofoam float with a neodymium magnet on top)
    Besides the disadvantages of a myriad of wires (I used cat6 cables) the water would eventually seep through the silicone and cause "erroneous readings"
    This will help me set-up a single wire pair to the sensor, now I will have to figure out what IC to use to feed the LED bargraph.
    Thank you so much! 😊

    • @werewolfwu
      @werewolfwu  7 หลายเดือนก่อน

      Glad you found it useful!

  • @youtuuba
    @youtuuba 10 หลายเดือนก่อน +1

    Werewolf Wu, good job on the explanations.
    I am also pleased that I am not the only one who hates it when manufacturers and individuals fail to follow the rules for upper and lower case letters when showing metric values. I even worked with a company for several years where the engineers knew better, but the company 'hard rule' was that all printing on drawings and stamped onto products MUST be in upper case, so milli always became mega, etc.

    • @werewolfwu
      @werewolfwu  9 หลายเดือนก่อน

      Mega Amps!

  • @silasdenny3267
    @silasdenny3267 ปีที่แล้ว +2

    Thank you for the video, it is very helpful. I am working on connecting the same sensor to an esp32 and this helps me a lot.

    • @werewolfwu
      @werewolfwu  ปีที่แล้ว +1

      Glad you found it useful Silas!

  • @pacochavarria1036
    @pacochavarria1036 ปีที่แล้ว +2

    thanks for making this kind of videos, I am working with pressure sensors from 0 -15 Psi, and they return me from 4 -20 mA. This information will be very helpful to connect it to an Arduino MEGA 2560, Thank you for helping me and I will be following you to see what more content you make. Thank you.

    • @werewolfwu
      @werewolfwu  ปีที่แล้ว +1

      Hello Paco: glad you found it useful!

    • @sagarkuthe8302
      @sagarkuthe8302 4 หลายเดือนก่อน

      Have you took a trail with pressure sensor with ardunio mega. Is it showing correct feedback? Please reply.

  • @AlexTechWiz
    @AlexTechWiz ปีที่แล้ว +1

    Thank you for your well-explained video about a 4-20 mA sensor hooked to an Arduino.

    • @werewolfwu
      @werewolfwu  ปีที่แล้ว

      Glad you found it useful! Hope you are successful with your project! I'm incorporating these sensors into my 12,500 gallon rainwater collection project right now.

    • @AlexTechWiz
      @AlexTechWiz ปีที่แล้ว +1

      @@werewolfwu In my case, I am designing a Personal Weather Station, the anemometer and the vane both are 4-20mA. Your video helped me a lot to understand the hook-up and calculations, etc. In the meantime, I am using a 4-20mA simulator to get the calculations right before hooking the anemometer and vane, for example, the vane at 8mA (25%) should indicate 90°, at 12 mA (50%) 180°, etc. You are right, in my case, a 160Ω is the magic resistor value for a 3.2V ESP32 Controller.
      Here is one problem I solved after I watched your video: I was using two power supplies, one for the ESP32 and one for the 4-20mA simulator, that did not work because the grounds MUST be all connected together. I scaled down the 12V to 5V for the ESP32, same ground all over, bingo! Problem solved.
      Once again, thank you. Happy new year!

    • @werewolfwu
      @werewolfwu  ปีที่แล้ว

      That sounds like a great project! Interfacing with the real world and all! Happy new year to you too!

  • @bounceurabdelaziz4973
    @bounceurabdelaziz4973 ปีที่แล้ว

    Thank you very much, great video, greetings for you from Algeria 🇩🇿

    • @werewolfwu
      @werewolfwu  ปีที่แล้ว

      Thank you! Glad you found it useful!

  • @Steve-xb7dn
    @Steve-xb7dn 2 หลายเดือนก่อน

    This is a great video, thanks

  • @ChristianGrau92
    @ChristianGrau92 ปีที่แล้ว +1

    Thank you so much, i have been looking for this exact info a long time! Finally i maybe can use this to get my remote readings with a 4G simcard board

    • @werewolfwu
      @werewolfwu  ปีที่แล้ว

      Glad you found it to be useful!

    • @ChristianGrau92
      @ChristianGrau92 7 หลายเดือนก่อน +1

      @@werewolfwuCorrect me if i'm wrong but didn't you miss a black cable in your picture of the drawing going from the 24v to sensor?

    • @werewolfwu
      @werewolfwu  7 หลายเดือนก่อน

      @@ChristianGrau92 Hello! Sorry for the late reply. There are only two wires connected to the sensor: red and orange. The best way to internalize the working mode of these sensors is to treat them as "smart" resistors, that adjust itself so that the current flowing through them "happens to" scale perfectly with whatever they are sensing. The common arrangement of "red for power black for ground plus some signals" does not apply to these sensors. Hope this helps!

  • @TheUnofficialMaker
    @TheUnofficialMaker 10 หลายเดือนก่อน +1

    great job, thanks for making the code available. Now, for an IoT example using esp32...

  • @ouat2004
    @ouat2004 ปีที่แล้ว +1

    Thank you for your video. Would you be able to provide the model of LCD display you are using?

    • @werewolfwu
      @werewolfwu  ปีที่แล้ว

      Yes! It's amazing that if you search for LCD screens with i2c for Arduino on the internet, there's pretty much only one kind of model that's available, perhaps with different sizes. And that's what I'm using. I actually don't know what I should call it. I only know that all the sellers sell the same thing and all the libraries that you can find in Arduino are actually just slightly different from each other!

  • @VictorPang-iq4yh
    @VictorPang-iq4yh 6 หลายเดือนก่อน +1

    Hi Werewolf, thank you for sharing such a good content. Btw, do u have the follow up topic on ADC? Thank you!

    • @werewolfwu
      @werewolfwu  6 หลายเดือนก่อน

      Which specific aspect of ADC? Perhaps I can help you out in the comment section first. Let me know what you'd like to know about ADCs. We'll see who answers it better: human or AI.

  • @mirzokhidabdirakhimov8339
    @mirzokhidabdirakhimov8339 ปีที่แล้ว +1

    Thank you so much for your video with a good explanation. I am also working on getting data from the industrial sensor but not getting the same data as the sensor display shows. Could you please help me with it without LCD? Thank you in advance.

  • @petargostovic5295
    @petargostovic5295 9 หลายเดือนก่อน +1

    Hi, thank you for detailed explanation. Do you have idea how can we wire two (or more) sensors like this? How to isolate inputs? Thank you.

    • @werewolfwu
      @werewolfwu  9 หลายเดือนก่อน

      You would need one power supply and 2 return paths to carry two signals.

  • @thembiasande1346
    @thembiasande1346 22 วันที่ผ่านมา

    Hi is there a way that I can change an Rs485 to 4-20ma output

  • @CATiNBRALSTARS
    @CATiNBRALSTARS 2 หลายเดือนก่อน

    Can you make a video connecting Pixsys on a pressure sensor please?

  • @ninepuchar1
    @ninepuchar1 ปีที่แล้ว +1

    May I ask what model of 5V to 24V converter are you using?

    • @werewolfwu
      @werewolfwu  ปีที่แล้ว +1

      It's a generic module that I bought off Jeff Bezos' establishment. Similar things can be found on all sorts of online retailers, simply search for "5V to 24V converter". Required power level is low, a 50mA output capacity (or higher) is enough.

  • @PhG1961
    @PhG1961 ปีที่แล้ว +1

    Waw, cool !

    • @werewolfwu
      @werewolfwu  ปีที่แล้ว

      Glad you found it useful!

  • @iniinfoboss3463
    @iniinfoboss3463 ปีที่แล้ว +2

    is it the same way when using a magnesense pressure sensor?

  • @diegomestrecam7674
    @diegomestrecam7674 ปีที่แล้ว +1

    If my tank level sensor is a resistive sensor (240-30 ohms) its the same as 4-20mA sensor system?

    • @werewolfwu
      @werewolfwu  ปีที่แล้ว

      Hello Diego: if your sensor is a resistive one, it is definitely NOT the same as 4-20mA sensor. You can still use a similar circuit as shown with minimal modification: simply form a resistive divider with your sensor (which is a resistor) and another resistor (say around 100ohms), and sense the divided voltage compared to the reference. This way you get the ratio between the resistors, and hence the resistance value. A little math is needed but not too hard.

  • @reginsamueladelantar7838
    @reginsamueladelantar7838 ปีที่แล้ว

    Hello! I have a Differential Pressure Transducer (Setra M260 Multi-Sense) and I want to read its output value using Arduino. Can you help me with the code if possible? Thanks! I'm looking forward

    • @werewolfwu
      @werewolfwu  ปีที่แล้ว

      Not sure if that's a 4-20mA type sensor, that being said you can probably find what you need on Google. Good luck!

  • @danielfernandes2813
    @danielfernandes2813 11 หลายเดือนก่อน +1

    Jeff's establishment 😂😂

    • @werewolfwu
      @werewolfwu  9 หลายเดือนก่อน

      because it is :-)

  • @darraghross4310
    @darraghross4310 ปีที่แล้ว +2

    Hey can you make a video on how to output 4 to 20ma from an arduino as a source or simulate

    • @werewolfwu
      @werewolfwu  ปีที่แล้ว +1

      Hello Darragh: What you are asking for is essentially the output portion of an actual 4-20mA sensor. There are many ways to create a current source with digital control. e.g. a current DAC or a voltage DAC with a regulating feedback loop etc. If you don't need a lot of resolution, you may want to look at something like Max5550. If you do require a lot of resolution, search for "16 bit current DAC" and there are tons of options out there.

    • @darraghross4310
      @darraghross4310 ปีที่แล้ว +1

      @Werewolf Wu yeah what I am trying see if I can do is use an arduino to drive a 4 to 20 ma positioner.

    • @darraghross4310
      @darraghross4310 ปีที่แล้ว +1

      Thanks and great videos

    • @werewolfwu
      @werewolfwu  ปีที่แล้ว

      My humble suggestion would be to use some kind of USB to I2C/SPI converter to control the current DAC on your dev bench. This makes the development easier. Once you have the control of the DAC verified, you can code that into an Arduino of sorts if your application requires it.

    • @TheUnofficialMaker
      @TheUnofficialMaker 10 หลายเดือนก่อน

      @@darraghross4310 glad it helped!

  • @Steve-xb7dn
    @Steve-xb7dn 2 หลายเดือนก่อน

    Where's a video about calibrating this sensor?

  • @estradacantu
    @estradacantu ปีที่แล้ว +1

    Use 250 ohms and convert to 1-5VDC

    • @werewolfwu
      @werewolfwu  ปีที่แล้ว +1

      I would politely caution against using 250Ohms for 5V operation: the "5V" on Arduino is often QUITE OFF from 5V. E.g. if the "5V" is actually 4.5V, you'll lose quite a bit of measurement range. In my very humble opinion, it is much better to have a little bit more quantization noise than losing a chunk of measurement range.

  • @shuvrasaha297
    @shuvrasaha297 ปีที่แล้ว +1

    Hi can you please share the code?

    • @werewolfwu
      @werewolfwu  ปีที่แล้ว

      I'm working on uploading it! I'll reply back here once I have it uploaded together with the next video.

    • @werewolfwu
      @werewolfwu  ปีที่แล้ว +2

      github.com/WerewolfWu/420mAsensor

  • @destinationunknown675
    @destinationunknown675 4 หลายเดือนก่อน +1

    I got it from Jeff Bezos establishment was actually funny. (Amazon) 😂😂😂

    • @werewolfwu
      @werewolfwu  4 หลายเดือนก่อน

      😂😂😂 Didn't want to directly name the establishment

  • @mateomenvielle6858
    @mateomenvielle6858 ปีที่แล้ว

    hello can you share your arduino code ? please

    • @werewolfwu
      @werewolfwu  ปีที่แล้ว

      Of course! I'll reply back once I put it into the cloud.

    • @werewolfwu
      @werewolfwu  ปีที่แล้ว

      github.com/WerewolfWu/420mAsensor

  • @n-p2048
    @n-p2048 11 หลายเดือนก่อน +1

    1:20 MA 😂

    • @werewolfwu
      @werewolfwu  10 หลายเดือนก่อน

      I know right?

  • @Livenewme
    @Livenewme 11 หลายเดือนก่อน +1

    Much cheaper replacement for scata and smart boxes

    • @werewolfwu
      @werewolfwu  9 หลายเดือนก่อน

      indeed!

  • @frenchcreekvalley
    @frenchcreekvalley ปีที่แล้ว +1

    Oh. It's just a pressure sensor, I guess.

  • @mfx1
    @mfx1 ปีที่แล้ว

    You keep blaming the "$40 sensor" when it's more likely your measurement accuracy that's at fault the Arduino ADC isn't particularly accurate/linear and has pretty poor resolution you'd usually use a proper 4-20mA interface IC but even then you still need a decent ADC. Another useful feature of 4-20mA loops is fault detection, you can tell if the wiring is short/open circuit or if a service tech didn't plug it back in properly.

    • @werewolfwu
      @werewolfwu  ปีที่แล้ว +2

      It's just a joke man... besides It's trivial to calibrate the zero level and gain etc...

  • @grmcentralkenyatv3409
    @grmcentralkenyatv3409 ปีที่แล้ว +1

    Assuming you put the sensor in a tank and the height keeps changing when there is no water change (water addition or substraction). What could be problem if you are using a 24v battery

    • @werewolfwu
      @werewolfwu  ปีที่แล้ว

      Hello GRM Central Kenya TV: If your reading keeps changing while the water level is not changing, then I would start by swapping out the sensor... :-) These sensors are enclosed micro computer systems, it's quite possible to be broken...

  • @medelghaba4551
    @medelghaba4551 11 หลายเดือนก่อน +1

    Thanks for the video,I have built the same circuit with a water flow sensor, but the output signal has a fluctuation.how can i fix this problème i used ESP32

    • @werewolfwu
      @werewolfwu  10 หลายเดือนก่อน

      Start with power supply, follow the signal flow, check power supply and signal flow chains at every point.