Balcony garden watering and monitoring
Some of my friends have a garden on their balcony. And I wanted one too, but was worried about watering it when I'm on vacation. Also wouldn't it be nice if it could work outside the house?
My requirements were:
- Water the plants when they need it
- Work without a power cable
- Allow monitoring online
Here's how I solved them:
Measure soil moisture with sensors.
- Use capacitive moisture sensors as opposed to the ones that have metal probes - they erode by electrolysis carrying molecules from one probe to the other. This contaminates the soil and affects precision.
- Use multiple sensors in different parts of the pot.
- Take multiple probes over a short time and average them to smooth out anomalies and improve precision.
- Calibrate a threshold below which I would water.
Pump water from a 10L container.
- Place a 5V water pump at the bottom of the tank.
- Buy a watering hose and drippers (10 drippers over 2 long pots).
- Place tank near and at the same height as the plants
Use a solar panel to charge a battery to power the system.
- Deep sleep the device for half an hour to preserve energy.
- Wake it up for 10-15 seconds to water, measure and post data. It spends most of its time sleeping.
- A small solar panel supplying 600mA at 5V charges the 650mAh (~3.7V) LiPo battery multiple times over the sunny part of the day.
- Use a esp32 chip instead of a whole board as the board's USB chip draws power even if the MCU sleeps. This dropped the power consumption tremendously during deep sleep: from 25mA to 350uA - less than 2% of the original.
Design a PCB for the esp32 chip.
- Regulate power from the battery to 3.3V to power the chip.
- Use a MOSFET to allow powering the pump directly from the battery.
- Break out pins to connect solar panel, pump, battery, sensors and additional sensors in the future.
- Allow PCB to be used with Arduino Mini for other projects.
Connect to the wifi and post a message that will save data in a DB.
- Use the esp32 chip to connect to my wifi.
- Post a message with all the data using MQTT to AWS IoT.
- Process the message using a rule to store the data in DynamoDB (more on modelling data there in single-table design in DynamoDB).
Put together a simple website to show data on a timeline.
- When the website loads it makes a request to the API gateway that will call a Python lambda.
- The lambda queries all recent events from DB and formats them in json.
- Use a JS library to draw the graph/timeline.
Diagram of components:
Blueprint of the PCB:
Download PCB files
Improvements for next year:
- measure water level in tank
- make more devices and tanks and refactor website to show their data
- add a camera to take pictures of the plants by posting them to S3 through a lambda



