Micro:bit Project

Obstacle detection system with Micro:bit

Purpose of this project:

In this project we will create an alarm system with microb:bit. This alarm mainly uses an ultrasound sensor, buzzer and LED.

When the ultrasonic sensor detects an obstacle at a distance < 5cm, the micro:bit board orders the buzzer to ring and the red LED to light up.

Required components

  • Micro:bit board
  • Ultrasonic sensor (HC-SR04)
  • Buzzer
  • 1 resistance 220Ω
  • 1 red LED
  • Micro:bit GPIO Expansion Board
  • connection wires


To complete the assembly,

  • the red LED and buzzer can be connected to pin P0 of the micro:bit
  • the TRIGGER pin of the ultrasonic sensor to pin P1 of the micro:bit board
  • the echo pin of the ultrasonic sensor to pin P2 of the micro:bit board.

The mounting methods are numerous and here are some examples:

Mounting (1)

Mounting (2)

Makecode programme

Here is the makecode program of the audible alarm system:

0 commentaire

Leave a comment

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Scroll to Top