MISSION OBJECTIVE
Learn how to collect and display data using loops, actions, and variables.
Piperbot and Pip are excited to find sustainable farming operations on Mars! Let's build a Soil Sensor to measure how much water reaches the plants.
View student interface at make.playpiper.comMISSION CHARACTERS
MISSION MATERIALS
Computer with USB port and Chrome or Edge browser
Piper Make Base Station or Starter Kit
Soil Sensor
MISSION RESOURCES
Learning Goals
- Students will practice breadboarding and wiring.
- Students will review and understand the computational concepts of:
- Loops: Running the same sequence multiple times.
- Sequence: Identifying a series of steps for a specific task.
- Students will demonstrate core computational thinking concepts, including algorithm design, by creating an ordered series of instructions for solving similar problems or doing a task, such as turning a light off and on in the correct order.
- Students will create programs that include events, loops, and conditionals.
- Students will practice organizing problems into smaller, manageable tasks.
- Students will test and debug a program or algorithm to ensure it accomplishes the intended task.
- Students will perform different roles when collaborating with peers during the program development's design, implementation, and review stages.
Learning Activities
The following sections will contain step by step instructions for ELA, ELD and Math extensions directly related to this mission. Adjust the directions to fit your ELA, ELD and Math standards.
ELA Extension: Write a StoryAsk students to write a narrative story from the point of view of the plant.
- Have students explain how water helps a plant grow.
- Ask them to explain how the sensor saved the plant's life.
- Tell students to get creative and have fun with their characters!
Math Extension:
Ask students to use the reading in the Console to determine the average.
- For older students, have them calculate the average.
- Ask younger students to choose the number that looks closest to the average.
Career Connections
Natural Sciences Manager: Salary $144,440/yr
Agricultural Engineer: Salary $83,260/yr
Environmental Engineer: Salary $96,530/yr
Soil and Plant Scientist: Salary $65,730/yr
Hardware Diagram
Tutorial Steps
Soil SensorThis sensor will work by measuring how much, or how little, moisture there is in your soil. To do this, we will build a circuit board that connects to a plastic plant stake, with one end placed down into the soil.
If you don't have a houseplant for this tutorial, you can use a glass of water.
If you've already built the Air Guitar tutorial, the circuit in this activity will be similar.
- Plastic Plant Stake
- Vinyl Rainbow Sticker
- (2) Copper Tape Strips
- A small cup you can fill with water
Grab the copper foil strips. We're going to place them evenly apart down the center of the plant stake, using the image below as a guide.
Line up each foil strip just below where the top point begins to angle so that there is about 1/4 inch hanging over the flat edge.
Make sure that there is a gap between the foil strips, and make sure there is a gap all of the way around the foil strips except on the one edge they overhang.
When you are ready to stick the foil strips to the stake, peel off the paper backing to expose the adhesive side on the foil. Press the foil strips down, applying them as smoothly as possible.
Begin by folding the ends of both foil strips under so they adhere to the backside of the stake. Make sure that the two strips don't touch each other.
When your soil moisture sensor it ready, click NEXT.
The letters and numbers on the side of the bar graph LED should be on the side shown by the arrow below:
First, connect a M2M Jumper wire from a GROUND pin on the top of your Pico to the Ground row on the top of your Breadboard.
Now, we're going to connect the M2M Jumper wires. Connect 1 wire in line with each LED bar, opposite the 330 Ohm Resistors. It doesn't matter which color wires you use. Next, connect the other end of each wire to the GPIO pins of your Pico, beginning with GP15, then GP14, GP13, and so on until you've reached GP6. If you are having a hard time telling which pins of the Pico you should connect to, use the DIGITAL VIEW tab at the bottom of the screen for a helpful diagram!
Attach the 1 MOhm Resistor to your Breadboard, connecting one end to GPIO pin 0 and the other to Ground.
Hang on - we're almost there!
Connect one alligator clip wire to the left wire of this 1 MOhm Resistor and the other to the right wire.
Finally, attach an alligator clip to each of the copper foil strips. Be sure it is pinched around and touching the foils.
You made it!
For this step, you will need the cup that you can fill with water. Start by making sure the cup is empty, and place your soil moisture sensor into the cup with the pointed end down.
Grab a start block from the Chip menu and drag it onto the workspace. Next, grab a repeat forever block from the Loops menu and connect it to the start block. Then, place a print block from the Chip menu inside of the repeat forever block. Finally, remove the "_" from inside the print block and drag it to the trash can to delete it:
You should begin seeing readings from your sensor:
1410
1499
1422
1427
1483
1465
Go ahead and click STOP, then click NEXT.
You should begin seeing new readings from your sensor:
6035
6107
6082
6046
6111
6058
Go ahead and click STOP, then click NEXT.
When we connect the Pico to a piece of metal like one of the copper strips in side of the sensor, the Pico can charge the copper strip by raising it's voltage up to 3.3V. The Pico does this really fast, and it makes the copper strip positively charged:
What's even crazier is that the whole measurement - from charging the foil to letting it drain away - only takes 0.005 seconds. That means the Pico can take 20 measurements in the same amount of time that it takes you to blink your eyelids once!
Click NEXT.
Grab a setup bar graph led block from the Actions menu and place it between the start block and the repeat forever block. Set the start pin to 15 and the end pin to 6:
Now, try slowly lifting the sensor out of the water to see how the bar graph LED changes.
Click STOP.
Wouldn't it be nice if your program made a sound or alarm when the water level was too low?
Click the Variable menu to open it and then click the Create variable button. Name your new variable "cycles". Grab the set cycles to block and connect it between the start block and the setup bar graph led block. Grab a 0 block from the Values menu and place it into the set cycles block:
Grab an if _ = _ do block from the Logic menu and connect it below the bar graph led display block. Right-click the capacitive sense block and select Duplicate. Place the new block into the left side of the _ = _ block. Then, grab a 0 block from the Values menu and place it into the right side of the _ = _ block. Change the = (equals) to a < (less than).
We want an alarm to go off when the soil is dry, so we need to pick a value that is a little bit higher than our dry value. Add 50 to your dry value and change the 0 in the _ < _ block to your dry value plus 50:
Grab another if _ = _ do block from the Logic menu and place it inside of the if do block that's already in your program. Next, grab a cycles block from the Variables menu and place it into the left side of the _ = _ block. Then, grab a 0 block from the Values menu and place it into the right side of the _ = _ block. Change the 0 to 10:
Right-click the set cycles block at the top of your program and select Duplicate. Connect the new set cycles block right below the play sound block. Then, grab a change cycles by block and connect it below the if do block you just placed the set cycles block into:
If you don't hear a sound, your Dry + 50 value is too low - try making it Dry + 100 and run your program again.
Once you are happy with your program, go ahead and click STOP. Feel free to try your sensor in a potted plant if you have one!
Click NEXT.
Blueprint
OPEN IN BLUEPRINT VIEWER DOWNLOAD
Have an different version? Look for more information on the Support Page.
Troubleshooting Tips
Our customer support specialists are on hand to ensure your implementation of Piper runs seamlessly.
View Support Docs or Contact Support
EXPANDED RESOURCES
Term Glossary
Fossil Fuels Sources of energy made from prehistoric plants and animals (coal, oil, natural gas). (CE)
Renewable Energy Energy sources from natural resources that can be more easily replenished (solar, water, nuclear). (CE)
Capacitance An object's ability to hold an electric charge.
Pollution Anything that dirties the Earth, such as litter, smoke from cars and factories, or water contamination. (CE)
Standards Alignment
- CA 3-5.CS.2 Demonstrate how computer hardware and software work together as a system to accomplish tasks.
- CA 4-ESS3 Obtain and combine information to describe that energy and fuels are derived from natural resources and that their uses affect the environment (5.ESS3.C; MS.PS3.D; MS.ESS2.A; MS.ESS3.A; MS.ESS3.C; MS.ESS3.D

