Soil Moisture Detecting Pot for House Plants

146

1

1

This tutorial will walk you through a step by step process for creating your very own pot that detects your house plant's soil moisture levels. This design will help you identify when and how much water your plant needs to provide excellent care and nutrients.

A quick overview of the tutorial includes coding the Adafruit Circuit Playground in Microsoft MakeCode to create a soil moisture detector and how to incorporate your playground into your house plants pot. The playground detects the soil moisture and distinguishes them between three levels; wet, mid, and dry. When the soil is "wet" the playground lights will be clear. When the soil is "dry" the lights on the playground will be red. When the soil is in between wet and dry, "mid," the lights will turn yellow.

Hopefully, this will help all you plant lovers out there like me, who struggle to keep their plants alive.

Supplies:

Step 1: Gather and Purchase Supplies

SOIL MOISTURE SENSOR

POT AND STAND

  • Plant(s)
  • Soil
  • Water
  • House pot
  • Sticky tack
  • 1" Felt circle pad
  • Hot glue and glue sticks
  • Plastic or cardboard box (for a stand to pot the pot on)
  • Scissors
  • Pliers

(Use different materials for your pot/stand if you would like:)

Step 2: Coding Your Circuit Playground in MakeCode

How to start coding your Circuit Playground in MakeCode to create a soil moisture sensor!

  1. Read through the Adafruit tutorial to get a basic overview on both the circuit playground and MakeCode block based coding program and how to use the two together to create a soil moisture sensor.
  2. Download the Microsoft MakeCode for Adafruit Circuit Playground app onto your computer. Find more information about the app here.
  3. Open the Soil Sensor Light MakeCode here. Click the purple 'Edit' button to edit the code.
  4. Click the 'Download' purple button on the left bottom hand side.
  5. Open the code in the MakeCode app on your computer. (This way you can use the 'Show console device' feature that will be very handy in a future step.)
  6. Then in the left hand column click the pink "Variables" button. Click the "Make a Variable..." box.
  7. Name the Variable "wet_value"
  8. Drag the "set wet_variable" block of code and place it below the "set dry_value" code in the "On Start" container.
  9. Choose a number higher than the dry value and place it in the wet value box.
  10. In the green "Forever" container, click the blue "+" button. Drag the blue "clear" block and place it under the "else" button.
  11. Click the blue "Logic" button on the left hand navigation bar.
  12. Scroll down to the "Boolean" title.
  13. Drag the "and" block and place it in the "else if" diamond space.
  14. Copy the blue "soil_reading less than or equal to dry_value" block of code. Place the copy in the "else if" 1st diamond space.
  15. Change the less than or equal to sign to a greater than sign.
  16. Copy the blue "soil_reading less than or equal to dry_value" block of code. Place the copy in the "else if" 2nd diamond space.
  17. Change the less than or equal to sign to a less than sign and change the "dry_value" to "wet_value"
  18. Click on the dark blue "Light" button on the left hand navigation bar.
  19. Drag the "set all pixels to (color)" block and place it in between "else if" and "else".
  20. Click the red circle and select yellow.
  21. If you would like to make any more changes or add any more functions and variables, now is the time:) Once your code is the way you would like it, plug in your circuit playground to your computer and click the purple "Download" button.

Tips

  • To simplify the processes, you could leave the code how the Adafruit tutorial had it which will have two soil levels and have the lights be red or clear when the levels are dry and wet.
  • Make sure to follow each step in order. Don't skip steps!
  • Attached is an image of my final code with all of the above steps in it. I recommend opening it up and using that as a guide or map for your code.
  • Ideas for remix: Switch up the colors or have a color instead of clear for wet.

Step 3: Testing the Soil Sensor and Setting the Dry and Wet Values

Wooohooo! Your code is done. I wish I could tell you the hard part is over, but this next step is very important and will actually make or break your sensor. Through this next step, I will walk you through testing your soil levels to calibrate your wet and dry values more accurately.

  1. Keep your circuit playground connected to your computer. If you unplugged it, no big deal, just plug it back in.
  2. Set up three pots; one with wet soil, one with semi wet/dry soil, and another with dry soil.
  3. Connect one side of your alligator clip to the A1 pin on your circuit playground.

There are two ways to go about the actual testing to find your dry and wet values. I'll walk you through both.

  • Manual Calibration
  • Show Console Device

Tips (This is important to know before testing)

  • I recommend to skip the manual calibration processes and go straight to using the console device feature. I spent countless of stressful hours trying to manually calibrate my wet and dry values with little success. I had a variety of inconsistencies that I didn't understand until after troubleshooting with a programmer and he informed me of capacitance interference. Using the console device will help you avoid the capacitance errors in a faster manner.
  • To use the console device feature, you need your code to be in the MakeCode app that you downloaded onto your computer. If you have been coding in the browser version of MakeCode, no worries. Just download the code and then upload the file into the app.
  • Keep track of your readings in both processes. This will help you be systematical about your tests and be able to use more deductive skills to come to your values more efficently.
  • I recommend having three pots of soil; one pot that was watered recently, one pot of really dry soil, and another pot that is somewhere in between. This will help you find your dry and wet ranges and determine the mid range. Prepare ahead of time, before you start your readings be sure you are watering each pot accordingly to the soil moisture level you place with each pot.
  • It helps to wipe off your nail after each reading with a paper towel.
  • Take into consideration if your plant needs more water than others or less. This should help you determine what your dry, mid, and wet values will be.

Manual Calibration

This process is a trial and error process. It's a cycle of changing the number for your dry value and then testing that value on your soil and then changing the number based on your test and then testing that again and so forth.

  1. Place a value in both the dry and wet text boxes in the "On Start" container. Such as 1500 in dry and 2600 in wet.
  2. Press the download button.
  3. Place the nail in the the soil and write down the reading.
  4. Take the nail out, wipe it off, wait for it to calibrate, then place it into the next soil and write down the reading.
  5. Take the nail out, wipe it off, waif for it to calibrate, then place it in the next soil and write down the reading.
  6. Decided what your next number should be and then place change it in your code and download it on to the circuit playground.
  7. Then repeat steps 2-6 until you find the correct values you are happy with and feel will correlate to the type of plants you have and the amount of water they need.
  8. When your code is set with the correlating wet and dry values, unplug your circuit board from your computer plug it into the phone charger box and then plug that into an outlet..

Keep in mind that this route, although has less steps, takes more time since you have to run more tests. I ran over 200 using this route.

Console Device Feature

This process still uses the trial and error route, but it tells you the values the sensor is reading at each exact time it takes a reading. This will help you come to the dry and wet values in a faster and more precise manner.

  1. Place a value in both the dry and wet text boxes in the "On Start" container. Such as 1500 in dry and 2600 in wet.
  2. Press the download button.
  3. On the left hand side, under the circuit playground diagram, there is a button that says "Show console device." Click that button. It will take you to a screen that will graph your soil readings and give you a list of the the values it gets for each reading.
  4. Place your nail in the wet soil and record the highest values it is picking up.
  5. Take the nail out, wipe it off, wait for it to calibrate, then place it into the mid soil pot and record the average values it is picking up.
  6. Take the nail out, wipe it off, wait for it to calibrate, then place it into the dry soil pot and record the average values it is picking up.

  7. Decided what your three ranges will be and what the dry and wet values should be. Change the numbers in the corresponding text boxes for the values.

  8. Repeat steps 2-7 until you are happy with the values and feel will correlate to the type of plants you have and the amount of water they need.

  9. When your code is set with the correlating wet and dry values, unplug your circuit board from your computer, plug it into the phone charger box and then plug that into an outlet.

You're ready to now move on to connecting your circuit playground to your pot! :)

Step 4: Attaching Your Soil Sensor to Your Pot and Constructing a Stand

You made it through the technical and hard part. Now to the creative part! For this part, feel free to sway from my steps and come up with your own way of attaching your sensor or constructing a stand. It's totally up to you. I'll share what I did for mine. Maybe it'll be inspirational, get your juices going, or spark some ideas.

Attaching the Sensor to the Pot

For mine, I attached my circuit playground to the plant saucer part of the pot. The plant saucer is the little dish that is under the pot that catches the water.

  1. Plug in the hot glue gun
  2. Grab the felt circle pads. (For mine I needed two to fit securely on the rim of the plant saucer and keep the sensor from touching the sides of the pot)
  3. Glue 2 pads together.
  4. Then glue the 2 pads (on the edges) of the circle on top of the rim of the saucer. Make sure to add glue all around the pads to keep them secure.
  5. Cover the face of the circle pad that is sticking away from the pot with sticky tack.
  6. Place your circuit playground, lights facing out and the port for the cord facing down, and firmly secure it to the sticky tack.

Constructing a Stand

Since the circuit playground needs to be plugged into the wall, I wanted to keep the atheistic of the pot to be strong but felt having a cord coming from the pot and to the wall was distracting and that's were the idea for a stand came up when troubleshooting with my professor. The cord will plug into the wall and then come into the box and then up to the pot. (I tested two different battery packs and neither of them had enough power to render the soil readings. But when it's plugged into the wall, the playground has enough power for accurate readings.)

  1. Place your pot on the box (plastic or cardboard) and make sure it is in the right place. Then mark where the cord will come through the stand to connect to the playground. Make sure to get the measurements right so the cord can fit through it.
  2. Make the hole in the stand for the cord to pop up through and connect to the pot. (My box was plastic, so to make the hole I used a nail, pliers, and my stove. I held the nail with the pliers and heated the nail using the gas burner on my stove. I then was able to melt through the plastic a couple of times and use scissors to finish creating the hole.
  3. Next create a hole on the side of the box or behind the box (the side that faces the wall for the cord to stick out of. (My box had holes already made on the sides. But if it didn't, I would have used the same process I used for the hole on the top.)

Time to put the Pot and Stand Together!

Now that we have our pot and stand made, we can put them together! Wooohooo!

  1. String the cord through the box into the different holes. Make sure the end that plugs into the playground goes in first and comes up to through the top hole while the end that plugs into the phone charger box comes out the back and faces the outlet.
  2. Place the plant saucer on top of the box. Plug the cord into the playground.
  3. Place the plant onto the plant saucer if the saucer is a separate piece of the pot. Plug the cord and box into the outlet.
  4. If you detached the alligator clip, clip it back onto the pin A1. Then clip the other end to the nail.
  5. Place the nail in your plants soil and then your soil moisture pot detector is ready to go!

Step 5: Have Fun Watering Your House Plants With Ease and Comfort

WOOOHOOO!!! You can now sit back, relax, and go about your day without worrying about when and how much to water your plants. Have fun watching your sensor change colors and see your plants grow an bloom with the best care and nourishment they will ever have! :)

Share

    Recommendations

    • Fandom Contest

      Fandom Contest
    • Classroom Science Contest

      Classroom Science Contest
    • Party Challenge

      Party Challenge

    Discussions

    0
    None
    WeTeachThemSTEM

    5 weeks ago

    A fun project for keeping your plants happy! Thanks for sharing! :)