How to make an Irrigation Monitoring System with Micro:bit

Hello and welcome back! In this project, we’ll learn how to make an irrigation monitoring system using Micro: bit. For this, I mainly used a basic soil moisture sensor to measure the moisture content in the soil. I also used the Microsoft MakeCode platform to create the code using easy-to-use drag-and-drop code blocks it is perfect for beginners with no need for coding experience. To indicate the moisture levels, I have added an RGB LED module and an LCD screen. If you’re new to Micro: bit programming, please use our basic tutorials.
Additionally, you can upgrade this project using a mini water pump, which can automatically turn on and off based on the soil moisture readings. Specifically, you can complete this project with or without a Micro:bit starter kit.
- Our Irrigation System Projects – Click on me
- What is the Micro:bit board — Click on me
Ok, let’s do this project step by step. The required components are given below.
- Micro: bit V2 or V1 board x 1 — Our store / Amazon
- Micro: bit sensor shield x 1 — Our store / Amazon
- Soil moisture sensor x 1 — Our Store / Amazon
- LCD screen x 1 — Our store / Amazon
- I2C module x 1 — Our store / Amazon
- Jumper wires — Our store / Amazon
- Keyestudio BBC Micro: bit starter kit — Click on me
Disclosure: These Amazon links are Affiliate links. As an Amazon Associate, I earn from qualifying purchases.
Step 1
Firstly, identify these components.







Step 2
Secondly, connect the Micro:bit board to the sensor shield. I think you can do this easily with the sensor shield.

Step 3
Thirdly, connect the soil moisture sensor, LCD screen, and RGB LED module to the Micro:bit sensor shield. Refer to the circuit diagram below for guidance.










Step 4
Afterward, connect the Micro:bit board to your computer. Then, open the MakeCode website and create a new project.




- Now, you will see the MakeCode interface. After, add the I2C extension.


- Afterward, open the Python script tab and paste the following script into the empty space. You will now see the auto-generated code blocks. Alternatively, you can create the code manually using code blocks.
- Python Script and Circuit Diagram — Download
Value = 0
bar_length = 0
bar = ""
I2C_LCD1602.lcd_init(0)
# Loading animation
loading_messages = ["System Loading", "System Loading.", "System Loading.."]
for message in loading_messages:
I2C_LCD1602.show_string(message, 0, 0)
basic.pause(500)
# Blink indicator (P11) during loading
for index in range(3):
pins.digital_write_pin(DigitalPin.P11, 1)
basic.pause(300)
pins.digital_write_pin(DigitalPin.P11, 0)
basic.pause(300)
# Finalize startup
I2C_LCD1602.show_string("Ready!", 4, 1)
basic.pause(1000)
pins.digital_write_pin(DigitalPin.P11, 1)
I2C_LCD1602.clear()
# Display bar on LCD
# Small delay for stability
def on_forever():
global Value
Value = pins.analog_read_pin(AnalogReadWritePin.P10)
# Display moisture label
I2C_LCD1602.show_string("Moisture:", 0, 0)
I2C_LCD1602.show_number(Value, 9, 0)
# Clear the second line before updating it
I2C_LCD1602.show_string(" ", 0, 1)
if Value < 350:
I2C_LCD1602.show_string("Low Moisture", 0, 1)
pins.digital_write_pin(DigitalPin.P12, 0)
pins.digital_write_pin(DigitalPin.P13, 1)
else:
I2C_LCD1602.show_string("Sufficient Moist.", 0, 1)
pins.digital_write_pin(DigitalPin.P13, 0)
pins.digital_write_pin(DigitalPin.P12, 1)
basic.pause(500)
basic.forever(on_forever)




- Now, connect your Micro:bit board to the MakeCode platform. Finally, click the Download button.






Step 5
Finally, unplug the USB cable and connect an external power supply to the system. Now, you can test the project using a soil basket.




Troubleshooting tips
- Check the Power Source.
- Check the code blocks.
- Check the Drivers.
- Check the jumper wires.
How to make an Irrigation Monitoring System with Micro:bit