ESP8266 Plant Watering

Prevents plants death by controling water levels.

Similar projects worth following
Over the summer month I am usual not at home, I I have a plant, wich needs at least wawter every week so this project is to solve this. I am using an ESP8266 to open & close a valve and also messure the resistence of the soil to know when to water.

The main goals of this project are:

  • keep the plant alive
  • use as little power as possible
  • notify me via internet if power/water runs low
  • log temp, humidity, soil resistence
  • one charge should last atleast 28 days

Currently I use an ESP8266 and programm it with Arduino. The whole thing should run on battery power.

Maybe if everything works I will try to add a solar panerl for battery recharging.

plant watering circuit.png

Clean Version of circuit done with EAGLE

Portable Network Graphics (PNG) - 24.86 kB - 04/04/2019 at 17:57



The currently used circuit layout. It is very simple so I hope you will get the gist out of this handdrawing.

JPEG Image - 603.04 kB - 02/20/2019 at 10:45


  • 1 × ESP8266 Adadruit HUZZA Feather ESP8266
  • 1 × Step Motor daypower S-SPSM-5V
  • 1 × 1F Capacitor Goldcap, 1F, 5.5V, RM5

  • Power reduction

    MCenderdragon01/12/2020 at 13:52 0 comments

    My NE555 had a power consumption of ~4mA. This was an improvement compared to the powerdown of the ESP8266, but still not good enough. Another problem is, if the ESP finishes earlier and goes powerdown the 555 can not react to this, so we have a high power consumption.

    Since Christmas I have some AtTiny13 chips and by using them I can further reduce power consumption. With a little program I wrote I have the same timings but I have also a power off pin. And it only uses 0.3mA which is a great improvement.

    Here is the SRC Code:

  • Working with a 555 timer

    MCenderdragon09/30/2019 at 12:50 0 comments

    I am still alive, kinda. Exams had taken alot of my time away and I used the past weeks to relax and get ready for the next semester.

    Anyway, since the EEPROM is working it is time to move to the next step: the external timing.

    Thanks to this site I got a formula to calculate the timings for the on and off states. 105 + 1645 seconds is 29.17 minutes so almost half an hour. I have found a website named timezonedb, and it has a relay good API to get timestamps so I will use that to get the real time the timer needs to turn the chip on and off. The website returns a json obj so I am using ArduinoJson from bblanchon.


    I messured the time with the timestamps (results where 1569857598 and 1569855755). This means it tackes 1843 seconds (30 min 43 seconds) to do a cycle instead of 1750 seconds (29 min 10 seconds).

  • The EEPROM is working (finaly)

    MCenderdragon07/24/2019 at 12:46 0 comments

    This step took way longer then I exoetced. First of I still dont know if the chip was broken or the wirring was wrong but after recabling everything and replacing the chip everything worked as intendet. Getting the communication right was a bit tricky and needed some trial and error as the spec sheet was sometimes not clear enough.

    This is the little program I made to test everything:

  • The EEPROM arrived!

    MCenderdragon05/23/2019 at 17:47 0 comments

    Last weekend the EEPROM 25AA010A arrived. And since Monday I am now trying to communicate via SPI with it, with limited success so far. The IC does respond, somehow. I get for supported command a 255 and for not supported ones 0. The thing is the read status message also retunes 0, even after I did the "write enable" procedure to set the Write enable bit high. I do not know if I am reading the status wrong or if I did the write enable procedure wrong. Reading from adress returns always 255. Writing has not worked so far, so most likely getting always 0 as status is correct.

    If one of you wants to ask if I checked the clock speed, bitorder and spi mode: yes I did, in fact I am looping over every possible configuration and doing the the same thing while printing the results. Most promising is MSBFIRST and spi mode 0.

    If anyone wants to know what I am doing:, feel free to try to find the error I made :P

    Hold pin is pulled up to +3.3V, MISO and SO, MOSI and SI, CLK and CLK, GPIO4 and WP, and GPIO0 and chip select are connected.

  • Some More Problems I have to fix

    MCenderdragon05/13/2019 at 11:40 0 comments

    I noticed a mistake I made in the EEPROM lifespan calculation, each value is only measured every 24 hours. If I use something like an offset counter that would have to get refresh every hour but if I just clear all the values after sending them to the server I can reduce the writes to twice a day so 2/24h. 1m/ 2 are 500.000 days which are 1368 years. So that will work.

    After the power down I unplugged the ESP8266 and all other components so the battery could charge via solar power. I also directly connected the solar panel and the battery since the power breaks down to ~5V if enough current flows. I did add a diode in between to ensure there is no backflow, the voltage drop is roughly 1V so the battery is not in danger (at least I hope so). Today the charging LED is no longer on, so the battery is full.

    My last post was at the 26th (about the power down) this means it took 17 days to recharge. The Battery has 3000mAh at 5V. 17 days are 408 hours. 3000mAh / 408h = 7.3mA . We can double that at day to 14mA and at night we got 0mAh. This means we have to use less than 176mAh per day.

    Another major problem is: the soil resistance is very inaccurate. I think one of the wires is broken or the electrodes (steel screws) have connection issues. If the sensor is never detection water, I will probably just drown my plant, so that needs fixing.

    I have not digged to deeply into SPI which the ESP8266 yet but I did a lot of SPI projects with the STM32F4 and STM32F3 so I hope its not that hard.

  • The Power went out

    MCenderdragon04/26/2019 at 10:34 0 comments

    After about 3 weeks (I don't know exactly by I documented the dates here somewhere) I started with a full battery and solar power. The last few days were sunny but still yesterday to power for the microcontroller went out. It also produced weird sensor values the days before so I guess the power supply was instable. Two days ago the microcontroller also was in a weird state were the power led was very slightly on and the wifi led on full power for several minuets. This means there are also software bug/edge cases I have to take care of.

    I have reviewed FLASH, EEPROM and FRAM a bit more and FRAM would be ideal but as they are quite pricey I will go with an extern EEPROM for now. The one I am going to use (25AA010A) is rated for 1M write cycles, so if I use the same cells over and over again (which I will not do) this means 24 writes per day. 1M/24 means 41,666 which are about 114 years. So this will probably outlive me. Even if I first clear the EEPROM this means 48 writes per day so only 57 years which is still good enough.

  • Solarpower test results

    MCenderdragon04/16/2019 at 09:39 0 comments

    I have not charged the battery since 12 days, which means the setup is working. I have measured the output voltages a bit and noticed at around 8 am is enough sunlight for the DCDC converter to get started, but since the voltage drops when load is connected the 7 V base output drop down to under 4 V and DCDC fails to start. By simply unplugging and replugging the solarpanel the DCDC starts working. At around 9 am the power generated is enough so the DCDC starts on its own, but we are wasting an hour of sunlight here. During summer this can be ignored, but not during winter. So ideally I would need something like a switch or a timer which unplugs everything regularly if not enough power is outputted at the 5 V line.

    I also tried to direct the solarpower directly to the board when it is not enough for DCDC. With the help of our community (

    I had the following idea:

    When the DCDC outputs 5 V the MOSFETS opens and pulls the the Q1 MOSFET to ground and thus closing it, when no power is there the gate is pulled high and thus the mosfet is open. This setup is basically a P-Type depletion mode MOSFET, but build with N-Type enhancing MOSFETS since the P DMOSFTES and rare and pricey.
    The circuit works, but not very good. The solarinput I get is around 4 V, but the output of Q1 is only about 2.2V and it outputs near zero current, so this is not really what I wanted at all.
    If I can find a good low power be state relay, I will test that but until then I would leave the solar power part as it is.

    Lowering Standby Energy
    I did not yet decide if I want to use an SD card or an F-RAM chip. FRAM is build for low-power but I can not read it myself. And SD needs more power but I can confirm the data with my PC. Most likely the FRAM chip is more easy to implement since it is just an SPI connection where I write & read some bits into some registers.

    The Watering Mechanism
    Something I kind of avoided this far is the actual watering of the plant. Currently the system is a WIFI connected thermometer but nothing really more. The thing I have to keep in mind are:

    • Monitoring the water levels of the external tank
    • Even when if power runs out, I don't want to flood the plant
    • Needing little energy to trigger the watering mechanism

    Honestly I have no Idea how I can achieve all of the above points, I am good with software but not with mechanical engineering. A pump will most likely need way to much energy. This means the tank need to be already above the plant, gravity can do the rest.

  • Adding some solar power

    MCenderdragon04/04/2019 at 13:35 0 comments

    I had two ideas how I can increase the lifetime of the whole system. First, I can add a solar panel to charge the powerbank, this will increase the lifespan of the whole system. Second, I am building my own external timer two completly shutdown the ESP board will all its components.

    The Solarpanel Idea

    This is my current circuit to stabilize the output from the solarpanel to charge the powerbank. The solarpnale outputs somewhat between 0-8V, I feed that into a DC/DC to convert it to 5V and use that to charge the powerbank.

    The charging lamp is on so I guess it is working.

    All is 5V so I will use Ah instead og Wh or J. If the system needs 10mA at most this will be 240mAh per day, So if I get 50mA over about 5h it will be enough to operate for that day. The only window I have is facing west, so we can say we got 2h at most, lets say it still has gets 100mA somehow, so we have 200mAh. Lets say the ESP only needs 6mA (min I mesured), so we have 144mAh per day.

    It can work, I have to see how long the system keeps runningn until it runs out of energy again... It will atleast runs longer than 7 days, so we have an improvment here.

    External Timer

    Completly shutting of the ESP8266 has tha major problem of data loose. Currently I am using the volatile memory which will be held as long as the ESP gets some juice, but as long as its unpowered for more the an hour the data is lost. A good low power solution seems to FRAM, I could also use an SD card, but they tend to need more power.

    Most likely the external timer will be an NE555. If I get the timing to be about 50min off and 10min on, I can execute longer operatipns (like uploading all the data, or actually watering the plant). To still save energy I can use deep sleep. Actual experimenting will most likely proof better timings.

  • Result of some Digging

    MCenderdragon02/28/2019 at 14:27 0 comments

    First of all: this the first time I used an Adafruit product and while it costs more comporaed to other sites I am glad I did purchase it there for the followin reasons:

    At the downlaod page everything is linked, the shamatics the PCB files and also th datasheets of the components.

    I did dig around the the ESP8266 itself only draws ~20µA while in deepSLeep but as there are also other components on the board the current piles up. The 3.3V regulator has an EN pin to disable it.

    Powering the board via 3.3V with 3.3V regulator enabled: 6.8mA

    without 3.3V regulator: 9.5mA without resistor and with 100k resistor 6.7mA, but then it seemed like the regulator was still working.

    Without damaging the board there is not realy a way to disable the USB-Serial converter nor the LiPo charger, without them maybe we could get low enough.

  • Power Management

    MCenderdragon02/12/2019 at 14:18 0 comments

    I have come to the point where the system failes due to power loss. THis happens approxiemntly once a week. It is also winter so it is also colder in the room decresing the battery output a little.

    That is why I hocked a Ampmeter between the battery and the ESP to test how much it realy needs. 6.4mA. According to alot of papers and websites deep sleep shoud need ~20µA so 0.02 mA. WHile testing it jumped around a little, so it neeeds about 20mA +/- 6mA for basic operation (reading the sensors) and 150mA when WIFI is active and its sending something. since sensor reading and wifi is only active of some seconds, the "off" power draw is may to high.

    I will dig into this, I am currently using a USB power bank as an energy source so maybe th 5V to 3.3V converter uses the 6mA. Also I have to unwire everything to check if any external circuit is causing this.

View all 12 project logs

Enjoy this project?



Gary Stenzel wrote 03/18/2019 at 02:57 point

I really like where you are going with this. Do you have a better circuit diagram I could look at?

  Are you sure? yes | no

MCenderdragon wrote 04/04/2019 at 17:59 point

Thanks :) I just added a clean version of the circuit.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates