Microbit Robotics Teacher Training
Intermediate
60 mins
Teacher/Student led
95 points
What you need:
Chromebook/Laptop/PC
Microbit

Compass

Embark on a journey to understand compass sensors, their functionality, and their role in robotics. Learn how to use the Microbit's built-in compass sensor, calibrate it for accurate readings, and write code to utilise it. Discover the wide range of applications for compass sensors in robotics.
Learning Goals Learning Outcomes Teacher Notes

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 - Understanding Compass Sensors

    A compass sensor is a device that can detect the Earth's magnetic field and provide directional information. In robotics, compass sensors are often used for navigation, orientation, and other direction-based tasks. They are especially useful in applications where a robot needs to maintain a specific heading or find its way back to a starting point.


    2 - How Compass Sensors Work

    Compass sensors work by detecting the Earth's magnetic field and converting it into an electrical signal. This signal is then processed by a microcontroller or microprocessor, which calculates the orientation of the sensor relative to magnetic north. The most common type of compass sensor used in robotics is a digital compass, which uses a magnetometer to measure the strength and direction of the magnetic field.

    3 - The Microbit Compass

    The microbit is a small, programmable microcontroller designed for teaching and learning digital skills. It has a built-in compass sensor that can be used to detect the direction it is facing. The compass sensor in a microbit is a magnetometer, which measures the strength and direction of the Earth's magnetic field.

    4 - Calibrating the Microbit Compass

    Before using the microbit's compass sensor, it needs to be calibrated. Calibration ensures that the sensor provides accurate readings by accounting for any magnetic interference or distortion. To calibrate the microbit compass, you'll need to rotate the microbit in all directions, following the on-screen instructions.

    input.calibrateCompass()

    5 - Programming the Microbit Compass

    To use the microbit's compass sensor in a project, you'll need to write code to read the sensor's data and perform the desired actions based on the direction it detects. 

    input.calibrateCompass()
    basic.showNumber(input.compassHeading())
    

    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