MATLAB for Primary and Secondary Schools

Programming the BBC micro:bit with MATLAB and Simulink

BBC micro:bit is a pocket-sized programmable piece of hardware, designed for school children who want to advance their computational and coding skills. The main features of the micro:bit board include a set of LED lights, a couple of sensors: accelerometer and magnetometer, and Bluetooth Smart technology that enables connectivity to internet and interactions with other devices. Its simple easy-to-use interface and great affordability makes it an ideal stepping stone to working with more complex boards such as Raspberry Pi and Arduino.

The Simulink Support Package for BBC micro:bit allows users to work with the micro:bit and at the same time learn about Simulink, a professional piece of software used across a wide range of industries.

MathWorks and the BBC micro:bit Foundation

As a part of its strong commitment to STEM education and computational thinking, MathWorks developed a support package for BBC micro:bit which enables users to write programs and build models that run on the micro:bit. MATLAB and Simulink make it easy to program low-cost hardware, so users can effortlessly design and build interactive systems and engage in project-based learning.

Simulink Lessons and Examples for BBC micro:bit

By Dr. Venus Shum
University College London

and Clifford French
Camden School for Girls

This material introduces students to using Simulink to program BBC micro:bit board. The lessons guide users through the process of modelling a system and simulating its dynamic behavior. Within the same simulation environment used by scientists and engineers, students will learn about the computational concepts such as sequencing, time and event driven systems, control and feedback loops and multiplexing.

No prior knowledge of programming or working with hardware is required.

The content includes:

  • 10 lesson plans
  • 9 Simulink models

Course Outline:

  1. Flashing LED display
    • Building a Simulink model
    • Displaying a happy face on the micro:bit board
    • Animating a Heartbeat
    • Animating Fireworks
  2. Implementing a direction indicator for a bicycle
    • Using the built-in button on the micro:bit board
    • Displaying the left and right indicator
    • Running micro:bit models in external mode
    • Triggering the indicator by pressing the button
    • Viewing the accelerometer data
  3. Creating your own Simulink library

Learning Outcomes:

  • Learning the basic concepts of Simulink as a modeling language
  • Signal input and output
  • Abstraction (subsystem)
  • Multiplexing
  • Event vs. time driven system
  • Model reuse