Тёмный

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

Werewolf Wu
Подписаться 586
Просмотров 36 тыс.
50% 1

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!

Опубликовано:

 

31 авг 2022

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 77   
@silasdenny3267
@silasdenny3267 Год назад
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 Год назад
Glad you found it useful Silas!
@youtuuba
@youtuuba Год назад
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 11 месяцев назад
Mega Amps!
@marcelogouveia9614
@marcelogouveia9614 10 месяцев назад
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 9 месяцев назад
Glad you found it useful!
@pacochavarria1036
@pacochavarria1036 Год назад
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 Год назад
Hello Paco: glad you found it useful!
@sagarkuthe8302
@sagarkuthe8302 6 месяцев назад
Have you took a trail with pressure sensor with ardunio mega. Is it showing correct feedback? Please reply.
@bounceurabdelaziz4973
@bounceurabdelaziz4973 Год назад
Thank you very much, great video, greetings for you from Algeria 🇩🇿
@werewolfwu
@werewolfwu Год назад
Thank you! Glad you found it useful!
@AlexTechWiz
@AlexTechWiz Год назад
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 Год назад
@@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!
@dimitrimodderman2215
@dimitrimodderman2215 3 месяца назад
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!
@werewolfwu
@werewolfwu 7 дней назад
Glad you found it useful!
@ChristianGrau92
@ChristianGrau92 Год назад
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 9 месяцев назад
@@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 9 месяцев назад
@@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!
@Steve-xb7dn
@Steve-xb7dn 4 месяца назад
This is a great video, thanks
@werewolfwu
@werewolfwu 7 дней назад
Glad you found it useful!
@TheUnofficialMaker
@TheUnofficialMaker Год назад
great job, thanks for making the code available. Now, for an IoT example using esp32...
@werewolfwu
@werewolfwu 11 месяцев назад
:-)
@PhG1961
@PhG1961 Год назад
Waw, cool !
@werewolfwu
@werewolfwu Год назад
Glad you found it useful!
@VictorPang-iq4yh
@VictorPang-iq4yh 8 месяцев назад
Hi Werewolf, thank you for sharing such a good content. Btw, do u have the follow up topic on ADC? Thank you!
@werewolfwu
@werewolfwu 8 месяцев назад
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.
@caffeinatedinsanity2324
@caffeinatedinsanity2324 Месяц назад
4-20mA is also nice for fault detection
@werewolfwu
@werewolfwu 7 дней назад
Indeed!
@CATiNBRALSTARS
@CATiNBRALSTARS 4 месяца назад
Can you make a video connecting Pixsys on a pressure sensor please?
@ouat2004
@ouat2004 Год назад
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!
@danielfernandes2813
@danielfernandes2813 Год назад
Jeff's establishment 😂😂
@werewolfwu
@werewolfwu 11 месяцев назад
because it is :-)
@petargostovic5295
@petargostovic5295 11 месяцев назад
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 11 месяцев назад
You would need one power supply and 2 return paths to carry two signals.
@mirzokhidabdirakhimov8339
@mirzokhidabdirakhimov8339 Год назад
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.
@werewolfwu
@werewolfwu Год назад
Glad it helped!
@diegomestrecam7674
@diegomestrecam7674 Год назад
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.
@iniinfoboss3463
@iniinfoboss3463 Год назад
is it the same way when using a magnesense pressure sensor?
@werewolfwu
@werewolfwu Год назад
should be!
@Steve-xb7dn
@Steve-xb7dn 4 месяца назад
Where's a video about calibrating this sensor?
@ninepuchar1
@ninepuchar1 Год назад
May I ask what model of 5V to 24V converter are you using?
@werewolfwu
@werewolfwu Год назад
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.
@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!
@destinationunknown675
@destinationunknown675 6 месяцев назад
I got it from Jeff Bezos establishment was actually funny. (Amazon) 😂😂😂
@werewolfwu
@werewolfwu 6 месяцев назад
😂😂😂 Didn't want to directly name the establishment
@darraghross4310
@darraghross4310 Год назад
Hey can you make a video on how to output 4 to 20ma from an arduino as a source or simulate
@werewolfwu
@werewolfwu Год назад
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 Год назад
@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 Год назад
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 Год назад
@@darraghross4310 glad it helped!
@estradacantu
@estradacantu Год назад
Use 250 ohms and convert to 1-5VDC
@werewolfwu
@werewolfwu Год назад
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 Год назад
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 Год назад
github.com/WerewolfWu/420mAsensor
@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 Год назад
1:20 MA 😂
@werewolfwu
@werewolfwu Год назад
I know right?
@Livenewme
@Livenewme Год назад
Much cheaper replacement for scata and smart boxes
@werewolfwu
@werewolfwu 11 месяцев назад
indeed!
@frenchcreekvalley
@frenchcreekvalley Год назад
Oh. It's just a pressure sensor, I guess.
@werewolfwu
@werewolfwu Год назад
Yes it is!
@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 Год назад
It's just a joke man... besides It's trivial to calibrate the zero level and gain etc...
@grmcentralkenyatv3409
@grmcentralkenyatv3409 Год назад
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 Год назад
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 Год назад
Start with power supply, follow the signal flow, check power supply and signal flow chains at every point.
Далее
Штаны легионера
00:44
Просмотров 228 тыс.
Industrial Pressure Sensor - Arduino
26:35
Просмотров 64 тыс.
The Fundamentals of 4-20 mA Current Loops
57:12
Просмотров 221 тыс.
Introduction to 4-20-mA current loop transmitters
15:57
Measure DC Voltage and Current with Arduino
37:29
Просмотров 197 тыс.