Project: Plant watering System (Standalone) in Progress

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Obstsalat
Normal user
Posts: 20
Joined: 06 May 2023, 12:03

Project: Plant watering System (Standalone) in Progress

#1 Post by Obstsalat » 18 May 2023, 14:58

Hello,

I`ve got here good Help and now i want give back some Stuff that someone can Help.
Excuse my english, it`s first time that i write a tutorial and then in english.

I wanted to create a little Watering System for my Plants because i am very forgetful and my Plants die. So i tried my best with the ESPEasy System and a ESP32.

For this Project i used this components:
  • ESP32 D1 mini (every device will work)
    Capacitive Soil Moisture Sensor (you have to look that you got the right one! more to that later)
    An mechanical waterproof endstop
    D4184 Dual Mosfet Breakout board
    Capacitor 6,3V 470mF
    10k resistor
    MP1584 DC/DC Step-Down regulator
    Battery Pack Li-Ion 18650 3S
    Cables, Connectors and a Perfboard
    12V Pump
    Li-Ion BMS 3S
    Switch or Jumper connector (for deactivate Deepsleep if you want Debug)
Things that are to do in the future:
  • Include Solar charger
    Voltage measuring for Battery Pack

So lets get started,
at first you can see my schematic (without BMS):
Schematic.jpg
Schematic.jpg (350.07 KiB) Viewed 1706 times
What is connected?

ESP GPIO 23 is connected to Dual Mosfet D4184 (trigger)
ESP GPIO 32 is connected to Water level sensor switch - GND>resistor 10k> GPIO 32 (corrected because wrong PIN)
ESP GPIO 33 is connected to Switch for Debugging ( i used it to deactivate Deepsleep - see code) - 3V3>switch input > switch output > GPIO 33
ESP GPIO 35 is connected to Soil Moisture Analog output


What ESPeasy Version i used?

ESP_Easy_mega_20230505_normal_ESP32_4M316k May 5 2023

You can use older Versions too because i use only the standard functions but its better to be UpToDate

Here are my Settings:

Config Tab:
Nothing special fill in your Network connection and dont change settings on "Sleep awake time or Sleep time"

Controllers:
I didnt have any Controllers running you can set one if you need.

Hardware:
Here i set under Wifi Status LED the setting to GPIO-2 and unchecked the Inversed Box because i unsoldered the Power LED, for better Battery saving.
Under GPIO 33 set to "Input Pulldown"
Under GPIO 32 set to "Input Pulldown"
All other settings on this site you dont have to change.

Devices:
Click here on "Add" in the first Row and set the "Device" to "Analog input -internal", now press Submit.
Give the device a "Name" (i wrote "feucht") you need to know later for the Code in the Rules.
After set Checkbox "Enabled" to Checked, on "Analog Pin" set the function to "ADC1 ch7 / GPIO-35".
"Attenuation" to 11db and "Oversampling" to Oversampling.
Scroll a little bit down you see a point "Two Point Calibration", set the checkbox "Calibration Enabled" to checked.
"Point 1" i set to 1700 = 100.000
"Point 2" i set to 2800 = 0.000
This is the range where my Soil Moisture sensor works i will tell later how to find out the range you need for you.
Now scroll down, you see there "Interval" write in the box 30.
The last setting is under Values, under Name write "igkeit" under Formula nothing, stats should be unchecked and under "Decimals" you can set a "2". Now press the Submit Button.

Tools:
Click on Advanced, a new page is loaded.
Here you have to set:
"Rules" Checked
"Enable Rules Cache" Checked
"Use NTP" Checked
"NTP Hostname: (you can fill it or not, for me i used "1.de.pool.ntp.org" if you not fill it ESP uses always standard setting automaticly "pool.ntp.org" (corrected see Post #5 by Ath)
"DST" Checkbox set to checked
"Timezone Offset (UTC+)" you need to now your UTC mine is "60" (corrected see Post #5 by Ath)
"Latitude" and "Longitude" set there the position of your home we need this for Sunset and Sunrise in the Rules later.
"Use Last Connected AP from RTC" Checked
All other settings should be stock.
Now press Submit

After this reload the site with the "F5" button on your keyboard.
You should see an new tab between Devices and Notifications its called "Rules", press on it.

Rules:
Here comes the Magic, place this code on "Rules Set 1" and if you need correct it with the values you need:

Code: Select all

On feucht#igkeit Do
If [feucht#igkeit] < 95 and %systime%>%sunrise% And %systime%<%sunrise+30m% And [Plugin#GPIO#Pinstate#32]=0
  GPIO,23,1
  TimerSet,1,10
  Elseif [feucht#igkeit] < 95 And %systime%>%sunset% And %systime%<%sunset+30m% And [Plugin#GPIO#Pinstate#32]=0
  GPIO,23,1
  TimerSet,1,10
  Elseif [feucht#igkeit] > 95 And %sunrise+30m%<%systime% And [Plugin#GPIO#Pinstate#33]=0
  GPIO,23,0
  DeepSleep,120
  Elseif [feucht#igkeit] > 95 And %sunset+30m%<%systime% And [Plugin#GPIO#Pinstate#33]=0
  GPIO,23,0
  DeepSleep,120
  Endif
  
 endon
 

  
On Rules#Timer=1 do
  GPIO,23,0
  
Endon
Now press the Save button.

So that´s Part 1 Part 2 follows
Last edited by Obstsalat on 18 May 2023, 23:42, edited 7 times in total.

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

Re: Project: Plant watering System (Standalone) in Progress

#2 Post by TD-er » 18 May 2023, 15:07

Not sure why this apparently seems to work:

Code: Select all

 And GPIO,34,0
 
You should use pinstate.

Code: Select all

 And [Plugin#GPIO#Pinstate#34]=0
 
See:
https://espeasy.readthedocs.io/en/lates ... ore-events

Obstsalat
Normal user
Posts: 20
Joined: 06 May 2023, 12:03

Re: Project: Plant watering System (Standalone) in Progress

#3 Post by Obstsalat » 18 May 2023, 15:16

Then i have correct:

Code: Select all

Elseif [feucht#igkeit] > 95 And %sunrise+30m%<%systime% And GPIO,33,0
  GPIO,23,0
  DeepSleep,120
  Elseif [feucht#igkeit] > 95 And %sunset+30m%<%systime% And GPIO,33,0
  GPIO,23,0
  DeepSleep,120
  Endif
to

Code: Select all

Elseif [feucht#igkeit] > 95 And %sunrise+30m%<%systime% And [Plugin#GPIO#Pinstate#33]=0
  GPIO,23,0
  DeepSleep,120
  Elseif [feucht#igkeit] > 95 And %sunset+30m%<%systime% And [Plugin#GPIO#Pinstate#33]=0
  GPIO,23,0
  DeepSleep,120
  Endif
Last edited by Obstsalat on 18 May 2023, 15:22, edited 1 time in total.

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

Re: Project: Plant watering System (Standalone) in Progress

#4 Post by TD-er » 18 May 2023, 15:18

Yes, "Gpio" is a command, not a value that can be evaluated.

User avatar
Ath
Normal user
Posts: 3508
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Project: Plant watering System (Standalone) in Progress

#5 Post by Ath » 18 May 2023, 16:30

Thanks for writing such elaborate story about your project :D

---------------
Obstsalat wrote: 18 May 2023, 14:58 Capacitive Soil Moisture Sensor (you have to look that you got the right one! more to that later)
ESPEasy also has support for 2 models of I2C Moisture sensors via P047 Environment - Soil moisture sensor, but to use that you will need to install any of the Collection builds or the Climate build. And of course it can be found in the MAX builds (when using an ESP32 with 16MB Flash).
Obstsalat wrote: 18 May 2023, 14:58 What ESPeasy Version i used?

ESP_Easy_mega_20230505_normal_ESP32_4M316k May 5 2023

You can use older Versions too because i use only the standard functions but its better to be UpToDate
Latest ESPEasy release at this time is actually 20230508... ;)
Obstsalat wrote: 18 May 2023, 14:58 Tools:
...
"Use NTP" Checked
"NTP Hostname: (you have to search for your NTP Host, for me i used "1.de.pool.ntp.org"
"Timezone Offset (UTC+)" you need to now your UTC mine is "120"
"Latitude" and "Longitude" set there the position of your home we need this for Sunset and Sunrise in the Rules later.
- You don't have to set the NTP Hostname, as that will be determined automatically via pool.ntp.org when this setting is left empty.

- The Timezone Offset is related to DST (Daylight Savings Time), as we are currently in Daylight Savings-mode, this value can be set to 60 and the DST checkbox enabled, so it will automatically adjust the time in March and October (not applicable to f.e. India where no DST is used).

---------------

NB: After a couple of days you won't be able to edit your post anymore (board policy, to prevent persistent spammers to later update their posts with spam that then won't be easily noticed by admins/moderators). :?
/Ton (PayPal.me)

Obstsalat
Normal user
Posts: 20
Joined: 06 May 2023, 12:03

Re: Project: Plant watering System (Standalone) in Progress

#6 Post by Obstsalat » 18 May 2023, 19:35

Hello, thank you for telling me.
I will correct these things in my Post so that it will be Clear.


Greetings Obstsalat

Obstsalat
Normal user
Posts: 20
Joined: 06 May 2023, 12:03

Re: Project: Plant watering System (Standalone) in Progress

#7 Post by Obstsalat » 18 May 2023, 23:35

Here comes the Part 2

First big Thanks to TD-er and Ath for corrections.

A little more information on the subject of soil moisture sensors.
I used the normal Capacitive Soil Moisture Sensors in the Analog style not with I2C.
Here you have to look very good if you got the right Sensors.
There is version 1.2 and 2.0 which doesn't mean that 2.0 is better.
There are three things to consider!

First Look that there is an TL555C IC on it, NE555 works only with 5V.
the TL555C works above 2V
Second under U2 you find many time only a 0-Ohm resistor this is bad, there had to be a 662K LDO you can see it in the Picture. This one reduces the Voltage from 5 to stable 3,3V. Thats good for a better measurement of your soil moisture.
Another and the last thing is that there is a missing Resistor in some cases for an faster and accurate reading you have to put a 1MOhm resistor between GND and AOUT.
soil.jpg
soil.jpg (77.86 KiB) Viewed 1653 times
If you need more informations about it, theres a cool guy on Youtube where i got these informations.
https://www.youtube.com/watch?v=IGP38bz-K48

What does this Software and Hardware actual do?

First of all, it works for you so that your plants don't die as long as you don't forget to fill up your water tank
The software with the assigned settings and the assigned rules checks the read parameters and works as follows:

First the ESP boots and try to connect to your Network.
Its set the NTP Time and looks for the actual Time and when is Sunrise/Sunset.
Now it takes readings from your Devices:
-is the Water Reservoir full?
-is the soil Moisture to Dry?
-Is the Time between Sunrise and a half hour later e.g. 7:21-7:51 In the morning

If These readings all true the ESP will Start Watering for about 10 Seconds then stops it and wait for about 20 second so that the water in the soil can be absorbed.
After this the ESP measure again and again until the moist is enough or the Water Reservoir is empty or half an hour has passed that is specified in the rules.
The same thing will happen at Sunset.

You can change these Settings for longer durations here:

Code: Select all

[feucht#igkeit] < 95 and %systime%>%sunrise% And %systime%<%sunrise+30m% And [Plugin#GPIO#Pinstate#32]=0
Change 30m to 60m for a Hour of watering. The number tells the minutes.

Important is that you have to change the [Device#Name] in Rules if you gave the Device under the "Hardware" tab another Name! Otherwise it won´t work!

Is there Everthing okay and the ESP has done his work it get`s to sleep.
It wakes up every 2 minutes and measure without watering (you can change that)

Code: Select all

DeepSleep,120
setting here in Seconds.

So you can if you want, transfer the data from the measurements to your home automation system via MQTT,FHEM, Home Assistant or more.

A little thing i used GPIO PIN 32 for better debugging, if you bridge it or set the switch to on, you disable the Deepsleep mode until you unbridge it or set the switch to off.

Thats all at the moment, the next things i will try on, is to measure the Battery Voltage.

Have a nice Day and sorry for my english

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

Re: Project: Plant watering System (Standalone) in Progress

#8 Post by TD-er » 19 May 2023, 00:02

Obstsalat wrote: 18 May 2023, 23:35 [...] and sorry for my english
Well your English is better than my German, so don't feel sorry :)

Post Reply

Who is online

Users browsing this forum: No registered users and 23 guests