Lesson 8: Introduction to Micro:bit

Learning Objectives

By the end of this lesson, you will be able to:

  • Understand what the BBC Micro:bit is and how it works.

  • Identify the main parts and built-in features of the Micro:bit.

  • Recognize examples of Micro:bit projects.

  • Create a simple demonstration using Micro:bit’s built-in components.


What is Micro:bit?

The BBC Micro:bit is a small, programmable computer designed to make coding and electronics fun and easy for beginners. It’s about the size of a credit card but packed with powerful features that allow you to create games, control devices, and even build simple IoT projects.

You can program the Micro:bit using block-based coding (Microsoft MakeCode), Python, or JavaScript. It connects to your computer via USB or Bluetooth, making it very accessible for students.




Main Features of Micro:bit

  1. LED Display – A 5x5 grid of LEDs for showing text, numbers, and images.       


  2. Buttons – Two programmable buttons (A and B) for input.     


  3. Sensors – Built-in accelerometer (detects motion/tilt) and compass (magnetic direction).

  4. Temperature Sensor – Detects the surrounding temperature.

  5. Light Sensor – Measures light levels.

  6. Pins – For connecting external components like LEDs, buzzers, or motors.

  7. Wireless Communication – Bluetooth for sending/receiving data to other devices.


Examples of Micro:bit Projects

  • Step Counter – Using the accelerometer to count steps and display them on the LED grid.

  • Digital Compass – Showing directions using the compass sensor.

  • Temperature Alert – Displaying a warning when the temperature is too high or low.

  • Light Level Meter – Using the light sensor to measure brightness in a room.

  • Simple Games – Rock-Paper-Scissors or reaction time games using the buttons and display.    



Demonstration Idea

Demo 1: Light Level Display

  • Program the Micro:bit to read the built-in light sensor.

  • Show the light level as a number on the LED grid.

  • If the light level is low, display a sun icon to remind the user to turn on a light.

Demo 2: Temperature Display

  • Read the built-in temperature sensor.

  • Display the current temperature on the LED grid.

  • If the temperature exceeds a certain limit, display a warning symbol.

Demo 3: Button Counter

  • Use button A to count up and display the number on the LEDs.

  • Use button B to reset the count.                                                                                  


Tutorial: How to Use Micro:bit Online

1. Introduction

The BBC Micro:bit is a small, programmable microcontroller designed for learning coding and electronics. You don’t even need to own the physical device to start — you can use the online simulator to test your projects.


2. Accessing the Online Micro:bit Editor

  1. Open your browser (Google Chrome or Microsoft Edge is recommended).

  2. Go to: https://makecode.microbit.org

  3. You will see the MakeCode Micro:bit homepage with options to start coding.



3. Creating a New Project

  1. Click New Project.

  2. Give your project a name (e.g., “First LED Program”).

  3. Click Create.

  4. The coding workspace will appear — block-based code on the left, simulator on the right.



4. Understanding the Interface

  • Block Categories (left sidebar) – Code blocks grouped into categories like Basic, Input, Music, LED, Radio, etc.

  • Workspace (center) – Drag and arrange blocks here to create your program.

  • Simulator (top left) – A virtual Micro:bit showing how your code will run.

  • Menu Bar (top) – Options to save, share, or download your code.


5. Writing Your First Program

Example: Make the Micro:bit display a heart.

  1. In the Basic category, drag the show icon block into the workspace.

  2. Click the drop-down menu on the block and select the Heart icon.

  3. Place it inside the forever loop block.

  4. The simulator will instantly display a heart on the Micro:bit screen.



6. Adding Interactivity

Example: Display a smiley face when button A is pressed.

  1. Go to the Input category.

  2. Drag the on button A pressed block into the workspace.

  3. From the Basic category, drag the show icon block and place it inside.

  4. Select the Smiley face icon.

  5. Press Button A in the simulator — it will show a smiley.



7. Saving and Downloading Code

  • If you have a real Micro:bit:

    1. Click Download in the top right.

    2. Save the .hex file to your computer.

    3. Plug in your Micro:bit via USB — it will appear as a storage device.

    4. Drag and drop the .hex file into the Micro:bit drive.

  • If you don’t have a real Micro:bit:
    Use the simulator to test your program directly.


8. More Fun Projects to Try

  • Scrolling text (Basic → show string)

  • Temperature display (Input → temperature)

  • Shake detection (Input → on shake)

  • Simple games (Game category)

  • Music tones (Music category, requires physical Micro:bit with buzzer)



9. Tips for Beginners

  • Always test in the simulator before downloading to the device.

  • Save your project often — use the Save button.

  • Use comments (Advanced → More → Comment) to describe your code.

  • Explore the Tutorials section in MakeCode for step-by-step guided lessons.


10. Helpful Links



Comments