For a future video you may want to try the Sonoff "Zigbee Smart Water Valve". It also uses ESPhome and if you use MQTT you can monitor the water usage, set it by amount of water, time and with some coding soil moisture, battery, schedule... I just installed mine on my wife's garden/rain barrel/pond pump and works great. Currently I just set it to turn on 2X a day for 30 seconds (16 ounces each run). Next is MQTT and soil moisture checking, then rain forecast..... Great video you did
@MattOmondPrintbotOMO7 ай бұрын
Thank you so much for explaining that. I had everything working except that. Great project. Looking forward to making a few.
@UltraEd14 Жыл бұрын
Amazing work! I'm making my own and this saved me a lot of hassle
@TechDregs Жыл бұрын
Glad it helped.
@Rene04611 күн бұрын
normal water does not conduct like mineral salts or acid or hard ground water PH but great project.
@timogross819110 күн бұрын
It is not a conductive sensor, so the conductivity is not all that important. Probably calibration is needed anyway, the soil will have an influence on the readings. kzbin.info/www/bejne/o2HQlHaqmLucirs
@timderks59603 ай бұрын
Is there any update on this project? How is the battery life? How accurate are your readings? I'd be very interested in a follow up
@TechDregs3 ай бұрын
I can't speak to accuracy, as I have no other soil moisture measurement devices that use a different type of sensor. But since I reconfigured the sensor to draw power via GPIO that turns it off when in deep sleep, battery life is over four months on a charge. I did something like a followup in these videos: kzbin.info/www/bejne/ana9ioyGorahgLs kzbin.info/www/bejne/j6XXkqicbpl0ZpY
@timderks59603 ай бұрын
@@TechDregs Interesting videos, thanks!
@IF-VR123 Жыл бұрын
Thanks, this is great and exactly what I want to create. Would you be willing to share the design for the case and a link to the battery you used (for sizing)?
@TechDregs Жыл бұрын
I generally no longer share STLs for designs, but one thing that's helpful is that you can usually get STEP files for the SEEED Xiaos either directly from them or from grabcad. I wouldn't get this battery again, so I won't link it. I wasn't paying attention and ordered a 3-wire battery, and the third wire isn't useful (I think it's a thermistor in the battery for temp monitoring).
@tbandras3 ай бұрын
Thanks a lot for sharing your project! A quick question: the Xiao C3 is rated up until 3.6V whilst the battery is 3.7V (and I assume the voltage goes even higher, maybe lower 4.x when fully charged). Have you experienced any issues with it, should I be considered if I were to copy your setup with a 3.7V LiPo battery?
@TechDregs3 ай бұрын
Not sure where you're getting the 3.6V from, so IDK what to reference there. The Xiao is made for 3.7V LiPo batteries. The higher charged state voltages (~4.2V) are no problem; that's just how LiPo batteries are.
@tbandras3 ай бұрын
@@TechDregs it is under 4.2 Recommended Operating Conditions files.seeedstudio.com/wiki/Seeed-Studio-XIAO-ESP32/esp32-c3_datasheet.pdf But clearly your setup works, so it's probably a non-issue. :)
@TechDregs2 ай бұрын
That's power to the ESP32-C3 module itself. The battery is managed by a separate chip, and then ran through voltage regulators as output to the ESP32-C3 which never sees more than ~3.3V. You can see the power arrangement on the schematic: files.seeedstudio.com/wiki/XIAO_WiFi/Resources/Seeeduino-XIAO-ESP32C3-SCH.pdf
@l0gic23 Жыл бұрын
Pretty cool. +1 sub
@SuperMrZerox Жыл бұрын
Can Share all ? the project is amazing. I've been looking for something like this for a long time and now I'm grateful to you for showing it. can you show the wiring properly? Thx
@TechDregs Жыл бұрын
There's actually very little wiring. The battery is connected to the battery pads on the bottom of the board. I've got a voltage divider on the positive lead, with one side to ground and the other to an analog pin. The sensor board only has three wires: power in, ground, and sensor out. The sensor out just needs to go to an analog pin. The YAML is in the description; so you can see which pins I used there for the sensor and battery voltage readings. One trick that I have done since this video is powering the sensor from a digital GPIO pin, which I enable when the device wakes up and disable when it goes to sleep. That has a huge impact on battery life, as this sensor draws about 5mA when it's on.
@enriqueazvz8 ай бұрын
@@TechDregs great stuff. Would you have the YAML that includes the GPIO pin as the 'smart' power source for the sensor?
@TechDregs8 ай бұрын
I updated the details with the code. Basically, you just add onboot and onshutdown commands, and add the pin below as a switch. Make sure to change the GPIO to the pin you're using for power to the sensor. I also added a wifi signal sensor, since that can be useful to see.
@enriqueazvz6 ай бұрын
thanks@@TechDregs , I was implementing it on my side and apparently HA after 2023 requires the use of 'allow_other_users' if the same pin is used for several uses (battery life and battery voltage) I replaced pin: 4 for 'pin: number: 4 allow_other_uses: True'
@enriqueazvz6 ай бұрын
What code did you use to calibrate the moisture sensor? (so I can get my min and max values)
@havemannolaf9 ай бұрын
Thank you. i wil do it to. 😀
@DivinaFarms_James5 ай бұрын
How well did the capacitive sensor hold up?
@TechDregs5 ай бұрын
It's still going. I haven't looked at it closely in a while... it's just out there doing its job.
@lflondonol7 ай бұрын
This is my very first ESP32 project and I am trying to understand how to connect a 18650 battery to the board. How did you make the connection? Are you connecting it to the 5v pin?
@TechDregs7 ай бұрын
If you're using a Xiao, the battery connections are on the underside of the board. There are two pads there than you solder the battery connections to.
@MattOmondPrintbotOMO7 ай бұрын
Can you charge the battery via the Xiao or do you need to de solder and charge via a charger. Thanks/
@TechDregs7 ай бұрын
If you plug the Xiao into any USB port/charger, it will charge the battery. No need to desolder.
@niallbt2 ай бұрын
Do you have a github page or a written guide with wiring diagrams? I'm just getting started with ESP32 using batteries. Also, did you consider fitting a solar panel to this battery to keep it topped up?
@TechDregs2 ай бұрын
kzbin.info/www/bejne/j6XXkqicbpl0ZpY
@jebradleymd4 ай бұрын
I pasted your yaml code into the code for an ESP-D1 on Home Assistant and did a search and replace of the > and < markers as directed. When I run the "validate" on the code, I get the following error message: INFO ESPHome 2024.3.1 INFO Reading configuration /config/esphome/d1-1.yaml... ERROR Error while reading config: Invalid YAML syntax: while scanning a simple key in "/config/esphome/d1-1.yaml", line 61, column 9 could not find expected ':' in "/config/esphome/d1-1.yaml", line 62, column 9 I do not see anything where I would think a ":" would be needed.
@TechDregs4 ай бұрын
I'm not sure. It could be a spacing issue in your YAML or it could be a change to ESPHome that has occurred since I did this project. Lines 61/62 are in the WIFI setup for me, and I don't see any issues there, so I'm guessing it's in the lines above that somewhere. Just check all the indentation. I haven't updated mine in a while, but next time I do I'll update the code in the details.
@LorenzKort11 ай бұрын
Can you share the 3d printed design? I'd like to make my own :)
@Marco10101015 ай бұрын
Hello, I'm trying to make my yaml configuration, but I got this error: Pin 0 is used in multiple places. Could you help me? thanks in advance Failed config sensor.adc: [source :55] Pin 0 is used in multiple places. platform: adc pin: number: 0 mode: input: True output: False open_drain: False pullup: False pulldown: False inverted: False ignore_strapping_warning: False drive_strength: 20.0 name: Battery Life unit_of_measurement: % device_class: battery update_interval: 2s attenuation: 11db filters: - multiply: 2.0 - calibrate_polynomial: degree: 4 datapoints: - from: 3.4 to: 0.0 - from: 3.6 to: 8.43 - from: 3.81 to: 50.06 - from: 3.86 to: 57.63 - from: 3.92 to: 72.56 - from: 3.96 to: 90.96 - from: 4.05 to: 100.0 - lambda: !lambda |- if (x > 0) return 0; else if (x > 100) return 100; else return (x); disabled_by_default: False force_update: False accuracy_decimals: 2 state_class: measurement raw: False sensor.adc: [source :80] Pin 0 is used in multiple places. platform: adc pin: number: 0 mode: input: True output: False open_drain: False pullup: False pulldown: False inverted: False ignore_strapping_warning: False drive_strength: 20.0 name: Battery Voltage update_interval: 2s attenuation: 11db filters: - multiply: 2.0 disabled_by_default: False force_update: False unit_of_measurement: V accuracy_decimals: 2 device_class: voltage state_class: measurement raw: False
@TechDregs5 ай бұрын
You need to allow other uses. It's an update ESPHome has since I made this. Use it every time you setup a pin which is used more than once. pin: number: 0 allow_other_uses: True
@Marco10101015 ай бұрын
@@TechDregs grazie
@Marco10101016 ай бұрын
Hi, great job, what is the battery duration with that configuration?
@TechDregs6 ай бұрын
With the GPIO power setup, at least 4 months on a charge.
@Marco10101015 ай бұрын
Ok, my sensor is working, it reads 30 second and after 3h in deep sleep. But I have 2 questions. 1. It seems that the Voltage reading is not very accurate. I have calibrate the value Many times but after some reboot it reads 0.2 0.3 V more or less than the real battery value. I have used two resistor 220k in parallel. 2. How can I do to allowr home assistant to show in the dashboard the last value read when the esp32 is in deep sleep. Thanks in advance for any help.
@TechDregs5 ай бұрын
For #2, that should just show up automatically over time. For #1, battery voltage in my experience can fluctuate a bit, especially when it's above 4.0V. It seems to settle down and get smoother below that.
@kalabahaa2 ай бұрын
read esphome deepsleep page. While in deep sleep mode, the node will not do any work and not respond to any network traffic, even Over The Air updates. If the device’s entities are appearing as Unavailable while your device is actively sleeping, this component was likely added after the device was added to Home Assistant. To prevent this behavior, you can remove and re-add the device in Home Assistant. i think this should solve your problem.
@kherhitesh7 ай бұрын
nice video sir, i do as well as your code , but after update ESPHome platform - adc duplicate error show , so what to do any other way?
@TechDregs7 ай бұрын
Looks like mine died this week (I think water got into it), so I can't test this, but try replacing: pin: 4 with: pin: number: 4 inverted: false allow_other_uses: true In both places that it appears. See if that works. They implemented a change recently to break using a pin multiple times unless you specifically allow it.
@kherhitesh5 ай бұрын
@@TechDregs Thank you , New ESPhome update as well as working fine pin multiple
@tobias5612 ай бұрын
Thanks for the tutorial! But by Pasting your code i get the following error code: INFO ESPHome 2024.5.5 INFO Reading configuration /config/esphome/boden-feuchtigkeit-1.yaml... ERROR Error while reading config: Invalid YAML syntax: while scanning a simple key in "/config/esphome/boden-feuchtigkeit-1.yaml", line 16, column 1 could not find expected ':' in "/config/esphome/boden-feuchtigkeit-1.yaml", line 17, column 1 can someone help me out? Many thanks!
@TechDregs2 ай бұрын
Check your spacing. YAML is very sensitive to indentation.
@tobias5612 ай бұрын
@@TechDregsthanks. Will double ckeck I tried to ask chat gpt and it gave my this code. 👨🏼💻
@kherhitesh5 ай бұрын
how much battery life as well as your deep sleep time?
@TechDregs5 ай бұрын
I wake mine up for 10s every 6hours (so, 4x a day). The battery I used lasts ~3.5months on a charge.
@kherhitesh5 ай бұрын
@@TechDregs good battery backup 👍
@Marco10101015 ай бұрын
can you show me what kind of resin did you have use (black/gray)?
@TechDregs5 ай бұрын
It's just cheap basic epoxy from a local hardware store.
@pemlody9 ай бұрын
How long it runs at battery?
@TechDregs9 ай бұрын
Currently, it's been almost 4 months since I last charged it. It might last another month or two, looking at the voltage plots.
@SuperMrZerox Жыл бұрын
can you send the link of soil sensor and where did you get it connected. with my sensor only stupid values
@TechDregs Жыл бұрын
Did you calibrate your sensor values? You need to test what voltage it sends in open air and fully submerged in water. I used these: www.amazon.com/Capacitive-Moisture-Corrosion-Resistant-Detection/dp/B07SYBSHGX
@MattOmondPrintbotOMO7 ай бұрын
Would you be able to explain the switch code here. switch: - platform: gpio pin: GPIO10 id: sensor_power internal: true Sorry a noob. Have you got a switch wired into pin 10 thanks for a great project
@TechDregs7 ай бұрын
I'm using pin 10 to provide the power to the soil moisture sensor rather than wiring it directly to the output voltage pins on the ESP32 board. That allows me to turn power to the sensor on and off. This is the routine that sets up pin 10 as a power outlet that can be turned on and off (which ESPHome calls a switch). So, switch: - platform: GPIO tells ESPHome that this will be a binary on/off switch using a GPIO pin. ID: sensor_power is the internal name of that switch so I can refer to it elsewhere (like the boot and shutdown sequences). Internal: true means that it isn't exposed externally, so the switch won't show up in Home Assistant.
@MattOmondPrintbotOMO7 ай бұрын
Sorry just reading this again and doing a little Google I was un aware you could supply 3.5 volts from a gpio pin. Other than vin etc. am I misunderstanding. Probably 😢
@TechDregs7 ай бұрын
Depends on the pin. Some pins are input only. But GPIO pins can output about 40mA of current at 3.3v. There is also a total power budget that you have to stay under, but if you're only doing one or two pins of output, that's not a concern.
@MattOmondPrintbotOMO7 ай бұрын
Awesome thank you. Love to learn.
@MattOmondPrintbotOMO7 ай бұрын
@@TechDregs Pleas ignore this if you wish. I know you are not a help board. But I am curious. I have it all working. But when it goes into deep sleep it becomes unavailable on the dashboard. I have read on a few forums that it is best to change over to mqtt and then you can use birth and will_message. But I did a quick try and havn't been able to do the switch to mqtt. I am wondering if you have the same issue.
See ~2m in the video. Just taking a reading via a voltage divider to an analog pin on the Xiao.
@njain2686 Жыл бұрын
How will you charge it?
@TechDregs Жыл бұрын
I'll just pull it and charge it inside on a cell phone charger.
@dr.m.sanaullahsahar98598 ай бұрын
I can't see a link to your 3D printed parts. May i ask?
@TechDregs8 ай бұрын
Sorry, I generally no longer upload 3D prints. Too many of my past designs ended up being sold on ebay and etsy.
@MARY-si9gl2 ай бұрын
@@TechDregs Is it possible that you send me the 3D print file in an E-Mail? I will not sell the file. I just ordered a printer and i´m verry new in this material.
@rudopodkrivacky2 ай бұрын
@@TechDregs Thanks for the project also is it possible to connect the battery directly to the esp32 c3 supermini?, and is it possible to send the 3D print file by email? Of course, I will not move the file to the web. Well thank you
@TechDregs2 ай бұрын
@@rudopodkrivacky I don't the supermini has onboard battery management.