Introduction: Use Soil Moisture Sensor With Magicbit [Magicblocks]

This tutorial will teach you to use the Soil Moisture Sensor with your Magicbit using Magicblocks. We are using magicbit as the development board in this project which is based on ESP32. Therefore any ESP32 development board can be used in this project.


  • Magicbit - Pro

Step 1: Story

Hello and Welcome, This short tutorial will teach you to use the Soil Moisture Sensor with Magicbit using Magicblocks.

There are 1 main method of achieving this goal;

  • By using Dashboard Gauge.

First of all log into to your Magicblocks account,

Magicblocks is an easy visual programming software for program your magicbit. Anyone can program their micro controller by using and there is no need of programming knowledge. You can sign up for free.

Start and Open the Playground.

Next make sure your Magicbit is connected to the internet and plugged-in and also linked to your account through Device Manager.

All Done? then scroll down to Method 1

List of Items Required

Magicbit: Magicbit Is an integrated development platform based on ESP32 for learning, prototyping, coding, electronics, robotics, IoT and solution designing.

Step 2: Setting Up the Analog in Block

1. Drag & drop the Analog In block from the input nodes section on the left of the screen to the Flow.

2. Double-click on the Analog In block and type or paste your unique Device id from the Device Manager Tab on your Magicblocks account. [ This will link the analog in with the Magicbit ]

3. Choose 'PIN33' from the PIN drop-down menu.(Connects with component connect to the PIN33 on your Magicbit)

4. Select the Method as Interrupt from the drop-down menu.

Step 3: Setup the Range Block

(This Node is used to inverse the input values from the Analog In node)

1. Drag & Drop the Range Block from the function nodes section on the left of the screen to the flow.

2. Type the input range and result range as below;

(Make sure to tick the 'Round result to the nearest integer' check box to avoid decimals)

Step 4: Setup the Gauge Block

1. Drag & drop the Gauge block from the dashboard nodes section to the Flow.

2. Change the Range of the Guage to 0 - 4095.

[Optional] Import Already Setup Nodes

If you had trouble setting up nodes, you can use the import feature in Magicblocks to get the nodes which has been already setup.

  • First copy this code to your clipboard.
  • Click on the options menu on the top right-hand corner of the screen.
  • Next hover your cursor over the Import sub-menu.
  • Then click on Clipboard and paste the code on your clipboard to the text field.
  • Select current flow or new flow and click on Import.


Make sure you type your device id on the Analog In node properties.

Step 5: Finally Deploying the Blocks

  • Make sure all the blocks are connected.
  • Click on Deploy button on the top right-hand corner of the screen.
  • After deploying go to the dashboard ui by clicking the link to dashboard URL on the top right-hand corner of the screen.
  • Connect the component to the Magicbit physically.
  • Any Moisture change in soil will the displayed on the Dashboard Gauge.


  • Check whether your Magicbit is connected to the internet.
  • Check whether the correct PIN is used (e.g. 'PIN 33').