Coding Ireland STEM Report 2024 Have Your Say
Microbit Robotics Sensors & Circuits
Advanced
60 mins
235 points
What you need:
  • Computer/laptop
  • Microbit
  • Move Motor Car
  • USB Cable

Move Motor Measure

In this project we will use the sonar sensor on the front of the Move Motor Car to measure distances and send the result to another Microbit to display.

1 - Introduction

The aim of this project is to use the sonar sensor on the front of the Move Motor car to measure distances and to send the measurement to another Microbit where it can be read.

You will need the following for this project:

  1. 2 Microbits (1 that goes in the car and 1 for reading the measurement).
  2. A Move Motor car.

2 - How the sensor works

The Move Motor car has and ultrasonic sensor at the front of it.

What is an ultrasonic sensor?

An ultrasonic sensor is an instrument that measures the distance to an object using ultrasonic sound waves. An ultrasonic sensor uses a transducer to send and receive ultrasonic pulses that relay back information about an object’s proximity. High-frequency sound waves reflect from boundaries to produce distinct echo patterns.

How Ultrasonic Sensors Work

Ultrasonic sensors work by sending out a sound wave at a frequency above the range of human hearing. The transducer of the sensor acts as a microphone to receive and send the ultrasonic sound. The sensor determines the distance to a target by measuring time lapses between the sending and receiving of the ultrasonic pulse.

Source: MaxBotix




3 - Program the car Microbit

We will need to create 2 code projects:

  1. for the Microbit that will be inside the car.
  2. and another for the Microbit that will be display the measurement.

Let's create the code for the Microbit inside the Move Motor car first. Go to the https://makecode.microbit.org website and create a new project. Call it "Measure - Car" or something that let's you know that it's the project for the Microbit in the car.

Once you've created the new project, add the following code to set the radio group to 1. We will do the same later on the for the other Microbit project.

If this project is being done in a classroom with multiple cars then make sure each group uses a different radio group. Otherwise the signals will get crossed!

4 - Add the extensions

We need to add the following 2 extensions to this project:

  1. kitronik-move-motor
  2. radio-broadcast

Add the 2 extensions to your project.



5 - Set the units and the radio group

Using the sensor we can either measure distances in centimeters (cm) or inches. Add the following code to measure in cm and to set the radio group to 1. We will set the same radio group for the other Microbit project later.

Join our club 😃

To view the remaining 6 steps and access hundreds of other coding projects please login or create an account.

Copyright Notice
This lesson is copyright of Coding Ireland. Unauthorised use, copying or distribution is not allowed.
🍪 Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more