In my 1st and 2nd grade classroom, an activity we complete is planting pumpkin seeds. We plant the pumpkin seeds as a class in the spring, and students bring their seeds home to plant their seeds and watch the pumpkin grow. Since planting day, pumpkins have been a daily discussion in our classroom. Some students report that they have not watered their pumpkins at all; whereas others say they have standing water on top of their soil. All of these discussions made we wonder about the appropriate moisture for different types of plants. I began to do some research and was inspired to build my own Soil Moisture Sensor using my Arduino Uno. This project uses nuts and bolts to measure the percentage of moisture in the soil. The RGB LED connected to the Arduino Uno changes colors to represent different percentages of moisture. The Soil Moisture Sensor is a great project for the garden enthusiast and beginning Arduino Uno user.
Step 1: Gather Materials
- 1-Arduino Uno
- 1-RGB LED
- 2-Long Jumper Cables
- 6-Short Jumper Cables
- 1-10k resistor
- 3-330 ohm resistors
- 2-Bolts of any size
- 2-Nuts to match bolts above
Step 2: Build Prongs
- Place the nut on the bolt.
- Tighten until the nut is about 1/8 inch from the head of the bolt.
- Place one end of the jumper wire between the nut and the head of the bolt.
- Continue to tighten until the jumper wire is secured between nut and bolt.
- Repeat steps 1-4 to create 2nd prong.
Step 3: Build Circuit
The wires labeled out represent the sensor prongs.
Step 4: Write Code
Click here for the complete code.
Step 5: Calculate
- Open serial monitor.
- Hold prongs in air and record the number displayed on the serial monitor. This will be your value for 0% moisture. (This number should be at 0)
- Hold prongs in a dish of water. Record the number displayed on the serial monitor. This will be your value for 100% moisture.
- Solve for x. 100=(high value) (x)
- My high value was 650 so the equation was 100=650x and was solved as follows: x=100/650 to get the x value of 0.15384615.
Step 6: Revise Code
- Add value calculated in the previous step into the code.
- View lines 18 and 19 to see the added code.
- Here is the final code.
The RGB LED will change color based on the moisture percentage recorded in the serial monitor. The colors are as follows:
- 0%-20%=Red--Serial Reading of less than 130
- 21%-40%=Yellow--Serial reading between 131 and 260
- 41%-60%=Green--Serial reading between 261 and 390
- 61%-80%=Blue--Serial reading between 391 and 520
- 81%-100%=Purple--Serial reading between 521 and 650
The colors were set to match those found on this chart.
Step 7: Test
Place prongs into the soil approximately 1 inch apart. View the serial monitor and light to see the plant's soil moisture. Use the following guide to see if your plant is at the correct moisture.
Step 8: Sources of Inspirations
Instructables. (2019, January 26). DIY Plant Moisture Sensor W/ Arduino. Retrieved May 17, 2019, from https://www.instructables.com/id/Plant-Moisture-S...
Instructables. (2019, May 09). DIY SOIL MOISTURE SENSOR CHEAP YET ACCURATE ! Retrieved May 19, 2019, from https://www.instructables.com/id/DIY-SOIL-MOISTUR...