DC Motor Micro:bit Project

Automatic sprinkler system with Micro:bit

Presentation of Automatic sprinkler system

An automatic sprinkler system is a type of irrigation system that uses a series of valves, pipes, and sprinkler heads to automatically water a lawn or garden. These systems typically include a control panel, which allows the user to set the watering schedule and specify which areas of the lawn or garden should be watered.

An automatic sprinkler system can be controlled using a variety of methods, such as a manual timer, a computer program, or even a smartphone app. The system typically includes a series of valves that open and close to control the flow of water to the different sprinkler heads. The valves are typically controlled by a central control unit, which can be programmed to turn the valves on and off at specific times.

Automatic sprinkler systems typically use a variety of sprinkler heads, such as rotary sprinklers, spray heads, or drip irrigation systems. These heads can be adjusted to deliver different amounts of water, depending on the type of plants or grass being watered.

A automatic sprinkler system can be a good choice for homeowners who want to save time and effort on watering their lawns and gardens, and also for commercial and industrial properties with large landscapes. They can also be designed to conserve water and to adapt to weather conditions by using sensors to detect rain or humidity and adjust the watering schedule accordingly.

It is important to note that installing an automatic sprinkler system can be a complex and costly task, and it may require a professional to properly design and install it. Also, it is important to comply with local laws and regulations regarding water usage, and to ensure that the system is properly maintained to prevent leaks or other issues.

Purpose of this project:

An automatic sprinkler system can be controlled using a Micro:bit microcontroller. The Micro:bit can be used to read input from sensors, such as a rain sensor or a soil moisture sensor, and use that information to control the valves that turn the sprinklers on and off.

One way to connect the Micro:bit to the valves is by using relays, which are electronic switches that can be controlled by the Micro:bit‘s digital output pins. The Micro:bit can send a signal to the relays, which in turn will open or close the valves to start or stop the water flow.

The Micro:bit can also be used to read input from a variety of sensors, such as a temperature sensor, humidity sensor or light sensor, and use that information to adjust the watering schedule. For example, if the sensor detects that the soil is already moist, the Micro:bit can send a signal to the relays to turn off the sprinklers, saving water and avoiding waste.

Additionally, the Micro:bit can be programmed to use the input from different sensors to adjust the watering schedule based on the weather conditions, time of day, and other factors, such as the temperature, humidity, and light levels.

This project consists of creating an automatic watering system for plants, which triggers a water supply only in case of need. Suitable for a single plant or a small plantation, this system can be replicated at different scales. It will allow you to maintain your plants in your absence, or to manage the growth of species particularly sensitive to moisture by setting fine adjustments. This automatic watering device will provide an opportunity to study the use of an analog signal from a sensor to activate a fairly powerful actuator (here an electric pump) using a relay.

Operating principle

Located close to the plant or plants to be monitored, the installation monitors the state of drought of the earth using a dedicated sensor, characterizing the resistance of the earth between two electrodes. This information is then used to activate, if necessary, a 5V pump, driven by a Micro:bit board to supply plants with water.

Required components


Micro:bit is a small, programmable computer developed by the BBC in the United Kingdom. It is designed to be easy to use and accessible to students and beginners, and can be used to learn coding and computer science concepts. The device features a 5×5 LED matrix, two programmable buttons, a built-in accelerometer and magnetometer, and a variety of input/output (I/O) pins for connecting sensors and actuators.

The Micro:bit can be programmed using a variety of programming languages including Python, JavaScript, and Microsoft Block Editor. It also has a built-in Bluetooth module, which can be used to connect to other devices such as smartphones or other Micro:bits for wireless communication.

The Micro:bit is widely used in educational settings as a tool for teaching coding and computer science, but it can also be used for a variety of projects and applications such as building robots, creating interactive games, and controlling devices via Bluetooth.

Micro:bit board a GPIO board

A Micro:bit GPIO (General Purpose Input/Output) Expansion Board is an accessory that can be used to extend the capabilities of a Micro:bit by providing additional input/output (I/O) pins. These pins can be used to connect sensors and actuators, such as LEDs, buttons, motors, and other electronic components.

The expansion board typically connects to the Micro:bit using a standard edge connector and provides a set of male headers that can be used to connect external components.

Soil moisture sensor

A soil moisture sensor is a device that measures the amount of water in the soil. These sensors typically work by measuring the electrical conductivity of the soil, which changes as the soil becomes wetter or drier. The sensors can be used in a variety of applications such as agriculture, gardening, and landscaping to help optimize irrigation and water usage.

There are different types of soil moisture sensors available, such as capacitive sensors, resistance sensors, and time domain reflectometry (TDR) sensors. Capacitive sensors measure the dielectric constant of the soil, which changes with the amount of water in the soil. Resistance sensors measure the resistance of the soil, which also changes with the amount of water in the soil. TDR sensors measure the time it takes for a pulse of energy to travel through the soil and return, and use that information to calculate the soil moisture content.

A soil moisture sensor can be connected to a Micro:bit, and the microcontroller can be programmed to read the sensor’s output and determine the moisture level of the soil. This information can then be used to control the valves of an automatic sprinkler system, for example, to turn on or off the water flow.

 5V water pump

A 5V water pump is an electrically powered pump that runs on a 5V DC power supply. These pumps are designed to move water or other liquids and are often used in a variety of applications such as aquariums, hydroponics, cooling systems, and small-scale irrigation. They can be controlled by a switch or a microcontroller, and can be powered by a variety of sources such as batteries, USB ports or wall adapters. Some examples of 5V water pumps include submersible pumps, centrifugal pumps and diaphragm pumps.


A relay is an electronic switch that is controlled by a low-voltage input signal and is used to turn the water pump on and off. It typically consists of an electromagnet, a switch, and a set of contacts. The electromagnet is activated by the low-voltage input signal, which causes the switch to close or open the contacts, allowing or cutting off power to the water pump. This allows for the water pump to be controlled remotely or by a microcontroller.

water tank

A water tank in a sprinkler system is a container that holds a supply of water that is used to supply the sprinklers. It can be used to store and pressurize the water that is used in the irrigation system. The water tank can be a part of the sprinkler system and can also be used as a backup water supply in case of a power outage or pump failure. The water tank can be made of various materials like plastic, metal or concrete. The size and capacity of the water tank will depend on the size of the irrigation system and the amount of water needed to be stored. The water tank is typically located underground or at ground level and can be connected to the pump and other components of the irrigation system.

connecting wires

Connecting wires are used to connect various components in an electronic circuit. They allow for the transfer of electricity, data, or signals between different devices and components.

When connecting wires to an Arduino or other microcontroller, it is important to pay attention to the correct pinout. The pinout refers to the arrangement of pins on the microcontroller and the corresponding function of each pin. The Arduino pinout can be found in the documentation provided by the manufacturer, or in various resources available online.

test plate

A test plate, also known as a test jig, is a device used to test electronic circuits and components. It is a board or plate that has been designed to hold and connect various components and devices in a specific configuration, allowing for the easy testing and measurement of their performance.

A test plate can be used to test various types of electronic circuits and components, such as microcontrollers, sensors, and actuators. It typically includes connectors and sockets for connecting wires, power supply and measurement devices such as multimeters, oscilloscopes, and power supplies.

Mounting the automatic watering system

To make the mounting, you can connect

For the soil moisture sensor:

  • pin (+) to pin 3.3V from Micro:bit
  • pin (-) to pin GND from Micro:bit
  • pin (S) to pin P1 from Micro:bit

 For Relay :

  • pin (+) to pin 3.3V from Micro:bit
  • pin (-) to pin GND from Micro:bit
  • pin (S) to pin P2 from Micro:bit
  • pin ON to pin (+) from 4 batteries

For the water pump:

  • the first terminal at the COM pin of the relay
  • the second terminal at the GND of the Micro:bit

Mounting 1

Mounting 2

Makecode program

Here is the Makecode program for the automatic watering system:

0 commentaire

Leave a comment

Votre adresse e-mail ne sera pas publiée.

Scroll to Top