Smart Plant Watering Powered by a Solar Panel

About: Computer engineer.

This is an updated version of the my first SmartPlantWatering project (

Main differences with previous version:

1. Connects to and uses this site to publish captured data (temperature, humidity, light, etc) - my channel in ThingSpeaks -

2. Optimized to run on batteries. This version is using a solar panel to charge a 3.7v Lipo 18650 battery.

3. Adjust update frequency and watering based on weather (uses

4. Optimized code... uploaded to Github -



- ESP8266 NodeMCU

- DHT11 sensor (Temperature & Humidity)

- Relay

- Light sensor

- Box / Container

- Headers

- Water pump (12V)

- small diameter transparent clear soft hose (may vary based on your water pump connectors)

- 3.7 Lipo Battery

- TP4056 (battery charger)

- wires

- patience.... this is not complex.... but requires some time to do it, especially if it is the first time you are doing something with these components.. :)

Below you can find some graphs created on ThingSpeaks:

Next Plant watering (it shows remaining hours for watering)Water Level (litres in the water can)

Step 1: Step 1: Use This Schematic

Follow schematic and replicate this into the protoboard...

you need the following items:

1. Protoboard

2. ESP8266 NodeMCU

3. DHT11 sensor (Temperature & Humidity)

4. Relay

5. Light sensor

6. Water pump (12V)

7. small diameter transparent clear soft hose (may vary based on your water pump connectors)

Step 2: Working on the PCB - Weld Headers for ESP8266 and Sensors Based on Schematics

Use the schematic to replicate it into the PCB. In addition to the schematic above, I have added a TP 4056 to charge a Lipo Battery using a solar panel. You can use other battery charger cards if you prefer. Please use one that has protection for overcharging/discharging your battery.

if you use a 12v solar panel you need to add a step down to convert voltage to 5v. TP4046 does not support 12v as input.

These are the connections that I made to use a TP4056 to charge a Lipo battery and power an ESP8266 NodeMcu.

Solar panel (+) ->Step Down -> TP4056 (+)

Solar panel (-) -> Step Down -> TP4056 (-)

TP4056 (OUT +) -> ESP8266 (+) ; I have used a USB cable for this connection

TP4056 (OUT -) -> ESP8266 (-) ;

Step 3: Install Sensors and Place the PCB in a Box

I have used a plastic box that could be used outside to place the PCB card and the temperature/humidity sensor.

Step 4: Configure ThingSpeaks

In this version of the project I have used This site has a free and commercial version. I have used the free version and created a channel to upload the data captured by this project.

The idea is to collect information and visualize it through different graphs / gauge

First you need to create an account and then create a channel (if you have doubts on how to create the account or the channel, feel free to contact me)

Then you need to configure the channel using these settings. It's important you do the same fields configuration because I refer them in the code.

Step 5: Get the Code, Configure and Upload It

Visit the following Git repository

Download the code and install it into your ESP8266. The code is updated periodically but I am keeping it working with the same schematic that is being shared here. In this version, I am using ThingSpeaks for collecting data and generating graphs for visualization on Internet. Also the use of allows getting current weather and forecast for the city where you are located. This information is used to optimize the battery utilization if we expect to have some rainy days and the battery may not be fully charged.

Important!! - There are some settings in the code that need to be adjusted.

Look into the code and update the value for the following variables

- ThingSpeaks_KEY -- used for ThingSpeaks site

- openWeatherAPIid -- used to get current weather information and forecast for upcoming days.

- openWeatherAPIappid -- used to get current weather information and forecast for upcoming days

If you like the code, please Star it in GitHub!. Thank you!

Step 6: Prepare the Water Jerry Can & Water Pump

You can use any water jerry can you have. I have used a 10 litres water jerry can so it has enough autonomy for a couple of weeks.

The water pump is 12v (1A) so I connect it directly to an external power source. You can also use a 5v water pump and maybe try to power it with the same battery used to the ESP8266. I haven't tried that yet, but that could be an idea for another phase of this project.

Step 7: Connect It and Start Getting Information Through

Once connected, your ESP8266 will submit data to and you can visualize graphs and data. Also your plants will be watered every day and it will adjust how much water needed based on the temperature/humidity.

Please check my channel for live data -



    • Make it Glow Contest 2018

      Make it Glow Contest 2018
    • Plastics Contest

      Plastics Contest
    • Optics Contest

      Optics Contest