Arduino Soil Moisture Monitoring Stick - Never Forget to Water Your Plants
by thediylife in Circuits > Arduino
4669 Views, 45 Favorites, 0 Comments
Arduino Soil Moisture Monitoring Stick - Never Forget to Water Your Plants
Do you often forget to water your indoor plants? Or perhaps you give them too much attention and over water them?
If you do, then you should make yourself a battery-powered soil moisture monitoring stick. This monitor uses a capacitive soil moisture sensor and a 3.3V Arduino Pro Mini to continuously monitor the soil moisture level and alert you when you're over or under watering your plants.
Two potentiometers on the board allow you to adjust and set a high and low moisture level setpoint which trigger the flashing of two LEDs to alert you. You can also easily add a buzzer to the circuit if you'd like an audible alarm as well.
You can also push a button to display the current moisture reading and the high and low level setpoints on the built-in OLED display.
With the standard setup here, the unit lasts around 15-20 days on a single charge of the 18650 battery powering it. But, by using two low power techniques, this can be extended to around 50-60 days per charge.
Supplies
To build one soil moisture monitor, you'll need:
- 3.3V Arduino Pro Mini – Buy Here
The 5V Version Can Be Used With A Different Battery & 220Ω LED Resistors
- USB Programmer - Buy Here
- Capacitive Soil Moisture Sensor – Buy Here
- 3 x 5mm LEDs (Preferably Different Colours) – Buy Here
- 10K Resistor – Buy Here
- 3 x 100Ω Resistors – Buy Here
- 2 x 10K Trim Pots - Buy Here
- Tactile Pushbutton Switch – Buy Here
- Slide Power Switch – Buy Here
- 128x32 I2C OLED Display – Buy Here
- Male Header Pins – Buy Here
- Female Header Pins – Buy Here
- Ribbon Cable - Buy Here
To Power The Monitor
Gather Your Components & Order the PCBs
I started out by designing a circuit which could be made into a PCB and powered by a single 18650 lithium-ion battery. For this reason, I chose the 3.3V version of the Arduino and this particular capacitive soil moisture monitor which can be powered from 3.3V or 5V.
You can download the PCB files from my blog if you'd like to order your own.
You can also use a 5V Arduino Pro Mini with the same components, you'll just need to use 220ohm LED resistors instead of the 100ohm ones used here. You'll also need to power it with a battery pack rather than the single lithium-ion battery.
You can also assemble the components onto a breadboard and then make a short lead to the moisture sensor, but the PCB just makes it into a more compact and robust setup.
I ordered the PCBs from PCB Way which charges only $5 for 5 basic PCBs up to 100x100mm. They were manufactured and shipped out really quickly and are of great quality as well.
Assemble the PCBs
Start by attaching your header pins to your Arduino. This design makes use of the A4 and A5 pins for the I2C connection to the OLED display, so you'll need to add these two pins as well. The boards often don't come with pins for these two as they're separated from the strips along the two sides.
Solder all of the components into place on the PCB, paying attention to the orientation of the LEDs and the tactile pushbutton.
In order to connect the moisture sensor to your board, you'll need to remove the white plug on the end and then solder three header pins into the row of holes closest to the end of the sensor. Use these pins to solder the sensor directly onto your PCB.
Once your components are all soldered in place, trim any protruding pins from the back of the PCB.
Solder the lithium-ion battery charger board to the power terminals on the PCB using a small ribbon cable lead so that the holder can be glued onto the back of the PCB.
Program Your Arduino
In order to program your Arduino Pro Mini, you'll need to use your USB programmer and plug it into the corresponding header pins on the PCB breakout. Remember that Tx on the programmer goes to Rx on the Arduino and vice-versa. Also make sure that you use the correct voltage output from the programmer, 3.3V for the 3.3V Pro Mini and 5V for the 5V Pro Mini.
You can download the sketch from my blog post and read through a detailed description of what each section of the code does.
Calibrating & Using Your Soil Moisture Sensor
When you first power the monitor on, you'll see a short splash screen on the display and the display will then turn off.
Once off, you can push the button next to the display to turn it back on and see the actual measured moisture level as well as the two moisture level setpoints. The two setpoints can be adjusted by turning the low and high level potentiometers. There is some logic in the code to prevent setting the low setpoint higher than the high setpoint and the high lower than the low.
Before you use the sensor, you'll need to calibrate it. To do this, use the USB programmer to display the raw sensor values from the moisture sensor. Take a dry reading from the sensor in air and then submerge the stick part of the sensor in a jug of water to get the maximum moisture level. Make sure that you don't get any of the components wet while doing so. Take these maximum and minimum values and replace them in the code and your monitor is then good to go. You can also add a small margin onto the maximum and minimum to account for environmental variations.
As mentioned previously, the monitor lasts for around 15-20 days on a single charge of the 18650 battery. I've detailed two techniques on my blog that you can implement to further improve this to around 50-60 days on a single charge. These essentially involve only powering the moisture sensor when you need to take readings and removing the small power LED on the Arduino. You can also improve battery life by taking readings less frequently.
I also added an acrylic faceplate to the monitor once it was complete to protect the electronic components
Have you tried making your own soil moisture monitor? Let me know in the comments section!