Microbit Robotics Sensors & Circuits
Intermediate
60 mins
Teacher/Student led
235 points
What you need:
Chromebook/Laptop/PC
Microbit
Move Motor Car

Move Motor Measure

In this step-by-step lesson, you'll learn how to use a sonar sensor on a Move Motor car to measure distances. You'll program two Microbits, one for the car and another for displaying measurements. The lesson covers understanding ultrasonic sensors, programming Microbits, and testing the setup. You'll need two Microbits and a Move Motor car for this project.
Learning Goals Learning Outcomes Teacher Notes Lesson Files

Live Class Feed

This is a live feed of the latest activity by your students on this lesson. It will update in real-time as they work on the lesson.
Load previous activity

    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.

    Unlock the Full Learning Experience

    Get ready to embark on an incredible learning journey! Get access to this lesson and hundreds more in our Digital Skills Curriculum.

    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