Smart Plant Waterer


Arduino based smart plant-watering device

Created June 2020
Arduino
Sensors
PCB
Plants

Intro

This PCB was designed for an indoor plant project and consists of an Arduino, relays, and external peripherals.

The placement and setup for such a device would be in close range to a garden bed and water storage of some sort. The two attached soil sensors can detect dry soil and trigger both the water pump and the coordinating valve to water a certain section of the garden bed. This PCB also supports a water level sensor that can trigger an external LED when the water storage is low.

Overall this is a very over-complicated solution to an indoor garden, but this project was more of an experiment with PCB design.

Materials

The majority of the items I used were left over from other projects. I ordered the PCB from JLC PCB & Ordered most PCB mounted components from their sister company LCSC. Many of the external peripherals were ordered from Amazon, with the exception of items that were recycled or reused.

PCB Construction Qty. Peripherals Qty.
Automated-Waterer PCB 1 5v-9v Water Pump 1
1000uF Capacitor 1 12v Water valve 2
5v Relay 3 Soil Moisture Sensor 2
Linear Switch 1 2.1mm x 5mm Female Barrel Plug 1
12v to 9v Voltage Regulator 1 Various lengths of wire -
5mm LED (1 Red, 5 Green) 6 2.1mm x 5mm 12v DC Wall Adapter 1
2x1 Terminal Block 1 Various Lengths of Tubing -
1x15 Female Pin Headers 4 Water Storage Container 1
1x2 Male Pin Headers 2 5mm LED (Red) 1
Resistors 6 Arduino Nano rev 3.0 1
1x2 JST-PH Connectors (M/F pair) 5
1x3 JST-PH Connectors (M/F pair) 2

Schematic

I originally sketched out the rough schematic by hand, then created it with the service EasyEDA.

The main flow of the schematic is that the microcontroller takes data from the soil moisture sensors and determines if the soil is too dry. If the threshold is met, the microcontroller triggers the correlating valve to open and the pump to turn on via the relays.

The mounted LEDs indicate which components are in use, while the external LED signals to the user if the water storage must be filled.

My logic for component placement was to locate items that needed a common connection near to eachother. Keeping this in mind, I tired to keep everything organized and give each item its respective space.

Left: PCB traces top, Center: PCB top Right: PCB bottom

* When designing this pcb, I only considered using through-hole mounted components.

Assembly

After setting up my soldering iron (Weller: WE1010), I secured the components to the pcb by bending the leads. Once the components were soldered on, I trimmed the excess leads.

Once everything was soldered into place, I tested the connections with my multimeter. I then applied power and further tested with my multimeter.

After I completed testing, I placed the Arduino Nano onto the pcb and connected all the peripherals and began to code.

Code

Before I could start coding, I needed to gather some test data from the soil moisture sensors. I used the file moistureData.ino to get some test data:

From this data I could determine a relative threshold from the soil sensor.

I layed out the correlating pins from the Arduino Nano and the PCB & assigned variables.

The initilization of the Nano in the setup() function:

Using pinMode() I initialized each pin to its respective function.

The main loop for the Nano in the loop() function:

The sensor values are taken with analogRead(), then mapped from the original range to [0 to 255], in order to correctly display to the LED.

The main function of the PCB will not execute if there is no water in storage. This waterlevel sensor consists of two wires near the bottom of the water storage tank. If there is no water, the wires will not conduct and the sensor will read 0. This failsafe holds its state until the water tank is refilled.

When there is enough water this code will execute. Each sensor value is checked to the threshold and if not satisfied the section is watered with the corresponding sequence.

This loop will wait for an hour before running again.

Results

As mentioned in the intro, this is all very overkill when it comes to watering plants.

There are definitely some parts of this project that need more work:

  • PCB Design
  • Pump & Valve function
  • Soil sensor threshold
  • A few more...

A quick note on the main points listed. This was my first PCB design, I know there are many improvements to be made. The pump was not always the strongest for certain lengths of tubing. The valves leaked because of a suffering design and the pressure was not pressing in the tubing. I could have done more tests for better efficiency and less over watering.

Overall, I did get healthy herbs that I was able to harvest many times this summer. I also learned a lot about PCBs, mixing electronics with water, and the process as a whole.