Bringing maker education and computational thinking to the classroom.

Latest Activities

Featured Stories

Alexandra Gendreau Chakarov
October 15, 2019

Monitor My Plant

Activity Name:

Monitor My Plant

Grade Level:

7 (Could work for grades 5 - 8)

Time Required:

120 minutes (approximately 2 class periods)

Expendable Cost:

  • Dirt
  • Pots/cups

Group Size:


Subject area:

science, technology



Students learn about the gator:soil sensor and how they can use it to monitor when a plant needs to be watered. Students calibrate the gator:soil for the value of dry soil and wet soil. Then they program the micro:bit to monitor the soil moisture using the gator:soil and the 5 LEDs and speaker on the gator:bit to indicate moisture levels and when the plant needs to be watered. This could work in a science class that is growing plants for another experiment or in any classroom that has plants. Students don’t have to each have their own plant, they could monitor any plants in the classroom. Multiple students can monitor one plant.



micro:bit, soil moisture, watering plants, sensors, middle school, coding


Educational Standards:


  • Computational Thinker 5b
    • Students collect data or identify relevant data sets, use digital tools to analyze them, and represent data in various ways to facilitate problem-solving and decision-making.
  • Creative Communicator 6a
    • Students choose the appropriate platforms and tools for meeting the desired objectives of their creation or communication.


  • SEP 1: Asking Questions and Defining Problems
    • MS-ETS1-1: Define the criteria and constraints of a design problem with sufficient precision to ensure a successful solution, taking into account relevant scientific principles and potential impacts on people and the natural environment that may limit possible solutions.
  • SEP 4: Analyzing and Interpreting Data
    • MS-LS2-1: Analyze and interpret data to provide evidence for the effects of resource availability on organisms and populations of organisms in an ecosystem.

Prerequisite Knowledge:

Students should have some experience programming the micro:bit. Provided they have worked through some of the tutorials on the MakeCode website they should be able to complete the activity.


Learning Objectives:

  1. Students learn about different ways to display information and determine which one they deem to be most useful for monitoring soil moisture.
  2. Students define the problem of collecting soil moisture information by first determining the minimum and maximum levels of soil moisture.
  3. Students collect relevant data using the gator:soil sensor to determine when the plant needs to be watered.

Materials List:

  • Micro:bit
  • USB cord
  • Power supply (micro:bit battery pack should be sufficient)
  • gator:bit
  • gator:soil Sensor
  • 3 alligator clips
  • Soil
  • Pot
  • Seeds/Plant
  • Computer or tablet capable of flashing code to micro:bit

Introduction / Motivation:

(Bring out a plant that hasn’t been water in a while, make sure that the leaves a drooping, the soil is dry, and overall doesn’t look healthy). How does this plant look to you? (Write list on the board of students observations, hopefully at least one of them will bring up that it looks like the plant needs water). How do you know when you need to water a plant? (Make list on the board) Do you think you can ever water a plant too much? (If students think this answer is no, show them these pictures).

image source:

How can we make sure to always water a plant exactly when you need to? (If your students are familiar with the sensors and the micro:bit, hopefully some of them will bring up how they could use them. If students aren’t familiar with the sensors, ask them about things they know to alert them that something needs to happen like a timer on the microwave or alarm clock. For example you could say… Just like your alarm clock wakes you up in the morning, you can make an alarm to let you know when you need to water your plant.)

Each of you is going to create a system to monitor the soil moisture level of a plant. As a class we are going to come up with a set of criteria for what it must include.



Clearly explain the step-by-step procedure to follow to conduct the hands-on activity. Make sure to include connections to engineering and address activity objectives. To clarify the activity setup and procedure, place images, photographs and diagrams throughout this section and the activity write-up. Use figure numbers if the image is referenced in the text. Include metric units.



Make sure you are familiar with the different capabilities of the gator:bit and micro:bit. The main ones to focus on here are the different ways to represent information using the 5 LEDS on the gator:bit controlled by pin P12, the speaker controlled by pin P0, and the 25 LEDs on the micro:bit itself (see Figure 1). In addition, make sure you are familiar with the gator:soil sensor and how to wire it, the two main things to remember are:

  1. Connect the ground wire first
  2. Power the gator:soil using P1 or P2 not the 3.3V output. This allows the sensor to last longer while only powering it when you want to take a reading.

For more information about the gator:soil sensor see the hookup guide. The gator:soil returns values between 0 and 1. These decimals can be hard for students to understand and interpret. I recommend having students multiply the result by 100 to make the results easier to understand. I support this in the tutorial and there is a MakeCode block math that will do this for the students. I don’t think a long explanation is necessary here simply saying something like converting a decimal number to a percent should suffice.


Figure 1Figure 1: Ways to use the gator:bit/micro:bit to represent information.


Before the Activity

  • Gather all materials together.
    • I recommend printing out the wiring guidelines and including them in the materials
  • Create a station of soil samples that are different levels of wetness for calibration. I recommend having at least four different options of soil to test.
  • Write up the urls for the tutorial on big stickies, whiteboard, share them on Google Classroom, etc.

With the Students

  1. Divide the class into pairs and make sure each pair has a set of the materials
  2. The first step is to calibrate the gator:soil for their specific soil.
  3. First students have to wire their gator:soil using the below wiring diagram.


Figure 2a Figure 2b

Figure 2: Suggested wiring diagram for the gator:soil and an actual picture of wiring up the sensor.

  1. Confirm that students have wired the sensor correctly by having them share their wiring configuration with another pair of students.
  2. Now the students are ready to code the calibration. For more experienced coders, they can create a new project on MakeCode and import the gator:soil library by going to Extensions and searching for this repository (see Figure 3). For students who are less experienced, they can start with this tutorial that imports the libraries and the blocks they need for them. This is an example MakeCode Project for calibration.
Figure 4a Figure 4b Figure 3c


Figure 3d

Figure 3: Sequence of moves in MakeCode to add the gator:soil sensor.

  1. Once students have their calibration program coded, they should test it out on different levels of soil moisture and record the results.
  2. Have students share their calibration results with another pair of students. Results should be similar across groups by may vary slightly depending on which battery packs students are using.
  3. After the calibration phase, students get to design their soil moisture monitoring system. If students are familiar with the different options on the gator:bit and micro:bit, they can proceed to making their design plan.
  4. Show students the different options they have for creating their plant monitoring system. This can be done by showing one you created yourself or just illustrate the different features on the gator:bit/micro:bit as shown in Figure 1.
  5. Before students start to code their plant monitoring system, they need to make a design plan. Things that their design plan must include are:
    1. What the outputs will be (i.e. different colored LEDs and then a sound when the plant needs to be watered)
    2. Thresholds for changing the outputs
    3. How often it will take measurements
    4. What will trigger measurements to start being taken
    5. Explanation for their design decisions
  6. Now students code their design. Again experienced students can create a new project on MakeCode and import the soil moisture library by going to Extensions and searching for this repository (see Figure 3). If students want to use the LEDs on the gator:bit they should import the neopixel library (see Figure 4). For less experienced students and students who need extra help, they can use this tutorial which imports the necessary libraries and gives them a set of blocks to work with. This is an example MakeCode Project to monitor soil moisture.
Figure 4a


Figure 4b


image4 edit


Figure 4: Sequence of moves in MakeCode to add the neopixel library

  1. Once students complete their programs, have them test it out on the different levels of soil moisture to ensure that their code is correct.
  2. Students conduct design share outs where they explain their design choices. Some suggested strategies for doing this are
    1. Have pairs partner up and share with each other
    2. Break the pairs in half and do a gallery walk. Then have the pairs swap.
    3. Have each group present their plant monitoring system to the class.
  3. Finish with a brief whole class discussion on struggles the students had completing the tasks and how they overcame them.

Troubleshooting Tips:

  • Coding
    • For students with less programming experience. Use the tutorials linked in the instructions that limit the blocks the students see to just the blocks they might need.
    • The calibration part will usually be much easier for the students than when they have to make their own display. Students tend to struggle with the logic blocks and it can be worthwhile bringing the group together to go over the creation of an if/then/else statement where they compare noise levels.
    • If students are very new to coding, walking through at least part of the tutorial as a class can get students on the right track
    • Multiplying by 100 and rounding the resulting value gives you something along the lines of a percentage moisture level. This makes the value easier to interpret for students. One thing to note is that you can’t wait until there is no moisture to water the plant even the air has at least some moisture. Students should figure this out during the calibration phase.
  • gator:soil Sensor
    • It is an analog sensor and can be sensitive to changes in power. I recommend having students turn off the LEDs and speaker before taking a measurement.
    • Make sure that students place the sensor in the middle of the pot, if the sensor is touching the sides of the pot readings can be incorrect.
  • Wiring
    • Make sure that students follow the diagrams
    • Make sure that students all ALWAYS connecting the ground wire first
    • Don’t have students connect the batteries until they have tested the code when the micro:bit is powered using the USB cord.
    • It helps to give students wires that match the colors on the diagram or at least red and black alligator clips for power and ground.
    • Do not have students connect the sensor to the 3.3V power on the gator:bit. Instead use one of the pins to control the power as in the wiring diagram. Always powering the gator:soil sensor can shorten its lifespan.
  • Displays
    • Remind students which pins control the sound (P0) and neopixel LEDs (P12) on the gator:bit
    • If using the speaker on the gator:bit, make sure that the music switch is on the on position (it’s right by P0).

Going Further:

  • Since individual data points can be incorrect, have students take three consecutive measurements and compute the average.
  • For further plant monitoring incorporate the environmental sensor to monitor humidity and carbon dioxide around the plant. Monitoring humidity can allow you to measure transpiration.

Subscribe Email

Popular Tags

micro:bit Arduino