Arduino Pot Plant Soil Moisture Sensor
I have been struggling with over watering of my indoor pot plants, especially succulents. To this end I decided to make a simple Soil Moisture sensor that can tell me when the moisture level of my pot is too high (over watered), too low or just right!
- Capacitive Soil Moisture Sensor V1.2
- WS2182b mini
- 3D Printing Filament
Step 1: Gather Your Components
I have used an Arduino Leonardo (this is what I had on hand and this project would work with any type of Arduino).
I soldered wires directly to the Arduino headers. Using the Schematic attached.
The Moisture Sensor will work correctly on any Analogue in pin and the WS2812B mini should work on many digital pins however in my case I used D2.
Step 2: Calibrate Sensor
The Principle behind the sensor used is that as the moisture content increases so too does the capacitance in the sensors circuit placed in the soil. To use the Capacitive Soil Moisture Sensor V1.2 we supply either a 5V or 3.3V power source (ideally a stable voltage source) we can then read an analogue voltage from the sensor that corresponds to the capacitance of the sensor and therefor the moisture level of our soil.
Given there can be variances between manufactures and even parts it is sensible to calibrate the sensor so it works for the specific sensor we have. This may not be 100% necessary however can improve the performance of your sensor.
Calibrating the Sensor:
- Connect Sensor to computer running Arduino Script
- Open Serial Monitor (Arduino will output raw values from the ADC on the Arduino. Value between 0 and 1023)
- Note the value seen when the sensor is in the air
- Submerge the sensor into water up to the point you would in your pot. Note the value seen while in the water.
Now that you have noted the “dry” and “wet” value it is time to update the Arduino script with this information.
Go to Moisture Sensor Setup in Line 19 and update AirValue and Water Value with those you have recorded.
//Moisture Sensor Setup
const int AirValue = 900; const int WaterValue = 680;
Step 3: Step 3: Select Limits
Every plant is different! Some plants like a dry soil and prefer to be watered once and then left for a while. Others need moist soil almost contently and will need watered regularly. At this point we need to decide what we want to consider as over watered and under watered! This differs plant to plant.
Note: The Arduino Script has some small logic to convert the reading into a percentage where 0% Moisture would be the value you recorded in Air and 100% Moisture being the value you recorded when submerged in water.
Given we are now working with percentages we need to pick a percentage Moisture we want to be alerted at when we need to water and one to know when the plant is over watered. Anything in between and the plant will be happy!
The table bellow shows the values I have found good for different plants. Comment what values have worked for your plants!!Plant Over Watered Percentage Under Watered Percentage Strawberry 90% 35% Butterfly Palm 85% 30% Aloe 70% 15%
Step 4: Print the Case and Assemble
I 3D printed the case for the sensor to hold it in a small and simple box. I wanted something slim so decided to only use the moisture sensor however with some further work and the inclusion of a simple Light Dependent Resistor this design could be extended to make sure your plants are getting the correct amount of light.
The 3D files for the case can be downloaded from Github.
Once printed it is time to assemble! You should have the Arduino, sensor and LED soldered together. Now place the LED into the recess hole and the moisture sensor in its location. Place the cover on top and glue in place (I used Blu-Tack).
Step 5: Be the Perfect Plant Parent
The LED have three colours to show you the Moisture in your pot!
See the table bellow to know what the sensor is saying.Blue Over Watered Green Happy Plant Red Needs Water