# \[ANNOUNCE\] node-red-contrib-tank-volume: beta

**URL:** <https://discourse.nodered.org/t/announce-node-red-contrib-tank-volume-beta/47101>\
**Category:** Share Your Nodes\
**Created:** [13 June 2021 12:58 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-tank-volume-beta/47101 "2021-06-13T12:58:38Z")\
**Posts on this page:** 20\
**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:** [13 June 2021 12:58 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-tank-volume-beta/47101/1 "2021-06-13T12:58:38Z")

</div>

Hi folks,

The lady of the house asked me to _ **measure the fluid level** _ in some tanks at home: fuel oil, rain water, ... And she wants to know the _ **partial filled volume** _ of those tanks. Must admit that I already kept here waiting for quite some time, but it became a bit clear now that waiting time was over 🥶

As always, I use such an opportunity to add some more features to it and build a custom node. Fortunately I have a pile of unfinished nodes at home, and this was one of those. So after a a bit of refurbishing, now finally the [node-red-contrib-tank-volume](https://github.com/bartbutenaers/node-red-contrib-tank-volume) has seen the daylight 🍾 🥳 🥂

Summarized it can calculate the volume, partial filled volume, filled percentage, ...  
And this for _ **13 different tank types** _: Cone bottom, Cone top, Frustrum (truncated cone), Horizontal capsule, Horizontal cylinder, Horizontal elliptical, Horizontal oval, Inverse piramid, Rectangular prism (rectangular), Sphere, Vertical capsule, Vertical cylinder, Vertical oval

![overview](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/5/b54580ad5bdbb566689198bff6d7e997c37faddd.png)

I have tried to make it user friendly by visualizing the selected tank type:

![tank_volume_demo](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/7/e724ed603e846724635c2f611fb36dbfe916343f.gif)

P.S. This beta version has not been published on NPM yet, so if you want to test it: use the installation command on my readme page on Github.

As usual, all _ **constructive** _ feedback is very welcome!

Have fun with it!  
Bart

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [13 June 2021 13:29 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-tank-volume-beta/47101/2 "2021-06-13T13:29:29Z")

</div>

As usual... pure creativity from you Bart.

One small observation is... I think "piramid" should be spelt as... "pyramid"

---

<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:** [13 June 2021 13:47 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-tank-volume-beta/47101/3 "2021-06-13T13:47:30Z")

</div>

> [@dynamicdave](#):
>
> "piramid" should be spelt as... "pyramid"

Hi David,  
Thanks for the feedback!  
In dutch it is _"Piramide"_ which somewhere in between... It is fixed now.

---

<div class="post-metadata">

**Author:** ![molesworth](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/molesworth/32/11748_2.png) [@molesworth](https://discourse.nodered.org/u/molesworth)\
**Post date:** [13 June 2021 15:47 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-tank-volume-beta/47101/4 "2021-06-13T15:47:54Z")

</div>

Thanks Bart - what an excellent idea! Slightly off-topic question, but do you have sensors on your tanks to measure the fluid height? I currently check my heating oil once a week by using a dipstick, but an automated way to do it at regular intervals would be much more convenient. Finding a sensor which will work in that environment might not be so easy though.

Unfortunately my tank doesn't match any of the geometric shapes you have calculated volumes for :

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/4/d4eb7f240cff7d941539d3b8b33267b438d0ba01.jpeg)

The holes in the middle mean the volume per level can't easily be calculated, and I use a simple Excel spreadsheet based on a table the tank manufacturer supplied. However, inspired by your idea I can probably put together a flow to do the table interpolation, log usage over time and warn me when it gets a bit low.

---

<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:** [13 June 2021 16:12 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-tank-volume-beta/47101/5 "2021-06-13T16:12:26Z")

</div>

> [@molesworth](#):
>
> do you have sensors on your tanks to measure the fluid height?

Hi @molesworth,  
I bought a couple of some time ago:

€ 1,92 3%OFF | Waterdichte Ultrasone Module JSN-SR04T / AJ-SR04M Water Proof Geïntegreerde Afstand Meet Transducers Sensor Voor Arduino  
[https://a.aliexpress.com/\_vTsELp](https://a.aliexpress.com/_vTsELp)

I did not have time yet to install them, but I have been testing them and they were about 1cm accurate. But it was from another Ali dealer, so perhaps not exactly the same...

You can easily read the values via the pisrf node.

> [@molesworth](#):
>
> Unfortunately my tank doesn't match any of the geometric shapes you have calculated volumes for

With pain in my heart, I have to tell you that chances are very low that I will ever be able to calculate that shape 🤣  
If you can fill your tank manually with buckets of water (from which you know the volume), and read the height every time. Then you can create a table of heights with the corresponding volumes. Or if you know the number of seconds it takes to fill a bucket, you can start counting while you fill that tank. It is only an approximation of course...  
And indeed of you have a table from your manufacturer, that is even more easy..

---

<div class="post-metadata">

**Author:** ![molesworth](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/molesworth/32/11748_2.png) [@molesworth](https://discourse.nodered.org/u/molesworth)\
**Post date:** [13 June 2021 16:29 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-tank-volume-beta/47101/6 "2021-06-13T16:29:48Z")

</div>

Thanks again Bart. That sensor looks like it would do the job, and hopefully the waterproofing will protect it from the oil fumes. I'll order one and see if I can hook it up to an ESP8266 or similar. 👍

---

<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:** [13 June 2021 16:52 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-tank-volume-beta/47101/7 "2021-06-13T16:52:14Z")

</div>

Please keep us updated afterwards!

---

<div class="post-metadata">

**Author:** ![molesworth](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/molesworth/32/11748_2.png) [@molesworth](https://discourse.nodered.org/u/molesworth)\
**Post date:** [13 June 2021 18:18 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-tank-volume-beta/47101/8 "2021-06-13T18:18:40Z")

</div>

It probably won't be as exciting or complex as things other people post, but I'll do a wee write up once it's running 🙂

---

<div class="post-metadata">

**Author:** ![hominidae](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hominidae/32/4174_2.png) [@hominidae](https://discourse.nodered.org/u/hominidae)\
**Post date:** [13 June 2021 18:34 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-tank-volume-beta/47101/9 "2021-06-13T18:34:32Z")

</div>

...these sensors work OOTB with tasmota.firmware: [HC-SR04 ultrasonic ranging sensor - Tasmota](https://tasmota.github.io/docs/HC-SR04/)

---

<div class="post-metadata">

**Author:** ![hominidae](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hominidae/32/4174_2.png) [@hominidae](https://discourse.nodered.org/u/hominidae)\
**Post date:** [13 June 2021 18:49 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-tank-volume-beta/47101/10 "2021-06-13T18:49:22Z")

</div>

Hmmm...so the lady of the house wants to know the "partial filled volume", which is an interesting use case...as is is different from the "volume left inside"...especially when there needs to be some "swamp/bilge level" to be reserved as leftover at the bottom at the tank, usually.  
I mean, normally a submerged pump will only have access to the volume above swamp/bilge level, I believe.  
Can the output be corrected, to take the non-accessible volume at swamp/bilge level into account or defining it at when the tank model gets selected/defined, too?

---

<div class="post-metadata">

**Author:** ![Jean-Luc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jean-luc/32/89996_2.png) [@Jean-Luc](https://discourse.nodered.org/u/Jean-Luc)\
**Post date:** [13 June 2021 19:03 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-tank-volume-beta/47101/11 "2021-06-13T19:03:50Z")

</div>

Hello Bart,  
I hope you have more success than I did.  
I built a first JSN-SR04T [sonar](https://fr.aliexpress.com/item/4001116763054.html?spm=a2g0s.9042311.0.0.27426c37Ji6K6h) probe for a well with a pump where clear water arrives, this one also has 2 crossed support bars for solidification.  
The probe worked perfectly out of the well, but as soon as I put it in, the numbers were off.  
Then, I tried the experiment with a [VL53L0X](https://fr.aliexpress.com/item/4000501203735.html?spm=a2g0s.9042311.0.0.a47c6c37JiPyxM) laser probe, same punishment, it worked perfectly outside the well and inside I obtained aberrant values. Is it due to the clear water, the reflections ? I don't know.  
Finally I built a mechanical tool that works. It's less sexy, but it works finally.  
Tasmota manages switches.

In any case, congratulations for your work and your sharing. 👏

the probe that works:

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

---

<div class="post-metadata">

**Author:** ![hominidae](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hominidae/32/4174_2.png) [@hominidae](https://discourse.nodered.org/u/hominidae)\
**Post date:** [13 June 2021 19:31 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-tank-volume-beta/47101/12 "2021-06-13T19:31:40Z")

</div>

nice...what underwater switches did you use then?

---

<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:** [13 June 2021 19:38 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-tank-volume-beta/47101/13 "2021-06-13T19:38:15Z")

</div>

> [@hominidae](#):
>
> Can the output be corrected, to take the non-accessible volume at swamp/bilge level into account or defining it at when the tank model gets selected/defined, too?

@hominidae,  
Interesting thoughts. Thanks for thinking out loud!

So you mean something like this:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/4/44a9450514fa7ed114a67aed982e636b461e0440.png)

Does it makes sense to implement it like this:

1. In the config screen you can set the _ **swamp height** _, which is default 0.
2. In the output message I send extra those fields:
  - The swamp height
  - The swamp volume
  - The corrected filled volume (= real filled volume - swamp volume)

> [@Jean-Luc](#):
>
> The probe worked perfectly out of the well, but as soon as I put it in, the numbers were off.

Damn, that is bad news ...  
Hmm, could the reflections could cause this?  
But thanks for sharing your experience!!

> [@Jean-Luc](#):
>
> Finally I built a mechanical tool that works. It's less sexy, but it works finally.

In the past I have also been thinking about something like that. But would like to have a bit of good resolution on my measurements, and then I need to much of those mechanical switches.  
I have also seen something mechanical, with a rope that was spinning around a wheel. A floating weight lets the wheel spin and you can measure the rotations to calculate the fluid level.  
I can't find the link anymore, but it was something like this to explain it:

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

---

<div class="post-metadata">

**Author:** ![Jean-Luc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jean-luc/32/89996_2.png) [@Jean-Luc](https://discourse.nodered.org/u/Jean-Luc)\
**Post date:** [13 June 2021 19:46 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-tank-volume-beta/47101/14 "2021-06-13T19:46:34Z")

</div>

> [@hominidae](#):
>
> nice...what underwater switches did you use then?

These:  
[https://www.amazon.fr/UEETEK-ZP4510-P-Interrupteurs-flotteur-verticaux/dp/B076F3938J/ref=pd\_rhf\_ee\_s\_rp\_c\_3\_8/258-0917759-0443424?pd\_rd\_w=zOQpQ&pf\_rd\_p=ca1687c8-5dce-439c-8b8e-69bb86d82799&pf\_rd\_r=P7PVTN2NQ1KJVKFPGXKC&pd\_rd\_r=574d2cdb-b124-45e2-a34b-3d49afbc782e&pd\_rd\_wg=EjRF9&pd\_rd\_i=B076F3938J&psc=1](https://www.amazon.fr/UEETEK-ZP4510-P-Interrupteurs-flotteur-verticaux/dp/B076F3938J/ref=pd_rhf_ee_s_rp_c_3_8/258-0917759-0443424?pd_rd_w=zOQpQ&pf_rd_p=ca1687c8-5dce-439c-8b8e-69bb86d82799&pf_rd_r=P7PVTN2NQ1KJVKFPGXKC&pd_rd_r=574d2cdb-b124-45e2-a34b-3d49afbc782e&pd_rd_wg=EjRF9&pd_rd_i=B076F3938J&psc=1)

> [@BartButenaers](#):
>
> I have also seen something mechanical, with a rope that was spinning around a wheel. A floating weight lets the wheel spin and you can measure the rotations to calculate the fluid level.

never seen this kind of sensor. To discover.

---

<div class="post-metadata">

**Author:** ![hominidae](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hominidae/32/4174_2.png) [@hominidae](https://discourse.nodered.org/u/hominidae)\
**Post date:** [13 June 2021 20:34 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-tank-volume-beta/47101/15 "2021-06-13T20:34:07Z")

</div>

> [@BartButenaers](#):
>
> So you mean something like this:
> 
> ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/4/44a9450514fa7ed114a67aed982e636b461e0440.png)
> 
> Does it makes sense to implement it like this:
> 
> 1. In the config screen you can set the _ **swamp height** _ , which is default 0.
> 2. In the output message I send extra those fields:
> 
> - The swamp height
> - The swamp volume
> - The corrected filled volume (= real filled volume - swamp volume)

Yes, exactly....thank you for considering that.  
As far as I recall, the swamp height is either defined as a parameter, with the tank data sheet or is the height above ground of a submerged pump until it will automatically switch off (before sucking in air instead of fluid).  
So this will work perfectly.  
The "corrected filled volume" is the remaining usable volume, which is a good measure for example when calculating the remaining working time for a garden sprinkler or heater (gallons/hr throughput) or numbers of access / refills for an external reservoir (like a toilet flush / lawnmower fuel refills).

---

<div class="post-metadata">

**Author:** ![hominidae](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hominidae/32/4174_2.png) [@hominidae](https://discourse.nodered.org/u/hominidae)\
**Post date:** [13 June 2021 20:35 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-tank-volume-beta/47101/16 "2021-06-13T20:35:20Z")

</div>

> [@Jean-Luc](#):
>
> These:
> 
> [https://www.amazon.fr/UEETEK-ZP4510-P-Interrupteurs-flotteur-verticaux/dp/B076F3938J](https://www.amazon.fr/UEETEK-ZP4510-P-Interrupteurs-flotteur-verticaux/dp/B076F3938J)

perfect...thanks for shäring!

---

<div class="post-metadata">

**Author:** ![molesworth](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/molesworth/32/11748_2.png) [@molesworth](https://discourse.nodered.org/u/molesworth)\
**Post date:** [13 June 2021 20:52 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-tank-volume-beta/47101/17 "2021-06-13T20:52:34Z")

</div>

> [@hominidae](#):
>
> ...these sensors work OOTB with tasmota.firmware: [HC-SR04 ultrasonic ranging sensor - Tasmota](https://tasmota.github.io/docs/HC-SR04/)

Thanks for that. I don't use Tasmota (I've written a much simpler framework of my own) but they should work fine in my setup.

It looks like there are quite a few sensor options, and I've found some cheap laser ranging ones as well, but going by what Jean-Luc has said measuring the depth in a closed tank may not be as easy as it looks. Time to buy a few sensors and try some experiments...

---

<div class="post-metadata">

**Author:** ![hominidae](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hominidae/32/4174_2.png) [@hominidae](https://discourse.nodered.org/u/hominidae)\
**Post date:** [13 June 2021 20:56 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-tank-volume-beta/47101/18 "2021-06-13T20:56:22Z")

</div>

> [@molesworth](#):
>
> Thanks for that. I don't use Tasmota (I've written a much simpler framework of my own) but they should work fine in my setup.

Tasmota uses the new ping library under the hood....best goody is, you can use these sensors single wire/pin with it: [teckel12 / Arduino New Ping / wiki / Home — Bitbucket](https://bitbucket.org/teckel12/arduino-new-ping/wiki/Home#!single-pin-sketch)

---

<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:** [13 June 2021 21:09 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-tank-volume-beta/47101/19 "2021-06-13T21:09:25Z")

</div>

> [@hominidae](#):
>
> The "corrected filled volume" is the remaining usable volume, which is a good measure for example when calculating the remaining working time for a garden sprinkler or heater

Yes indeed. And e.g. for fuel oil I can determine this way how many fuel I stil have left, taking into account the fuel at the bottom that I can never use.

But you triggered my brain. I think I need to expand your idea with a _ **maximum limit** _. When I need to order extra oil for my heating system, I need to order a minimum of 500 liters. So I could let Node-RED send me a notification when the empty volume (above the fuel) is more than 500 liters, and the current oil price is below xx euro. But I don't want to fill my tank 100%, for example because I have a sensor mounted at the top my tank. Just an example... In that case it would be nice if the empty volume would also be corrected, because I cannot fill the empty space entirely.

So I'm thinking of just introducing both a minimum and maximum level in my node:

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

Then I can send both the corrected filled volume and corrected empty volume.

---

<div class="post-metadata">

**Author:** ![hominidae](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hominidae/32/4174_2.png) [@hominidae](https://discourse.nodered.org/u/hominidae)\
**Post date:** [13 June 2021 21:26 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-tank-volume-beta/47101/20 "2021-06-13T21:26:04Z")

</div>

> [@BartButenaers](#):
>
> I think I need to expand your idea with a _ **maximum limit** _  
> [...]  
> So I'm thinking of just introducing both a minimum and maximum level in my node:
> 
> ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/e/eee762bfe4a879fd33895a82fa0d59652efe670d.png)

...perfect...the volume between min and max level is the net usable volume of the tank.

> [@BartButenaers](#):
>
> When I need to order extra oil for my heating system, I need to order a minimum of 500 liters. So I could let Node-RED send me a notification when the empty volume (above the fuel) is more than 500 liters, and the current oil price is below xx euro. But I don't want to fill my tank 100%, for example because I have a sensor mounted at the top my tank. Just an example... In that case it would be nice if the empty volume would also be corrected, because I cannot fill the empty space entirely.

Totally agree....this can also be used to trigger a refill from a cascade of separate tanks, keeping the first one filled at optimal level.  
But is "empty volume" the correct naming for this part? It sounds wrong in my head but I am not a native english tongue.  
Maybe "(already) emptied volume", "refillable volume" or "refill volume" is/sound better?

[Next page](https://discourse.nodered.org/t/announce-node-red-contrib-tank-volume-beta/47101.md?page=2)
