This is an OpenSource DIY STEAM Project to make a cool-looking functional miniature “Radar” system, which uses the BBC micro:bit (both v1/2) as the brain, a servo motor to sweep the area in front of it and an Ultrasonic Sensor to determine the distance towards any object within range.
We rely on a piece of p5.js code which runs within our browser
to render the Radar’s display. This p5.js code is compatible with any modern Windows, Mac, or Linux (or Android) computers capable of running a recent version of Google’s Chrome browser or its derivative.
Preparations:
Although we use our new MakeCode Arcade Shield for this video, this project can be replicated/ported to various other micro:bit expansion boards in the market, or can be achieved by only a standalone micro:bit using a few crocodile clips with wire.
1. BBC micro:bit v1/v2.
2. 3.3v compatible Ultrasonic Sensor module.
3. 3.3v compatible Servo Motor.
4. Wires needed to hook up all the components to the micro:bit.
You can also get all the tested & curated components/parts needed to successfully complete the project from our online store
:
https://tomatocube.com/product/project-microbit-ultrasonic-radar-educational-diy-kit/ (Micro:Bit Project Kit – Metal Eyelet version)
Instructions:

The project can be viewed as 2 main parts:
(A) Hardware part – With a microcontroller board, ultrasonic sensor & servo motor.
First, we attach the ultrasonic sensor to the horn of the servo motor. Then, as the servo motor sweeps through the various angle, it will carry & in turn, points the ultrasonic sensor toward a desired angle/direction (Yaw).
Whenever the servo motor settles at a new angle
, the micro:bit will take a sample of the distance
toward the object in front of it. Combining these two pieces of information, angle & the distance in mm, micro:bit will send a formatted string in the format of (angle, distance in mm) to the PC
via the USB connection.
(B) Software part – With the Radar display.
The Radar display is done entirely through a p5.js script running off their cloud-based editor
within our chrome browser (or any WebSerial compatible browser). So no software installation is needed locally.
Furthermore, with the underlying technology of p5.js code being a javascript app/page, we also manage to communicate
with our micro:bit hardware using WebSerial.
– Ultrasonic Radar micro:bit MakeCode:
– Ultrasonic Radar P5.js Code:
Now that we can retrieve the formatted string from the micro:bit, it is just a matter of writing code to draw out all the elements that make up a “Radar” screen.
Below is the wiring hook-up diagram of the entire Ultrasonic Radar system:

Putting everything together shouldn’t take more than an hour, and once completed, you will surely have an interesting piece of decor that is guaranteed to be a conversation starter during your next high-tea session.
Watch summarized instructional video here: https://youtu.be/a3EKd1XL8wA
*Disclaimer: This product is neither a real radar nor operates based on Doppler’s principles. It simply relies on the reflected sound wave in the ultrasonic frequency range.