Introduction: Battery Powered Plant Watering
This is an indoor pot plant watering gadget with the following features.
- Neat self contained unit with reservoir and attached electronics
- Battery powered (rechargeable LIPO) with inbuilt charger
- Very low quiescent current (< 20uA) for long battery life
- Efficient pump only turned on for short periods again giving good battery life.
- 3 watering modes
- Regular intervals
- Automatic based on soil moisture sensing
- Weekly schedule
- Software can be updated via web interface
- Low cost
The pump used here is very small and cheap but can actually pump at quite a decent rate. I normally only turn it on for 0.5 to 1.5 seconds to get a decent pulse of water for pot plants.
Step 1: Components and Tools Needed
The following components are needed
- Plastic container for reservoir. I have used a 1.5 litre mouthwash bottle or even better a 2 litre plastic food jar
- ESP8266 module. I used an ESP-12F which has good deep sleep characteristics
- Small submersible aquarium water pump
- Tubing. I used some sheath from a co-ax cable which had the right diameter to fit tightly onto pump but suitable tubing can be bought.
- 18650 battery and battery holder
- LIPO micro USB charger
- Moisture detector for auto mode
- LDO low quiescent current 3.3V regulator. I used XC6203
- Resistors 4K7, 10K, 100K, 220K, 560K
- n channel MOSFET low threshold driver. I used AO3400
- Diode, 1N4148
- 220uF 6V Decoupling capacitor
- Small piece of pcb prototype board
- Slide Power switch
- Small push buttons (2) (6mm square)
- 2 3pin connectors for motor and moisture sensor
- Hook up wire
- 3D printed enclosure design available at https://www.thingiverse.com/thing:3005667
- Velcro to attach enclosure to reservoir, or hot glue could be used for permanent attachment. For the food jar version I hot glues to the lid.
The following tools are needed
- Fine Point soldering iron
- Hot glue gun
- Hobby Knife
Step 2: Operation
Important The outlet nozzle should be positioned higher than the reservoir water level. Otherwise once a pulse of water starts then siphoning can draw extra water through the pump even when the motor stops.
Once built and configured the module is totally automatic and will be in deep sleep most of the time.
It will periodically wake up, get the network time from ntp, and get the configuration and schedule.
In interval mode it will see if the configured interval has passed and if so will issue a pulse of water and then go back to sleep.
In moisture mode it will get a reading from the moisture sensor and if on the dry side of the configured threshold it will issue a pulse of water and go back to sleep.
In schedule mode it will do pulses of water at set times during a repeating weekly schedule. Any number of watering events can be set up each week.
As the unit is normally in deep sleep then one cannot access the device normally. However, one of the buttons on the unit acts as a sleep override. If the unit is turned off then back on with the override button held on then it will enter continuous mode (and the button can be released. In continuous mode one can access the unit by browsing to its ip address. Three tabs give access to the schedule, status and configuration.
The status page gives some basic information about its operation, current moisture level, time till next watering event and also a button to do a manual pulse of water.
The schedule page shows the current watering events. An event may be deleted and a new event added.
The config page allows the current configuration settings to be seen. They may be edited and then saved. The configuration items are
- waterMode - 1=Interval,2=Moisture, 4=Schedule
- waterInterval - Time in seconds between watering in Interval mode
- waterPulse - TIme in milliseconds to send a pulse of water
- moistureLevel - Trigger threshold for moisture watering
- schedule - Name of schedule file
- timeZone - TImeZone in hours
- minutesTimeZone - TIme zone minutes offset
- sleepInterval - Time in seconds to sleep between check (should be less than 3600)
In continuous mode one can also do a firmware update. If a new binary is prepared in Arduino then access ip/firmware to get a new upload dialogue.
In continuous mode one can also file browse the filing system on the module by accessing ip/edit One can get the config and schedule files and access the log of watering events.
To exit from continuous mode turn off power then turn on without the override button pressed.
Step 3: Electronics
Most of the electronics is a ESP8266 wifi microcontroller unit. A small amount of support electronics is needed to drive the pump motor, regulate battery to 3.3V, and support the sensors.The motor is driven using a small MOSFET transistor which is just pulsed on for short periods. A catching diode is used to supress any transients when the motor is turned off.
All the support electronics apart from the LIPO charger and the motor protection diode are mounted on the pcb prototype board. I use SMD components to keep this as small as possible but it could be done with lead-thru components as there is a reasonable amount of space available.
The LIPO charger has a micro USB port which may be used for recharging the battery.
The moisture sensor needs about 5mA of supply current which is provided from a GPIO pin so it may be turned off during sleep. The sensor gives from 0-3V output so this is divided down to feed the ADC on the ESP-12 module.
A slide power switch may be used to turn the power on and off. Two buttons are used for control. One allows overriding sleep mode when powering up which then allows web access for configuration and control. The other button is used for a manual pulse if started in non-sleep mode.
Step 4: Assembly
I did the following assembly steps this could be varied depending on the reservoir and electronics enclosure used.
- Prepare the reservoir. For the mouthwash container I sliced the top of my 1.5 litre bottle with a craft knife so that the top could be placed back on top and secured with tape. This gives access to mount the aquarium water pump. For the 2 litre food jar version I just drilled holes in lid for pump wire, hose, and a hole to fill with a funnel.
- Although the water pump is submersible I added extra hot glue around the cable entry to give extra protection.
- Attach suitable tubing to water pump output. I used a piece of co-ax cable sheath by pulling the core wire out.
- Hot glue the pump into the bottom of the reservoir.
- Make up the peripheral electronics on prototype circuit board.
- Attach prototype circuit board to esp-12F module (program this first .. see later)
- Hot glue usb charger module in place.
- Mount the power switch, 2 buttons, and 2 3 pin connectors and secure with resin glue.
- Complete interconnections between modules.
- Make up connectors to motor and moisture sensor. I use 3 pin ic socket pins. The motor has the supply to the outside pins and the motor switch in the middle so it is reversible. The moisture sensor uses all 3 pins so must be inserted the correct way. I use a red dot to indicate polarity.
Step 5: Software
The software for this project is available at github https://github.com/roberttidey/Autowater
It is an Arduino based project so set up an esp8266 Arduino development environment.
You may want to set the passwords for WifiManager and software update in the ino file to something more sensible.
The libraries used are included with the Arduino ESP8266 support except for
- wkScheduler - supplied in the git project
- NTPClient - used to get network time https://github.com/gmag11/NtpClient
- Time - supprt standard time access functions https://github.com/PaulStoffregen/Time
- wifiManager - used to set up IP configuration https://github.com/tzapu/WiFiManager
After adding the libraries the AutoWater IDE it should be compiled should be serial uploaded to the module. It is good to wire GPIO13 to GND in your development environment as the software will then be in continuous mode.
First time use will start an access point which should be connected to on a phone or tablet phone. See code for password. Browser on phone or tablet should then be used to access 192.168.4.1 which will allow selection of local wifi ssid and password. This only needs to be done once or if the wifi network changes. From then on the module will connect to local wifi network.
Some support files should also be uploaded. These are in the data folder of the git. They can be uploaded by accessing ip/upload. Once these have been uploaded then ip/edit may be used to do further upload in an easier fashion.
This is an entry in the