# Read a 0-4mA sensor with a Shelly

**URL:** <https://discourse.nodered.org/t/read-a-0-4ma-sensor-with-a-shelly/96183>\
**Category:** Hardware\
**Created:** [23 March 2025 07:15 UTC](https://discourse.nodered.org/t/read-a-0-4ma-sensor-with-a-shelly/96183 "2025-03-23T07:15:38Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [23 March 2025 07:15 UTC](https://discourse.nodered.org/t/read-a-0-4ma-sensor-with-a-shelly/96183/1 "2025-03-23T07:15:38Z")

</div>

Hi folks,

I need help again from my electronics friends over here...

In a desperate attempt to simplify my home automation setup, I have replaced all my electronics in the last 2 years by Shelly devices. I only need to replace the liquid (i.e. oil, water, ...) level measurements in my tanks my Shellies.

Did test some sensors in the past, and at the end I had decided to go for _ **pressure measurement** _. Had some good accuracy with ultrasonic sensors, but they appeared to be useless in some of my use cases due to reflections of the signal (since these sensor have a wide angle). Anyway don't want to discuss all the sensor types, because I bought mine already....

The tanks are underground in the garden and out of reach for my WIFI network. So I decided to put these Shellies indoor inside my big IOT closet, where lots of other Shellies are installed. Which means the sensor needs to be connected to the Shelly, via a long cable:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/7/770ae8eec06496937c1a620db4b5f33e01569658.png)

The cable is quite long, and runs through a series of cable ducts together with other cables (running all kind of signals). To avoid distortions on my signal, I decided not to go for an output of 0-10V but instead _ **4-20mA** _. So the output current of the sensor changes (instead of the output voltage), which should be less influenced by distortions. It is an industry standard, so I assume it is also good enough for my purpose. It is not a 0-20mA sensor, because the first 4mA are used to power the sensor.

So I bought [this](https://nl.aliexpress.com/item/4000415423859.html?aff_fcid=d677a48ffc014aa4a00507222b99d638-1723458344343-02344-_AEhYgk&tt=CPS_NORMAL&aff_fsk=_AEhYgk&aff_platform=shareComponent-detail&sk=_AEhYgk&aff_trace_key=d677a48ffc014aa4a00507222b99d638-1723458344343-02344-_AEhYgk&terminal_id=d0e990ba91be4aaf839ed2a0e973cbfc&afSmartRedirect=y) sensor last year from Aliexpress:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/2/b254e997797e0e916e69785bdff2eed767b07516.png)

Then I needed to be able to convert the output current to an output voltage (to be able to read it with an ADC), for which I bought [this](https://nl.aliexpress.com/item/4000186000007.html?spm=a2g0o.productlist.main.1.1b6d14a0eZp1c6&algo_pvid=60d8a592-68e8-4add-a90e-c77f926ccc84&algo_exp_id=60d8a592-68e8-4add-a90e-c77f926ccc84-0&pdp_npi=4%40dis%21EUR%211.91%211.91%21%21%212.04%212.04%21%40210385db17234589344995351ed1fe%2112000037070440790%21sea%21BE%21186458938%21X&curPageLogUid=K22UQmSm0f0h&utparam-url=scene%3Asearch%7Cquery_from%3A) device (model HW-685):

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/e/fed406d36eaf16dc220c97dfb1631bbc6ae95e8d.jpeg)

This converter eliminates the 0-4mA part, because otherwise the lower part of my output voltage would be not relevant. Which would decrease the accuracy of my measurement (see further).

Then I had to select a Shelly, that has an embedded ADC converter to read the analog output voltage. There are 3 different Shelly devices available:

1. _ **Shelly addon** _ ([datasheet](https://kb.shelly.cloud/knowledge-base/shelly-plus-add-on)):  
_Voltmeter range: 0 to 10 V  
Voltmeter report threshold: 0.1 V_

2. _ **Shelly Uni** _ ([datasheet](https://kb.shelly.cloud/knowledge-base/shelly-uni)): found on a forum discussion this info  
_“The Shelly UNI has no special ADC chip but uses the two ADC incorporated in the ESP32 processor. These ADC have a resolution of 12bit (4.096 steps) each”_

3. _ **Shelly Uni Plus** _ ([datasheet](https://kb.shelly.cloud/knowledge-base/shelly-plus-uni)):

I had build last autumn the Shelly addon with a _ **test setup** _ where I had a vertical pipe of 4 meters long filled with water. The results for that pressure sensors are very good:

- The _accuracy_ of the sensor is very good (i.e. more than good enough for my use case).
- The output is linear (i.e. output current vs liquid height), which will simplify my calculations inside Node-RED.

However the Shelly addon only provided me a lousy accuracy of steps of 4 cm. Which afterwards seemed logical because I had set the output of my current to voltage converter board to 0-10V (other options are 0-3.3V or 0-5V), to match the analog input voltage range of the Shelly addon. As a result, the accuracy is 0,1V, which is 4 cm (while I had hoped to get an accuracy of 1 cm). Since this is useless for my purpose, I had to abort my test at the end ☹

I would really like to get this up and running soon, but I have no idea how to continue with this. From the Shelly forums it looks to me that the Shelly Uni and Shelly Uni Plus devices have a much better ADC accuracy. And I want to keep the wiring as simple as possible:

- I don't know if I need that converter board. Because it needs some calibration from time to time if I understand it correctly. Don't see my wife and kids do that if I would not be around here anymore... Perhaps I can replace the board by some simple resistors or something else?

- There is also the powering. The pressure sensor needs 24VDC, while the converter board needs between 5 and 12 V (in contradiction to the voltage range mentioned in the chinese docs: otherwise it will burn...). And the Shelly Uni or Uni Plus also have other power ranges (which are not clear to me from their docs). Bit too much of different voltage ranges for me to see the entire picture 🤯 Would be nice to keep the number of power sources low, to keep the wiring as simple as possible...

Long story, lots of details. Thanks for reading, and for any help!!

Bart

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [23 March 2025 14:50 UTC](https://discourse.nodered.org/t/read-a-0-4ma-sensor-with-a-shelly/96183/2 "2025-03-23T14:50:38Z")

</div>

**|Voltmeter report threshold:|0.1 V** |\*\*

\*\* Can be configured in the analog input / voltmeter settings

Does this have an option to increase the resolution ?

EDIT: Never mind I found the answer 😉

- Delta Threshold - The voltage change with more than a specified value, which triggers a data report. The minimum is 0.1 and the maximum is 5.

I couldn't find specifics for the data output of the other 2 shellys.

I know you are trying to standardise on shelly, but personally I would use a basic esp32, they have multiple ADC inputs so you could measure multiple things with one device.

**Supply voltage:** you can use 24v for the sensor, and a buck converter to drop to 5volts for the ESP & converter board. Set the output of the converter to 3.3v

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [23 March 2025 20:05 UTC](https://discourse.nodered.org/t/read-a-0-4ma-sensor-with-a-shelly/96183/3 "2025-03-23T20:05:35Z")

</div>

@Sean-McG  
Thanks for joining!

> [@Sean-McG](#):
>
> but personally I would use a basic esp32

Yes I know what you mean. I currently have ESP32's running for this already. Cannot say anything negative about them. Only that I never see my wifi or kids maintain all these different devices and firmwares. . Beside that, the ESP32's work great...

> [@Sean-McG](#):
>
> I couldn't find specifics for the data output of the other 2 shellys.

Yes I find it quite hard to find decent documentation about the ADC's in the Shelly devices.  
I found the following info (in various websites), but unfortunately it doesn't ring a bell to me.

- The Shelly _ **Uni** _ has 1 ADC with dual ranges from 0-12V and 0-30V  

- The Shelly _ **Uni Plus** _ has a bit of other wiring:  

Here are similar questions like mine:

> **[Level Tank sensor with shelly Uni](https://community.home-assistant.io/t/level-tank-sensor-with-shelly-uni/446966)**
>
> Hello, I built a level sensor for my cistern with the Shelly uni. How can I integrate the Homeassistant in such a way that I get a percentage display of the maximum? I have attached a drawing for the construction of the Shelly. The values ​​are...

> **[Submersible pressure sensor: wiring question](https://community.home-assistant.io/t/submersible-pressure-sensor-wiring-question/644696/6)**
>
> This is the wiring diagram we came up with. This is ok i think? I don’t have the resistor yet so i can’t test it. The original cable has actually 5-wires: red, black, white, green and blue.

[https://community.shelly.cloud/topic/8577-connecting-shelly-uni-to-a-sensor-water-level/](https://community.shelly.cloud/topic/8577-connecting-shelly-uni-to-a-sensor-water-level/)

Hopefully this might trigger some of the electronic brains in this community, but it won't be my brain...

---

<div class="post-metadata">

**Author:** ![gerry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gerry/32/21604_2.png) [@gerry](https://discourse.nodered.org/u/gerry)\
**Post date:** [23 March 2025 22:08 UTC](https://discourse.nodered.org/t/read-a-0-4ma-sensor-with-a-shelly/96183/4 "2025-03-23T22:08:01Z")

</div>

Maintainability is something I have considered a lot over the past couple of months and while i think I have explained everything, documented everything I have come to the conclusion if I go things will just quit. My better half has no technical training nor does she have any interest. And while my system seems very stable there will be failures. So I'm not sure how much weight you should put on having your other half or others maintain what you have. Maybe go with what's easy and make sure your other half goes first. 🙂

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [23 March 2025 23:56 UTC](https://discourse.nodered.org/t/read-a-0-4ma-sensor-with-a-shelly/96183/5 "2025-03-23T23:56:47Z")

</div>

> [@gerry](#):
>
> My better half has no technical training nor does she have any interest

@gerry I also came to much the same conclusion.  
Also hopefully long into the future, it's more likely that some generic ESP descendant will still exist, than a backward compatible Shelly unit.

> [@BartButenaers](#):
>
> The _Shelly UNI_ has no special _ADC_ chip but uses the two _ADC_ incorporated in the ESP32 processor. These _ADC_ have a resolution of 12bit (4.096 steps) each.

This true of most ADC, the issue is the resolution that is actually reported, e.g. the Shelly addon only reporting 0.1 V steps. You really need to find out what the alternative shellys will give you.

---

<div class="post-metadata">

**Author:** ![gerry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gerry/32/21604_2.png) [@gerry](https://discourse.nodered.org/u/gerry)\
**Post date:** [24 March 2025 00:26 UTC](https://discourse.nodered.org/t/read-a-0-4ma-sensor-with-a-shelly/96183/6 "2025-03-24T00:26:06Z")

</div>

Just to ask i presume you have no hope of extending wifi? Or maybe run an ethernet line with poe?

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [24 March 2025 07:14 UTC](https://discourse.nodered.org/t/read-a-0-4ma-sensor-with-a-shelly/96183/7 "2025-03-24T07:14:30Z")

</div>

> [@gerry](#):
>
> My better half has no technical training nor does she have any interest.

Same story here... But then at least I can leave this planet with the feeling that I at least tried to simplify stuff 😋

> [@gerry](#):
>
> Or maybe run an ethernet line with poe?

I have already an ethernet line installed last year to all my tanks. Currently I use a poe powered wt32-eth01 inside the tank. But now I wanted to connect that 4-20mA sensor to that ethernet line and a Shelly Uni or Uni plus inside the house at the other end of that line.

---

<div class="post-metadata">

**Author:** ![gerry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gerry/32/21604_2.png) [@gerry](https://discourse.nodered.org/u/gerry)\
**Post date:** [24 March 2025 07:54 UTC](https://discourse.nodered.org/t/read-a-0-4ma-sensor-with-a-shelly/96183/8 "2025-03-24T07:54:05Z")

</div>

Not a shelley user but it looks like the uni has a analog input, can't you use that to measure a voltage drop across a resistor from your current loop?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [23 May 2025 07:54 UTC](https://discourse.nodered.org/t/read-a-0-4ma-sensor-with-a-shelly/96183/9 "2025-05-23T07:54:11Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
