Measuring water tank levels with Home Assistant

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 พ.ค. 2024
  • I show how to measure water pressure in two different water tanks, how to set it up in Home Assistant and all the hardware needed.
    M5Stack Atom Lite: m5stack-store.myshopify.com/c...
    Water pressure sensor: www.amazon.com.au/Pressure-Se...
    Tatham Oddie and M5Stack Setup: • ESPHome: Nothing-to-fi...
    Music: bensound.com
    Chapters:
    0:00 Introduction
    0:40 Bore tank description
    2:16 Bore tank setup
    4:22 Pressure Sensor test bed
    6:42 House tank housing assembly
    8:33 House tank installation
    10:00 Home Assistant integration
  • วิทยาศาสตร์และเทคโนโลยี

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

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

    Hi Lars,
    A great solution that I have been looking for for a long time. My M5 stack and pressure sensor have been ordered a while ago and meanwhile everything seems to work fine, but at one point I don't follow. I am probably missing something, but why is the 1v value important when you know how many liters you can put in your tank, and how do you calculate that value?
    With me 0.04v is an empty tank, but the rule of 3 does not really get me there. 0 litre * 1v / 0,04 v ..... stays 0

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

      Excellent question. For my four pressure sensors they all have different voltage for an empty tank. But I don't know what that value is, because I am not about to empty the tanks to find out. Instead I am going to approximate the current water to voltage ratio. I can measure the water level from the top, e.g. 600mm, and I know how big the tank is, e.g. 2100mm tall and a radius of 2700mm.
      Knowing that, I can calculate the litres currently in the tank and I know the voltage being measured. For example there is 33,000 litres in the house tank at 0.408571v. I need to know how many litres would be in the tank at 1v so I can multiply it by the current voltage minus the "empty" voltage. (current v - empty v) * litres at 1v.
      Now the "litres at 1V" value is an educated guess and you might have to do this a few times. From the bench test I have an idea that 0 litres is about 0.365v, but it can vary up to .44v for one of my sensors. So, in this case litres at 1v is 33,000 / (0.408571 - 0.365) = 757384 litres.
      Now, when I get a voltage reading, such as .412561v I can calculate that is 36021 litres. This is a bit complex, but the only way I could figure out how to do it. It has seemed very reliable once I got the "empty voltage" adjusted properly. I hope this helps 😊

    • @WouterMeeus
      @WouterMeeus 3 ปีที่แล้ว

      ​@@LarsKlintTech You are a Pro !!!
      Thanks for the extensive explanation.
      I will continue to work on it !!

    • @jean-claudeverdonck5053
      @jean-claudeverdonck5053 2 ปีที่แล้ว +1

      @@LarsKlintTech If you read the voltage before you drop everything in the tank then you have the voltage of an empty watertank. Or am I'm missing something?
      Great tut by the way, thank you very much. I've still some problems that I hope to solve.

    • @LarsKlintTech
      @LarsKlintTech  2 ปีที่แล้ว

      @@jean-claudeverdonck5053 Correct. That is also the value (bench test) I am using in the blurb above 😊
      And thanks for watching too.

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

      ​@@jean-claudeverdonck5053 Hi, I guess when you measure the voltage before you drop the sensor in the tank then you now the voltage from a empty tank. In my case I know how many liters are in a full tank. So when I drop the sensor to the bottom then I know the voltage from a full tank and can working with this two different voltages.

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

    Just dropping by to say I love you shirt. You deserve awards that humans havent created yet you magnificent being.

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

      Awwwww, thanks mate. That is very kind of you 🥹

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

    nice idea using the preasure sensor pipe "B*MB" :D, which is the sensor very common used for car so it easy to aquire and cheap, I was planning to add sensor to my tank this would work well as I dont really want to drain my tank empty and drill a hole on my tank, thanks for the video!

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

      You are most welcome 😁I have one more tank that I need to do the same with, so I will use my own video too 😂

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

    Hi Lars,
    Thank you for the inspirational video. I just got around to implementing a similar setup after having the parts on hand for about six months! I'm using it in an automation along with a solenoid valve to add mains water to my tank when the level gets low, to prevent the pump from running dry. Keep up the great work!
    Steve.

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

      Thanks Steve. Excellent! I have just bought two Holman water pipe solenoids for the exact same purpose. I have two tanks I want to top up automatically, so we don't run out as well. We fill it from a bore, rather than mains, but same principle.

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

    Thanks for a great video from South Africa

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

    This is absolute gold. Thanks for putting this up. Although, I'll have to watch some more times, as I still can't get my head around the math part.

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

      Thanks Sebastiaan :)
      Check out the other comments on the video, as there are a bunch of math related questions there too that I answer.

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

      @@LarsKlintTech yep. Discovered the answer you gave to Wouter, which helped. might be worth pinning that one! Thanks again.

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

      @@sebastiaanstoffels7565 Good point. Done.

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

    Hi Lars, Great video. You can get shrink tube with a glue lining that saves having to silicone up the joints.

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

      Ahh, nice. Might save the terrible mess 😂

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

    Thanks for the video =)

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

      You are most welcome mate. Thanks for watching 😊

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

    Hi Lars. Awesome stuff. Was looking for exactly this solution. Question I have is how do you deal with the wifi connectivity. I only have an acre but very hilly and have 4 tanks to look after. Just interested on your wifi topography especially when the bore tank module sits in a Faraday cage the iron shed.

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

      Thanks Janusz. Appreciate the kind words 😊
      I have a LOT of wifi coverage on about 30 acres, so I am spoilt for connection options. I have 15 access points covering most of the farm, which are connected to 5 switches in various buildings. I have an access point right outside my pump shed which, but the signal comes through okay. A couple of years ago I made this walkthrough of the entire setup (which has changed a bit since): th-cam.com/video/IMrlIYNZCe8/w-d-xo.html
      If you can get your signal to various places on your property, thus covering a larger area, that would increase your chance of connecting in more places.

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

    Hi Lars, great video. Please keep up the good work. Also, have you considered expanding this for sensors/field measurement devices at a distance. Im thinking of trying to use the ATOM DTU LoRaWAN915 or similar in an attempt to measure tank levels some 200+ meters away. Would you have any thoughts on this?

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

      Hi Lyle. That is an interesting idea. I didn't know that device existed. Because it is 915Mhz, what receives the signal on the other end? Do you have another device that can receive that frequency and add it to HA? Can you explain more of the architecture you are thinking?

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

    Great video. You’ve introduced me to a new world.
    I don’t mention it, but what’s the water pipe connection that allows for a sensor installation?
    Thx!

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

      Thanks Shaun 😊 And welcome to the rabbit hole of automation 😏
      The connection in the water pipe is just a thread that matches the sensor thread. I use something like this to make the thread after the hole is drilled: www.ebay.com.au/itm/134330127244?hash=item1f46b3138c:g:UK8AAOSwao1bFPUV

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

      @@LarsKlintTech ohhh so you just drilled into the current pipe vs putting a ready made wedge that has the sensor pre drilled. Interesting. Is it poly or metal?

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

      @@byrnecore Yes, correct. All the pipes on the farm are old metal pipes, so it was pretty simple to do, rather then having to replace the whole piece of pipe.

  • @Lucas-vv3yv
    @Lucas-vv3yv 2 ปีที่แล้ว +2

    Great video, thanks for putting it up.
    Just an idea but it may be possible to get better results using a lower pressure rated sensor. 100psi is the pressure of water at around 70m depth. Your woolshed tank looks about 4m deep which would exert less than 6psi when full, a lower rated sensor could possibly give better resolution. Does that seem right?

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

      Yes, you can absolutely use a sensor for lower pressure. These sensors were the best for the cost, so I made them work. Same principal applies though for using a 10psi sensor for example.

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

      TLDR: This setup (150psi sensor + ESP32 chip) has a theoretical maximum fidelity/resolution of 2.6cm and a practical one of ~10cm.
      The math/calculations: The ESP32 chip can differentiate between 4095 points (it's analog channels are 12 bit). So the chip can see up to 4095 points of voltage change across the maximum sensors range (imagine there are 4095 points marked along the side of the tank, then the chip can determine a change between each of those points, but that's it's maximum resolution). The sensor has a psi reading between 0 and 150psi, which equates to 0 - 105m of water. So there are 4095/105 = 39 points/m. Or a resolution of ~ 2.6 cm.
      This is IF the programming is perfect, and the voltage is either perfectly linear or perfectly calibrated and the unit is without error (pressure and temperature contribute) In reality is probably going to be about 50% accurate for both and they are typically 3% accurate (manufacturers claim 2%) So a practical fidelity of 10cm.
      FWIW there are 30psi sensors that would work (And give 5 times the resolution) but any better and you're looking about 4 times the cost. You can also get a better voltage sensor; eps32, arduino, etc require an external board and these can give you around 10 times the fidelity at a reasonable price (maybe $35 au)

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

    Thanks for the great video Lars! Just wondering if you have a voltage divider on the pressure sensor output or you just feed the output straight into the M5 ?

    • @LarsKlintTech
      @LarsKlintTech  2 ปีที่แล้ว

      Directly into the M5. The voltage from the pressure sensor is max 4.5v and the M5 can take 5v (at low amps).

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

      @@LarsKlintTech thanks for the reply mate!

    • @fredstephens6793
      @fredstephens6793 2 ปีที่แล้ว

      @@LarsKlintTech Where does it document this? It looks like you are getting away with this as the sensor output voltage range is 0.5 to 4.5 and the PSI rating of your sensor and the measured pressure level voltage never exceeds the input limit. PS. Can you publish the sensor portion of esphome YAMAL file?

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

      @@fredstephens6793 It is documented here docs.m5stack.com/en/core/atom_lite
      Yes, the voltage never exceeds 4.5v from the pressure sensor.
      Here is the sensor config in yaml:
      sensor:
      - platform: adc
      pin: 33
      name: ${friendly_name} Voltage
      update_interval: 30s
      icon: "mdi:water-percent"
      accuracy_decimals: 5
      attenuation: 11db
      filters:
      - median:
      window_size: 200
      send_every: 10
      send_first_at: 4

  • @b0neme
    @b0neme 2 ปีที่แล้ว

    HI! Good job! So, at 6:04, what is the size of the adapter that connects the sensor's silver input to the pipe assembly. I'm only looking for the NPT connection that connects directly to the pressure sensor. Tnx

    • @LarsKlintTech
      @LarsKlintTech  2 ปีที่แล้ว

      Thanks mate 😊 That is a 1/8" NPT connection.

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

    Thanks Lars, Great video, Ive actually watched in a dozen times.....I have purchased my Atom and the pressure sensor using your links, I have watched Tathams video and set the Atom up first go, used your Yaml File for the Pin out and receive voltages every 5 seconds in my Logs. I have question though. I have a 4KL Square Tank, whats your thoughts on substituting the formula to as my tank is not round ?

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

      Instead of calculating a cylinder volume (π · r2 · h), use a cube volume(s3). That should work.

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

      @@LarsKlintTech Thanks Las, I bought the PSI transducer...see some widely voltages even with your filtering....Thinking I might replace with a 10PSi Transducer as my 4KL water tank max is 5.6psi when full might help with a more accurate voltage more granular and stop it from bouncing all over the place. I might also insert a check valve after the sensor to eliminate any issues with back flow pressure affecting the voltages. As always thanks for your incredible idea and thoughts....has inspired me

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

      @@just_aths A smaller pressure rated transducer makes sense, as does the checkvalve. I have tons of wrong readouts from one sensor, because of no check-valve/back flush valve.

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

    Excellent. So correct me if I'm wrong, but to accurately interpret the voltage, could i connect the sensor to some pvc pipe the same height as the tank and add water to record the voltage at multiple levels?

    • @LarsKlintTech
      @LarsKlintTech  2 ปีที่แล้ว

      Yes, you should be able to. I find the voltage does vary a lot. You'll never get a stable measurement due to atmospheric pressure, water flowing etc. But with an appropriate number of measurements over time, you can get a good average.

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

    I really like this method. I've been searching for a good method for a while now. I have a 3000 gallon underground tank I need to keep an eye on because of a poor performing well. We need to water the grass and the garden, but have been concerned that we exceeding the well output. Could you have just added a lot of silicone around the sensors instead of putting them inside the pipe or do they need atmospheric pressure to register correctly?

    • @LarsKlintTech
      @LarsKlintTech  3 ปีที่แล้ว

      I tried covering the sensor in silicone twice, but somehow water got into the sensor both times. It didn't break the sensor, but the readings were all over the place. Hence, I went with the metal pipe solution. The pressure is measured at the bottom of the tank, then I take the voltage and converts to litres based on maths. 😊

    • @scorpio8101
      @scorpio8101 3 ปีที่แล้ว

      @@LarsKlintTech thanks, you could share your tank voltage config?
      like
      sensor:
      - platform: adc
      pin: A0

    • @LarsKlintTech
      @LarsKlintTech  2 ปีที่แล้ว

      @@scorpio8101 For one pressure sensor I have this esphome config currently
      sensor:
      - platform: adc
      pin: 33
      name: ${friendly_name} Voltage
      update_interval: 30s
      icon: "mdi:water-percent"
      accuracy_decimals: 5
      attenuation: 11db
      filters:
      - median:
      window_size: 200
      send_every: 10
      send_first_at: 4

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

      @@LarsKlintTech thanks.

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

    Great job! Mine works now too, but I've got a question. If I want to use the same setup - another Atom Lite and pressure sensor - to measure whether or not the pump on my pond is working, I could insert the pressure sensor off the line the pump uses.
    My question would be "What am I measuring?". I suppose if the sensor says "empty" then it's at atmosphere and the pump is off. But what will the pressure be when the pump is operating? Higher, right?
    I'd set the scaling on Home Assistant to say X voltage means pump is 100% and Y voltage means 0%, and interpolate a % from an inbetween voltage.
    And does the sensor need to be "in the stream" of water, or is the pressure going to be higher off of a "T" intersection?
    Tnx

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

      Good question. Measuring moving water will give a non-predictable result in my experience. I have a tank with no stop valve, which means the pressure is moving constantly. You would probably be better off with a flow meter instead, as then you can measure how much water is coming past too. Something like this perhaps? www.amazon.com.au/MagiDeal-Connect-0-3-10L-Effect-Sensor/dp/B074V5RTFX/ref=sr_1_9?keywords=flow+meter&qid=1636499835&sr=8-9

    • @b0neme
      @b0neme 2 ปีที่แล้ว

      @@LarsKlintTech Thanks!

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

    Thankyou Lars for the video, gave me inspiration to try this, only problem I have is all of it, I fail to find the easy bit, hours and hours and hours of trying all I can do is turn a LED light on and off. got any hints thanks

    • @LarsKlintTech
      @LarsKlintTech  2 ปีที่แล้ว

      The hint would be to find a project that saves you time or money, or both. Turning a light on an off is great, but if you can put it on a timer relating to sunset/sunrise that could be more useful, as an example. I have outdoor lights that do just that. Come on a sunset, turn off at 10pm.
      Or you could have a motion sensor that tells you when someone is at your front door, when you are not at home?

    • @jackhawken3683
      @jackhawken3683 2 ปีที่แล้ว

      @@LarsKlintTech yes thankyou I can already turn light on and off automatically, I just want to save time measuring the amount of water in my inground water tank so i can save money on when to run the pump so your water tank project fits the bill, I just cant get it to work I know I'm missing something easy Thanks again for replying

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

    Hi, Lars
    So most of water tanks in my country are placed above the roof and mostly use float sensor,
    the problem with this method is the sensor would be rusty or ants would get inside the sensor after a while.
    and that's a nightmare to fix since I have to climb all the way up.
    so I'm looking for alternative method that can be placed below the roof and thus easier to fix,
    I noticed you placed the sensor next to the tanks, my question what if I place the sensor on the pipe on ground level right below the tanks? Any potential issues?

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

      Good question. That could work, but the main issue is often getting a constant pressure. You want to insert the pressure sensor at a point in the pipe where the pressure doesn't fluctuate much. If you can do that, it doesn't matter where you put the sensor. It then becomes a matter of getting enough voltage measures to adjust your equations.

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

    Lars, curious to know what distance you are sending your data through wifi? The reason I ask is that i just tested an ESP32 connection to an outdoor unifi AP. The distance is about 60 metres but I see no connection strong enough to send/receive (I am only testing this by seeing if I can browse to the IP address of the ESP) My unifi network shows it is connecting sometimes. Am I better off sending the data through cabling to an ESP32 closser to the AP?

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

      I guess i should have watched a few more of your videos first. It seems you have a plethora of unifi outdoor Ap's that pick up signals around your house.

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

      @@patraff1280 Yeah, I have smothered the property in Wi-fi 😂
      Having said that though, you do need to be quite close to an AP with the M5Stack Atom Lite I am using. My guess would be that 60 meters is too far for me as well. I would aim to be within 20-30 meters.

  • @AndrewGray-natreve
    @AndrewGray-natreve ปีที่แล้ว +1

    Where did you purchase that length of cabling from?

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

      Which cabling do you mean Andrew? The actual cabling for the pressure sensor is just 16 gauge electrical wire in various colours. That comes in rolls of 20, 50, 100 meters and more.

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

    Can you link from your configuration .yank file for calculations? Thanks

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

      I am not entirely sure what you are asking. You can define new sensors in your configuration.yaml file, such as statistics or template sensors, which can calculate new values for you.

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

    Do these sensors need to breath air? I've seen some sensors that can't be put "in" the water (like we do) as they need to reference atmospheric pressure. I notice my sensor (a 30 psi unit) - which I've not put in the pond yet - seems to hover around 0.47 V - 0.53 V at "empty". it seems to vary with the barometric pressure (at 29.9 inHg it's 4.8V, at 30.2 inHg it's 5.1V).. I can add an offset - either by referencing my weather station data - or by looking up via an Internet API before publishing on Home Assistant. But do you have to do something like that?

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

      I don't think they need to "breathe". Atmospheric pressure will always have an impact on the measurement, but I tend to accept that as it doesn't make a huge difference to my setup.

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

      ​@@LarsKlintTech Hi lars, two things i can think of to improve precision and reduce impact of atmospheric pressure: if the M5 support SPI protocol (if not a simple esp dev board will to the trick, minus the very small form factor of the M5), i think you can add a cheap BME280 module so you can read atmospheric pressure at ground level and adjust your computation based on that pressure variation with a calibration reading from atmospheric pressure + the tank pressure sensor at the same level. The second thing is that ESPHome allow adding filters on a sensor (ex: calibrate_linear and calibrate_polynomial) to help compensate for non linear readings at differents water depth for example. I can imagine a calibration procedure where you do several readings in a full tank, at different depth to see if the progression is linear or not, and if not, adjust with the filters. Best regards.

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

      @@sfxElrick Those are excellent tips. I considered adding the atmospheric pressure into the calculation, as I have that value from my weather station. However, I have just installed v2.0 of the tank sensor, which seems to work much better for this particular tank, and that video is coming out very soon :)

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

    Can pressure sensor work well for a 55 gallon closed rain barrel?

    • @LarsKlintTech
      @LarsKlintTech  2 ปีที่แล้ว

      Good question. The smaller the tank, the higher the inaccuracy. Maybe consider using a load cell for measuring the weight instead? I know Greg Facer (other comment on this video) has done this for some pool acid.

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

    cool vid. I just bought a gravity robot sensor to do the same thing with my tank for hydroponics. Thanks for your explanation
    How did you go about averaging the previous 35 voltage signals to use within your relationships for calculating litres?

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

      The moving average is part of the configuration. The YAML looks something like this for configuring the sensor via ESP Home.
      sensor:
      - platform: adc
      pin: 33
      name: ${friendly_name} Voltage
      update_interval: 30s
      icon: "mdi:water-percent"
      accuracy_decimals: 5
      attenuation: 11db
      filters:
      - median:
      window_size: 200
      send_every: 10
      send_first_at: 4
      Where in this case my window size is the last 200 measurements.
      I hope this helps.

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

      @@LarsKlintTech ah amazing, I didn't realise you could implement straight within the YAML file. That makes sense. Thanks for taking the time to show that. I am going to try setup a pressure sensor which I just received using the same logic! Cheers.

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

      @@andrewhadfield7754 No worries at all. Let me know how you go. The docs are here: esphome.io/components/sensor/index.html

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

      @@LarsKlintTech Thanks for the docs - didnt realise there were so many inbuilt filters for sensors. Very cool
      Managed to get the sensor working and outputting 0-3V depending on water depth. I mapped out two voltages at known water depths and determined a straight line graph from that, and used this straight line function to calculate height in Home Assistant based on voltage received. (with median values like you mentioned! )
      It is crude right now, the only box I could find to fill with water was about 30cm high - next step is to find a much deeper water source and re configure the straight line graph.
      Super happy with the result. Cheers Lars !

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

      @@andrewhadfield7754 Awesome work Andrew. Love the logical approach to finding the measurements, even though your work is "crude". Tbh, mine still feels crude, but I am within 5000 litres usually, which works perfectly for me. Atmospheric pressure and gremlins sometimes mess up my math too 😂

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

    Your cable appears to be between 75 to 100 feet (23 to 30 meters) between the pressure sensor and the esp. Does this impact your pressure reading or is it negligeable?

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

      Good question. I am no expert on resistance, but so far so good. If there is a drop in voltage, it is constant, which I can adjust for in the HA configuration.

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

    Hi Lars and thanks for the very informative video. This will provide a solution to a problem I've been wanting to sort since my addiction to HA. I do have a couple of questions though. Would say a 0-15psi sensor provide more accuracy than the 150psi unit you've suggested or does the 6 decimal points take care of that? Would a Shelly UNI be a better fit with perhaps better wifi range and easier integration into HA? (I did have links to what I was proposing but I think TH-cam rejected my post because of them). Thanks again 🙂

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

      Your comment is very timely 😄I am just in the process of testing a new type of submersible sensor, which will indeed be couple to a Shelly UNI. I can't comment on the range and easy of integration, but a video is in the process of finding out.
      In terms of the PSI range, I haven't had any issues with the 150 and accuracy. I think either will work.

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

      @@LarsKlintTech Thanks Lars, I look forward to viewing when your done. Just going thru your channel now, lots of useful stuff there :-) and it's nice to see you're a fellow Aussie!

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

      @@lensman893 Thanks for watching mate. Hopefully much more to come that you can use too :)

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

      Hi again Lars.Just thinking about possible other applications - could this be used to monitor water levels inside a bore? Our bore has started running dry and I risk burning out my submersible pump each time. Devices like Pumptec protection are expensive. With integration into HA can you see a reason the pump couldn't be shut down when bore levels get low and approach the pump? (float switches are too cumbersome to get down a 4" borehole). Cheers, John.

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

      @@lensman893 Hi John. You _could_ technically do it, but I am not sure of all the variables. The strain on the cables could be great, depending on the depth of the bore. In terms of HA, it can absolutely work. Sound pretty simple really.
      Again, the new sensor I am trying out could be a better option. That video should hopefully be out in a few weeks.

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

    for a 150 psi sensor, is it accurate to measure a 2m height tank with a maximum pressure of 2.4psi ?

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

      In this case, yes. You get about 6 decimal places of accuracy on the voltage, and if you take a median value over a window of a couple of hours, then you get a pretty accurate measurement. Having said that I have done a V2 of the setup using a different sensor and Shelly Uni on three of the four tanks. That video is here: th-cam.com/video/N90C9Xge8Z4/w-d-xo.html

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

    Corrrect me if wrong here: The sensor you're using requires 5v power supply, but M5 (if using ESP32?) will output 3.3v max, are you accounting for that? I'm certain you won't be getting the pressure required to get over 3.3v (obviously judging from your screen readings too). I'm wondering if it just works anyway? The sensor your're using appears a lot cheaper than the ones I've been using.
    Respect for this great video btw!

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

      Great question Justin. You are right....and not. The sensor is indeed 5V, but the bore tank sensor is still running strong after 2 years. I have seen other implementations same as mine that also works. Now, you are right that I can't get more than 3.3V out, but that works fine in this case too. With 150PSI I will never get anywhere near 3V.
      However, I didn't like this entirely either, so I have done a v2.0 with a Shelly Uni and a 12V sensor and power supply: th-cam.com/video/N90C9Xge8Z4/w-d-xo.html

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

      @@LarsKlintTech Thank you, being able to run one of these sensors on 3.3v is a game changer for me; much appreciated ! I enjoyed your other video too; seems like you're not only making super helpful videos, but from the comment section creating a helpful community too. Respect.

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

      @@JustinShaedo You are most welcome Justin. The community part of this channel is a large part of why I keep going. I learn a ton, and hope to give some of it back, and of course I enjoy the creation of the videos too 😊

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

    How accurate would pressure sensor work for 55 gallon water drums I catch rain into? Once full, I will pump qty5 of them to 700gallon holding tank.

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

      It should work just fine. The main interference is from atmospheric pressure, or if there is water flowing in and out of the tank (such as with a tap being opened). I would suggest getting a 5, 10 or 15psi pressure transducer though, as that will make the voltage more accurate than a 100 or 150 psi model.

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

      Only time 55 gallons fill is rain which this yr was very little. It sits unless it is garden time and watering. Also transfer small full barrels to hold tank. Hmmm
      U have Facebook?

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

      U have no idea how humbled I am for your response. I need this in a big way!

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

      @@smartassist9700 No worries at all. Thanks for watching and being part of the channel. I appreciate it.

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

    Please take the time to explain the process to get it working with sensor and with the hub

    • @LarsKlintTech
      @LarsKlintTech  3 ปีที่แล้ว

      As I mention in the video, Tatham has a great video on connecting it all through ESP home and coding the YAML parts. th-cam.com/video/lc5cv6X7bXk/w-d-xo.html
      Check that out first 😊

    • @almq1825
      @almq1825 3 ปีที่แล้ว +3

      @@LarsKlintTech Yah I went there first but Tatham video was a bit advanced for me as I'm new to IoTs. Anyway, great video see if have the time to show step by step guide in future almost nobody implemented the same device in such a way as you did witch is quite helpful to many as some devices in the market sells for almost 500$ for tank level monitoring.

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

    Awesome stuff , could you please provide the pressure sensor yaml file for esp home please? Im not very good with scratch configuration. I know your friend made a video about how to use esp home but I would be using the same sensors as you so it would be almost exactly the same setup.

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

      Hi Roma. There is real value in having an understanding of what each value in the YAML does, as it makes so much easier to troubleshoot and debug anything that isn't quite working right. Having said that, my config values for the pressure sensor are
      substitutions:
      device_name: water_pressure_sensor
      friendly_name: Water Pressure Sensor
      esphome:
      name: water_pressure_sensor
      platform: ESP32
      board: m5stack-core-esp32
      wifi:
      ssid: !secret wifi_ssid
      password: !secret wifi_password
      # Enable fallback hotspot (captive portal) in case wifi connection fails
      ap:
      ssid: Fallback ${friendly_name}
      manual_ip:
      static_ip: 192.168.1.210
      gateway: 192.168.1.1
      subnet: 255.255.255.0
      captive_portal:
      # Enable logging
      logger:
      # Enable Home Assistant API
      api:
      password: !secret esphome_secret
      ota:
      password: !secret esphome_secret
      light:
      - platform: fastled_clockless
      chipset: WS2812B
      pin: 27
      num_leds: 1
      rgb_order: GRB
      id: status_led
      name: ${friendly_name} Light
      effects:
      - random:
      - flicker:
      - addressable_rainbow:
      binary_sensor:
      - platform: gpio
      pin:
      number: 39
      inverted: true
      name: ${friendly_name} Button
      on_press:
      then:
      - light.toggle: status_led
      sensor:
      - platform: adc
      pin: 33
      name: ${friendly_name} Voltage
      update_interval: 30s
      icon: "mdi:water-percent"
      accuracy_decimals: 5
      attenuation: 11db
      filters:
      - median:
      window_size: 200
      send_every: 10
      send_first_at: 4

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

      @@LarsKlintTech thank you very much! I have a catchment water tank and plan on using this setup!

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

    Hi Lars,
    Thanks for this good video ... In my case i have a 5000 Litres tank ...How will you calculate for this ? .... I have a ESP826 board with the pressure sensor at the bottom as shown on your first setup

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

      You need the height and diameter of the tank to get the math to work. See my reply to the comment from Wouter Meeus for more information.

    • @sylvaish
      @sylvaish 2 ปีที่แล้ว

      @@LarsKlintTech Thanks for the reply .... I have a ESP836 board will this work with your config setup or only for the M5Stack Atom Lite

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

      @@sylvaish I am not familiar with that board. Have you got a link?

    • @sylvaish
      @sylvaish 2 ปีที่แล้ว

      @@LarsKlintTech For some reason the link is been removed ... But if you google ESP8266 Development board... You should be able to see it

    • @LarsKlintTech
      @LarsKlintTech  2 ปีที่แล้ว

      @@sylvaish I know the ESP8266 Development board, but you said ESP836?

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

    This is exactly the guide I have been looking for. Thank you from rural Victoria!
    Our tanks are all full at the moment, would you happen to know how to calculate litres from the voltage when full?
    Maths was never my strong point but I’m up for the challenge. Any hints would be appreciated.
    Cheers

    • @LarsKlintTech
      @LarsKlintTech  3 ปีที่แล้ว

      Hi Dale. You're welcome, also from rural Victoria 😁
      Have a look at my reply to Wouter's question here, and see if that answers your question. It should be the same approach.

  • @mohamedhamdan5209
    @mohamedhamdan5209 2 ปีที่แล้ว

    Thank you so much for the tutorial, I was looking for this a long time ago, I have a question, I wrote this template to get the level as a percentage from 1-100, am I correct or I'm missing something here?
    {% set voltage = states('sensor.tank_water_pressure_voltage') | float %}
    {% set emptyVoltage = 0.15723 | float %}
    {% set fullVoltage = 0.16602 | float %}
    {{ ((voltage - emptyVoltage ) * 100) / (fullVoltage - emptyVoltage ) }}

    • @LarsKlintTech
      @LarsKlintTech  2 ปีที่แล้ว

      I would have thought {{ (voltage / fullVoltage) * 100 }} should do it.

    • @mohamedhamdan5209
      @mohamedhamdan5209 2 ปีที่แล้ว

      ​@@LarsKlintTech Thank you, that works, but what's the difference between this and your way? because using this way you can also calculate the liters, sorry for a lot of questions 😅 But I want to prove to my mother that it is working fine, I haven't reached this stage yet

    • @LarsKlintTech
      @LarsKlintTech  2 ปีที่แล้ว

      @@mohamedhamdan5209 Not sure what you mean. I also calculate the litres in the video. Check out the reply to Wouters in the comments here too where I outline the process.

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

    Great video Lars! There is not much out there documented with using pressure sensors and water tank level monitoring (looks like the go to is ultrasonics)
    Is there any chance you could share a sanitised version of your M5 Yaml? Im currently looking at doing something simular using a commercially available 4-20ma submersable pressure sensor in the same way you are but with a WeMos D1R2 and a few other sensors (lightning tracker ect)
    Edit: nm i found what i needed in another post below. either way thank you for the great video!

    • @LarsKlintTech
      @LarsKlintTech  2 ปีที่แล้ว

      No worries Rodney. Happy you got it sorted. Keen to see your setup and solution too 😊

  • @chaitanyajagtap5376
    @chaitanyajagtap5376 2 ปีที่แล้ว

    I watched this video but I can understand the code on the second channel also can you provide me the code for educational use

    • @LarsKlintTech
      @LarsKlintTech  2 ปีที่แล้ว

      I am not sure I understand what you are asking. Did you follow the steps in Tatham's video? Also, go through the comments on this video, as there are lots of conversation about the approach.

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

    Could you share your esphome yaml file?

    • @LarsKlintTech
      @LarsKlintTech  2 ปีที่แล้ว

      I have the sensors defined in the confiuration.yaml currently. Which values are you interested in? At 12:23 I show all the tank sensor yaml config values.

    • @mohamedhamdan5209
      @mohamedhamdan5209 2 ปีที่แล้ว

      @@LarsKlintTech I'm intersting in esphome configuration, I mean this part
      sensor:
      - platform: adc
      pin: A0
      name: "Tank water level"
      accuracy_decimals: 5
      unit_of_measurement: "V"
      icon: "mdi:water-percent"
      update_interval: 1s
      I want to know how you used the median function from esphome

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

      @@mohamedhamdan5209 These are my yaml values
      sensor:
      - platform: adc
      pin: 33
      name: ${friendly_name} Voltage
      update_interval: 30s
      icon: "mdi:water-percent"
      accuracy_decimals: 5
      attenuation: 11db
      filters:
      - median:
      window_size: 200
      send_every: 10
      send_first_at: 4

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

    "Pipebomb....not....NOt!! lol....

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

      Thought I'd better clarify 😂

  • @sandrahajda3027
    @sandrahajda3027 3 ปีที่แล้ว

    You looked scary when you introduced the setup (last moment microexpression).

  • @permport
    @permport 2 ปีที่แล้ว

    Thank you again for this video. I receive Voltage-measurements in HA.
    I added the code in my configuration.yaml but I don't see how to add the liters in the overview dashboard.
    (I know it is a small water volume but it is ground water. )
    The sensor I see in HA is: sensor.waterput_voltage (-> what shows the measurement of the voltage)
    config.yaml:
    sensor:
    - platform: template
    sensors:
    waterput_volume:
    value_template: >
    {% set radius = 0.5 %}
    {% set height = 2.5 %}
    {{ ((3.14159265359 * radius * radius * height) * 1000) | round 0) }}
    unit_of_measurement: l
    friendly_name: Voorraad grondwater
    waterput_liters:
    value_template: >
    {% set voltage = states('sensor.waterput_voltage') | float %}
    {{ ((voltage - 0.41) * 1800) | round(0) }}
    My Atom-lite config:
    #niveau grondwater
    sensor:
    - platform: adc
    pin: 33
    name: ${friendly_name} Voltage
    update_interval: 120s
    icon: "mdi:water-percent"
    accuracy_decimals: 5
    attenuation: 11db
    filters:
    - median:
    window_size: 200
    send_every: 10
    send_first_at: 4

    • @LarsKlintTech
      @LarsKlintTech  2 ปีที่แล้ว

      Do you mean you don't see the output as a sensor in HA, or how to add the HA lovelace card to show the litres?

    • @permport
      @permport 2 ปีที่แล้ว

      @@LarsKlintTech indeed, I mean how to add the HA lovelace card to show the litres.

    • @LarsKlintTech
      @LarsKlintTech  2 ปีที่แล้ว

      @@permport You should also see a sensor called "sensor.waterput_liters". If not, your YAML might not be accurate.

    • @permport
      @permport 2 ปีที่แล้ว

      @@LarsKlintTech thank you for the reply. I typed it in my yaml like yours. It's really difficult yet is seems so easy.

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

      @@LarsKlintTech I reduced my above code to:
      sensor:
      - platform: template
      sensors:
      # waterput_volume:
      # value_template: >
      # {% set radius = 0.5 %}
      # {% set height = 2.5 %}
      # {{ ((3.14159265359 * radius * radius * height) * 1000) | round 0) }}
      # unit_of_measurement: l
      # friendly_name: Voorraad grondwater
      waterput_liters:
      value_template: >
      {% set voltage = states('sensor.waterput_voltage') | float %}
      {{ ((voltage - 0.41) * 1800) | round(0) }}
      unit_of_measurement: l
      friendly_name: Voorraad grondwater
      Because the first part was the formula to calculate the volume. Since this is a static value, I commented it and now I have the sensor.waterput_liters.