Minimum Distance of JSN-SR04T for Watertank ?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

Minimum Distance of JSN-SR04T for Watertank ?

#1 Post by Oetsch » 28 Sep 2020, 11:34

Hi
after nearly finishing my first step of tank/pump system for garden irrigation the system achieves such good acceptance that it should be expanded and the outdoor tank should also be included by measuring it´s water level.

Because it is outside and consists of two connected tanks of this type:
IBC-Container-mit-Kunststoffpalette-AUER--ibc_1000_k_150_50-un_01.jpg
IBC-Container-mit-Kunststoffpalette-AUER--ibc_1000_k_150_50-un_01.jpg (236.42 KiB) Viewed 22334 times
I only see the ultrasonic sensor JSN-SR04T as possible solution. Because these tanks are automtacilly filled from the house roof and only 100% water level skips filling, the sensor will also be sometimes wet/under water. The JSN-SR04T is specified as water resistant but is putting it inside water also ok?

The other problem/question is the minimum distance the sensor is able to measure (20cm). Have you seen/known or operate a solution which is nevertheless able to measure tank level from ~ 90 to 100%? Do you think a pipe construction (20cm) on top of the tank will solve this problem or is the sensor angle of 75° to big and the will always cause problems for the measurement?

Softwarewise, what is the output of espeasy in case the sensor reaches the minimum distance of 20cm. Is it possible to filter/manipulate the result to a fix value?

Thank you very much for your feedback and input.

Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Re: Minimum Distance of JSN-SR04T for Watertank ?

#2 Post by Wiki » 28 Sep 2020, 12:47

The sr04t won't work for you. One time submerged there will be water drop on the sensor and this will cause undefined readings. Whether a tube could be a solution I don't know.

I had a similar question with the water tank of my RV and posted my solution. Fromhere viewtopic.php?t=7781#p45302 on there are several ideas from otber mmbers, probably there you could find a solution fulfilling your needs.

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

Re: Minimum Distance of JSN-SR04T for Watertank ?

#3 Post by Oetsch » 28 Sep 2020, 23:38

Thx, interesting to read and good information for me.

Using Ultrasonic for this case isn't a good idea. Now i Unserstand why and also found many cases having huge trouble inside of water Tanks.

Regarding your solution i do also think it's mechanically complex and looked for an alternative.

A level probe could be used but because of 4-20mA Output there are additional Power sources or boost converter needed, solution is more expensive and the result resolution seems Not to be so good.

Found the TOF Sensor VL53L1X which can be connected to esp8266 by i2c communication.
There is a Cover shield available but need some detailed preperation to make it waterproof. I'm also Not Sure how complex this is to include in easyesp. Because a Special library has to be included but there is an example Project already executed and shown in the web.

Mmh what do you think?

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Minimum Distance of JSN-SR04T for Watertank ?

#4 Post by TD-er » 29 Sep 2020, 00:40

What about those "capacitive" plant watering sensors?
Those can be placed outside the container and will still react to water level rising to the point of the sensor.

You can place multiple to get an idea of the level of water in the tank.

Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

Re: Minimum Distance of JSN-SR04T for Watertank ?

#5 Post by Oetsch » 29 Sep 2020, 09:57

Thx, thought about it and the "connection" from outside i like very much but the dedicated amount of information according to the number of sensors I do not really like. It´s similar to having an overfill protection sensor and not a level information system.

Reason why I skipped the JSN-SR04T is the minimum distance needed or the problems which are known by mounting it in a tube or with solutions tried to use non-sonic reflecting materials inside. I already have one of these sensors here and tried it at the other tank. Because of unstable results i switched to a non-waterproof type for a test and this works for several weeks now. But this will not work continously at the outside tank with often 100% water level.

So the TOF sensor might get wet; found sensors which are sold together with a cap/shield and maybe this can be put (glue) in a housing with a hole to make it waterproof. Ok maybe drops on the sensor will result into errors but i think these drops will also disappear. In between the measurement should work from 0 to 99,9% level.
cover.JPG
cover.JPG (29.84 KiB) Viewed 22294 times
Will it be complicate to use the deactivated plugin and compile an easyesp software? Think so because the Plugin P0133 is not listed: https://espeasy.readthedocs.io/en/lates ... al-plugins

Because the tanks are installed under a roof (dark environment) I guess the VL53L0X (max 2m) should be fine and the VL53L1X (max 4m) isn´t necessary.

Worth to give it a try?

P.S.: The mentioned roof over these tanks is made of metall. So mounting a wifi device directly on top of the tank isn´t a good idea. Plan to use a shielded cat5 cable ~5m for the I2C Bus. This is expected to be unproblematic?
Last edited by Oetsch on 29 Sep 2020, 12:47, edited 2 times in total.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Minimum Distance of JSN-SR04T for Watertank ?

#6 Post by TD-er » 29 Sep 2020, 10:55

I2C can't be used over long cables.
Longer cables greatly reduce the max. clock speed of the I2C bus.

The current code (just made a new build) has support for switching between low and high I2C frequencies per task, so you may be lucky here.
You can also consider using an I2C multiplexer, as it also can be used to separate sensors to their own (longer) bus without affecting other sensors on the bus.

About the WiFi + metal roof.
Just try it, and also try various orientations of the ESP antenna.
In WiFi B/G mode you can maintain a stable WiFi connection with lower RSSI values.

Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

Re: Minimum Distance of JSN-SR04T for Watertank ?

#7 Post by Oetsch » 29 Sep 2020, 12:42

ok thx, so not a good idea to use I2C over such distances...

The sensor will be the only sensor on that I2C network. But regarding the Wifi, my idea was to mount the ESP8266 at the other end of the cable because then I can also put a 7 segment display there to visualise the level.

This morning I remembered a test order of a ESP8266/wroom board which is powerd by a battery but never used. So should be in one of my boxes:). Would be a good idea to make some testing with this device before starting to pull cables :)

In worst case szenario I also have a D1 mini pro here which can be used with external antenna, which might help to get a stable connection.

Can you give a recommendation regarding the P0133 Plugin for ESPEasy? Found the github page and the the list of Plugins you referred to. Guess the P0133 is non standard / not ready implemented or because of flash size will not be implemented in near future, right?

ESP32 has bigger memory is this plugin out of the box useable by espeasy version for ESP32? Or in general totaly "alpha" status and better not touched by me?

Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Re: Minimum Distance of JSN-SR04T for Watertank ?

#8 Post by Wiki » 29 Sep 2020, 14:00

Well, what I was thinking of was a solution like https://camperforum.nl/viewtopic.php?t=8457836#p1584333 which I rmembered it was linked in the mentioned thread.

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

Re: Minimum Distance of JSN-SR04T for Watertank ?

#9 Post by Oetsch » 29 Sep 2020, 15:13

Wiki wrote: 29 Sep 2020, 14:00 Well, what I was thinking of was a solution like https://camperforum.nl/viewtopic.php?t=8457836#p1584333 which I rmembered it was linked in the mentioned thread.
Thx, now I got your point. Have to think about it and read if someone has done sth similar. First impression is that this is also not easy because one input of the sensor has to be the reference pressure from outside the tank. This means a tube from the sensor to the environment air. This can cause problems because of condensing water coming into the sensor. Think solutions with pumps or dry air would become to complex, so have to evaluate a bit deeper and come back.

Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

Re: Minimum Distance of JSN-SR04T for Watertank ?

#10 Post by Oetsch » 29 Sep 2020, 23:44

Wiki wrote: 29 Sep 2020, 14:00 Well, what I was thinking of was a solution like https://camperforum.nl/viewtopic.php?t=8457836#p1584333 which I rmembered it was linked in the mentioned thread.
Mmmh, theorie can be nice but looking to the offerings from the Market i get interested in this Level probe. By looking into Details i saw the Tube coming Out of the cable, so seems to be based on your suggestion and maybe easy to use:
PSX_20200929_210832.jpg
PSX_20200929_210832.jpg (149.83 KiB) Viewed 22264 times
IT IS available for 0 to 2m measurement. This will Bring max 60% of the 20mA because of the Tank height of 1,2m. Using a mA to 3,3V Converter incl adjustment will allow to use full range of 0-3,3V for the D1 Mini.
-1858310688-627092717.jpg
-1858310688-627092717.jpg (266.31 KiB) Viewed 22260 times
Mmh, Like it so far

HomeJCL
Normal user
Posts: 89
Joined: 03 Feb 2018, 10:42

Re: Minimum Distance of JSN-SR04T for Watertank ?

#11 Post by HomeJCL » 30 Sep 2020, 08:08

IBC is open to the atmosphere

So in essence just a pressure measurement is enough

An hydrostatic probe as illustrated will work but at what cost ?
On the other hand a 4-20 mA signal alleviates the distance limit.

I would go for a cheapo gauge pressure sensor screwed on the bottom connection of the IBC.

But this would need to be easily de connected in case of sludge and maintenance and to be dismantled in winter to preserve from frost (water ...)

By the way don’t need a fancy mA input card for the sensor just a 12v and a resistor, check it mA signal in arduino for e.g.
Belgium and land of ESP ... counting :D

Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

Re: Minimum Distance of JSN-SR04T for Watertank ?

#12 Post by Oetsch » 30 Sep 2020, 09:05

Hi

not sure which pressure measurement method is used by this probe. Gauge pressure also referes to exact atmospheric pressure by measuring and this can also be the tube I´ve mentioned before been used for. So maybe not precise from me to call this also a differential pressure measurement without beeing aware of gauge method.

The probe can be ordered for 25€ incl. shipping.https://de.aliexpress.com/item/4001031191182.html
This probe is available in several types for for different measurement ranges. Nearest to my application is the one for 0m-2m. But I only will need the height up 1.2m. So the 4-20mA signal will never be higher than 60% of 20mA ->12mA. This decrease the resultion and increase effect of errors. But in general I believe the different types of this "cheap" sensor are done with one sensor and only the output range (4-20mA) is adjusted to the needed range. So general error of this sensor might also have an effect based on the selected type of sensor. Nevertheless they say 0.2% accuracy.
The shown mA to V card costs 3€ incl. shipping at Ali Express. https://de.aliexpress.com/item/32823522400.html
It offers turn of 0/4 to 20mA to 3.3V which is good for D1 Mini and also an adjustment skrew for the zero and Max(3.3V) Level. So adjusting 12mA to the 3.3V and also the 0% level can be done easily, this seems to be comfortably for me but of course can also done by resistor and software solution.

This sensor in general needs higher voltage but there ist also a 2A booster card to bring up 5V (D1 mini power supply) to 24V for 2,5€ incl. shipping. https://de.aliexpress.com/item/32833505298.html
So for ~30€ in total an ongoing level measurement with temperature compensation, environmental pressure compensation, good resistance against water and low level temperature in wintertime, nearly no influence of water quality (reflections) or disturbing parts like for ultrasonic or laser and no effect of the cable lenght for 4-20mA (the level probe also includes 5m cable which is enough for me).

Ton_vN
Normal user
Posts: 300
Joined: 21 Oct 2016, 15:20
Location: Hengelo (Ov)/ NL
Contact:

Re: Minimum Distance of JSN-SR04T for Watertank ?

#13 Post by Ton_vN » 30 Sep 2020, 19:47

This thread may also provide usuable ideas for measurement of liquid level:
viewtopic.php?f=2&t=6643#p36525

Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

Re: Minimum Distance of JSN-SR04T for Watertank ?

#14 Post by Oetsch » 02 Oct 2020, 10:38

Thx Ton.
Good information.

Current status is that my impression is that the usage of pressure measurement is more reliable and therefore resistant to environmental interferences.
Ultrasonic and laser might have problems or unstable readings because of reflection problems or problems caused by water (drops & humidity etc.). But these sensors are very cheap so i´ll have these at home to try. Not to forget for the laser method there is no ready to use easyesp solution and some hurdles for me have to be taken to make it work which is not guaranteed.

For pressure measurement there seems to be also cheap sensors (haven´t looked up every price) but the necessary additional effort like tubes or making them waterproof has to be achieved. Therefore the Ali-Express ready to use pressure sensor seems to be a good mix between quality, effort and costs. I have ordered one and will see.

Agree, the usage of such converter/booster modules is not essential but are worth to be considered because they are also not expensive and will work out of the box. If I do not have the right parts (resistor values etc.) at home and have to drive to a shop or order some.....

Will now wait for the delivery and let you know if it works.

BR

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Minimum Distance of JSN-SR04T for Watertank ?

#15 Post by TD-er » 02 Oct 2020, 11:34

What kind of sensor do you mean to measure "pressure"?

A BME280 inside the top of a air tight "appendix" of the tank pointing upwards?
Or parts of a scale placed under the tank?
Or maybe a piezo element? (hard to measure because of the potential high voltage spikes)

Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

Re: Minimum Distance of JSN-SR04T for Watertank ?

#16 Post by Oetsch » 02 Oct 2020, 13:41

Can not exactly say what is inside of the Ali-Express probe. It can be widely found on consumer platforms ebay, amazon, ali-express and seems to be "unbranded".
Have found the brand "Tebru" seems not to be right. Model Type are often given TL136 and T231 but the differences etc. I could not evaluate and there is not datasheet at all.

From the picture I would say this is a gauge pressure sensor with reference to the local atmospheric pressure provided by the little tube inside of the cable.

My general impressions about pressure measurement are partly also applicable to the methods you asked. The link provided by Ton says that bme280 might not work for differential method using 2pcs. bme280 inside of 2 pcs. tube ( 1x refence atmospheric pressure 1x pressure from water level inside of airtight tube) or better only work to limited level of water because of max pressure limits of bme280.

Parts under a tank haven´t been considered by me because I will not fit in addition to the tank into the whole in the ground and lifting the tank out of the whole is not foreseen so far. Nevertheless I would call this methods weighing methods but your right this is also pressure :)

HomeJCL
Normal user
Posts: 89
Joined: 03 Feb 2018, 10:42

Re: Minimum Distance of JSN-SR04T for Watertank ?

#17 Post by HomeJCL » 02 Oct 2020, 19:54

Measurement is my game.

And as far I am always inching towards a full on, exceedingly complicated solution, at home I force my self to think differently.

In the end, for the IBC, it is a lot easier and safer to put your money in additional IBC’s than in tricky and in the end non value measurements.

Think about this solution, what does it bring to know you are low on water and won’t get any more water when you are low ....

There is a saying “nothing replaces cubic” this literally is true for your garden, weather the last years are testament to this.

KISS :D
Belgium and land of ESP ... counting :D

Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Re: Minimum Distance of JSN-SR04T for Watertank ?

#18 Post by Wiki » 03 Oct 2020, 10:44

At least to be able to auto shutoff your pump of your watering system to avoid running hot.

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

Re: Minimum Distance of JSN-SR04T for Watertank ?

#19 Post by Oetsch » 04 Oct 2020, 10:58

Wiki wrote: 03 Oct 2020, 10:44 At least to be able to auto shutoff your pump of your watering system to avoid running hot.
fully agree :)

In total there are 4 IBC in operation and I cannot agree to your conclusion. 2 major outcomes: a) prevention against "accidents" like overfill of a tank which causes water in the cellar or damaged equipment like hot pump b) optimized operation. without knowing anything of a tank in a hole in the ground your are also not able to operate the system very well e.g. in a hot summer when you are probabily running out of your water stock because of no rain.

I agree that everything with regard to a water system should not become to complex or better expensive because water is important but not so expensive (~2€ per 1m³) that unlimited effort in the automation system make sence.

Having this in mind and in addition that the system (pumps & tanks) and the automation system (IOBroker) is already in place, have had 2 accidents of a flooded cellar because of overfill of a tank, for me it´s worth to spent some effort in it or stopping the system at all.

Regarding costs, it´s also good to have a full view of your tank levels because of a photovoltaik system the power during strong sunshine can be used for the pump in a most oeconomic way instead of selling it cheap and using the pump in the evenig with expensive electric power bought externally but this of course is different in each case according contracts and each country.

Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

Re: Minimum Distance of JSN-SR04T for Watertank ?

#20 Post by Oetsch » 09 Nov 2020, 17:04

Hi

the electronic modules and the level probe have been delivered and yesterday installed. So just my feedback for anyone who is intereted and thank you for everybody giving hints and helping to develope that solution.

The level probe was ordered for measurement range up to 2m and 5m cable. during installation I realized that up to 1m measurement rang should have been also enough. But because of the current to voltage converter module it is very easy to adapt and currently the tanks are full. So put the level probe in to adjust full 3,3V as 100% and pulled it out to adjust 0V for 0% level.

Because I only like to use one power supply I installed a 5VDC to 24VDC booster module to power the level probe and the converter. The Vout is connected to a Wemos D1 Mini but for installation/adjustment it was best to check by voltage meter first that everything works fine.

Analog Input of ESPEasy was very easy to use and everything works fine. Nevertheless a very small voltage difference will cause a bigger difference of water which means 0,165V -> 100Liter and this results into ongoing changes by measurement or equipment errors which are not very nice to see when nothing is happening to the level in reality. So thx again to TD-ler who showed me how to filter these fluctuations by rule and now everything works fine!

Code: Select all

On LevelTank2#Analog do
  if [var#1]=0
    Let 1,[LevelTank2#Analog]
  endif
  Let 2,[LevelTank2#Analog]-[var#1] // store difference
  Let 3,%v2%/16           // determines filter speed
  Let 1,%v1%+%v3%     // add fraction of difference
  7dn,[var#1]             // output to 7 segment display
  Publish %sysname%/LevelTank2/Level,[var#1]  // MQTT publish of the result
EndOn
Cost to consider based on Ali-Express orders:

Level probe: 25€ inkl. shipping
current to voltage module: 2,2€
MT3608 24VDC booster module: 2€

D1 mini + 5VDC power supply as normal

Thanks and let me know if sth is needed in more detail.
Last edited by Oetsch on 10 Nov 2020, 10:08, edited 1 time in total.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Minimum Distance of JSN-SR04T for Watertank ?

#21 Post by TD-er » 09 Nov 2020, 19:38

Great!

And just to keep in mind, when working with long cabled and analog signals...
The cable itself may pick up noise. You now are filtering in the rules to filter out some impulse noise.
But keep in mind the signal to noise ratio may differ for low voltage levels.
It depends a bit on the kind of signal you're carrying over the long wire (a 0...5V voltage or a 4 .. 20 mA current).
Just imagine the noise you pick up is something adding +/- 100 mV with an average value of what you're measuring after filtering.
If you measure 0.1V on average, then the noise is just as large as the signal.
If you measure 5V on average, then the noise is only 1/20th of the signal.

Typically the noise on a 4 .. 20 mA current is much less of an issue compared to a voltage since the internal resistance of a voltage meter is ideally infinite, thus a very low current. => very little energy is needed to generate some noise.
This means you better have the long cable carry the 4 .. 20 mA signal and keep the cable between the converter and the analog input as short as possible.

Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

Re: Minimum Distance of JSN-SR04T for Watertank ?

#22 Post by Oetsch » 10 Nov 2020, 10:13

Thanks and also very understanble explained.

Luckily the current to voltage converter module is installed in the same housing as the D1 mini so only 5cm Dupont cable is used for the voltage signal. The long distance ~8m is done for the 4-20mA signal as should be best :D

Post Reply

Who is online

Users browsing this forum: No registered users and 31 guests