Join Now

    Tinkercad’s New Soil Moisture Sensor

    Team Tinkercad
    Published on - April 21, 2022 by Team Tinkercad



    Do you have a plant in your classroom, or maybe a school garden? As you know, our leafy friends rely on us for water to grow and stay green. If only they could tell us when they need a drink of fresh water...Here is a fun project that incorporates Tinkercad’s new Soil Moisture Sensor, a micro:bit, and simple block coding that will help you know when your plants are thirsty. Let's see how it works! 

    First experiment: 
    1. Create a new Tinkercad Circuit design, then drag a micro:bit and a Soil Moisture sensor from the component gallery. 
    2. Wire the soil moisture sensor’s Power, Ground, and Signal into the micro:bit as shown below. The signal is connected to the micro:bit terminal labeled “2”. 
    3. Click the “Code” button to reveal the Codeblocks we’ll use to program this simple setup. 
    4. Drag a blue “show number” block, and drop it inside the orange forever block. 
    5. Next, drag a purple “read analog pin” block into the oval of the “show number” block, and set the pin to “P2” via the dropdown. 
    6. Click “Start Simulation”! 

    Graphical user interface
Description automatically generated

    Note that the moisture reading is displayed on the micro:bit when it is simulated.  Click on the soil moisture sensor while it is simulating to adjust the moisture level slider and watch the moisture number reading change on the micro:bit. Piece of cake! 


    Visualize the data: 

    Now that we know the minimum and maximum numbers of the moisture sensor for this setup, we can remap those values, 11-813, dry to moist, respectively, to something between 1-100 and visualize the moisture by plotting the values as a graph on micro:bit. 

    In the below example, I created a variable called “moisture” to help remap the moisture readings we were getting. Also, rather than showing the number, I plot it as a bar graph on the micro:bit. 

    Graphical user interface
Description automatically generated with medium confidence

    Try the starter: 

    There are great starter examples for both the micro:bit and Arduino incorporating the Soil moisture sensor. These are other great examples of how to build and code with this fun sensor for a simple class project. Find them in the Tinkercad Circuit editor’s component panel under “Starters” for either Arduino or micro:bit!  


    Tags: Features