Lighting The Way

Interactive Lighting With Micro:bit

Interactive Lighting with Micro:bit Workshop

Interactive Lighting with Micro:bit Workshop

Aimed a secondary age young people, this online workshop shows attendees how to control a Light Kit containing LED pixels with a BBC Micro:bit. Come up with your own sequences and make an interactive light sculpture.

The BBC Micro:bit is a tiny computer that can be used to sense its environment and control things, such as lights and motors. The information on this page will show you how to use the Micro:bit to control an LED strip.

You will need a BBC Micro:bit (v1 or v2), plus a USB Cable and battery holder (the Micro:bit Go kit) and a strip of 5v RGB WS2812 LEDs (aka Neopixels) with crocodile clip connectors. Pimoroni and others) sell suitable LEDs - although you may have to add your own crocodile clips to the wires. YOU SHOULD NEVER TRY TO POWER MORE THAN 30 LEDS FROM A USB PORT OR BATTERY.

The Micro:bit Light Kit

The Micro:bit Light Kit we produced for Lighting The Way contained: a string of LED 'pixels' with crocodile clips; a USB cable, a BBC Micro:bit. and a battery holder. The USB cable will let you power the Micro:bit and LEDs while you program it with your computer. The battery will let you power the Micro:bit and LEDs without being connected to a computer

To power up your Micro:bit plug the big end of the red USB cable into your computer and the small end into the Micro:bit itself. The Micro:bit will switch on and run a demo program (or the last thing you wrote to it). It will also appear as a disc on your computer.

Now connect the LED strip to the Micro:bit. Squeeze the crocodile clips open and clip them to the holes on the Micro:bit. Black goes to GND, red goes to 3V, and yellow goes to 2. The LED string won't go on yet, but you are now ready to start programming!

Programming The BBC Micro:bit

BBC Micro:bit

You can program the Micro:bit by writing code on the BBC Micro:bit Website. We're going to use the MakeCode Editor, but you can program a Micro:bit in different ways, including with the popular Python language.


Click on the Let's Code link and then click on the MakeCode Editor link. This is going to let you create programs for the Micro:bit using graphical 'Blocks' (a bit like Scratch). It's the best way to learn programming the Micro:bit.

The MakeCode website is full of excellent resources to help you learn about the Micro:bit and how to program it. Perhaps begin by clicking on 'Show Instructions' and 'Start Tutorial'? There are also lots of Micro:bit videos on YouTube.

The Download link in the MakeCode Editor will create a file that can run on your Micro:bit. Drag this onto your Micro:bit disc to run your program. Some web browsers will allow you to connect directly to your Micro:bit to install programs.

Lighting Up The LED Strip

To use the LED strip with MakeCode you need to add the "Neopixel" extension. This will give you a set of new blocks that will control the LEDs. To do this create a new project, click on the "Advanced" menu item, then "Extensions" and then choose the "Neopixel" extension. You will now have the Neopixel blocks in your project.

S set of example programs that make use of the Neopixel extension are given below. These links will open the example, if you then click on the "Edit Code" button you will be able to download it to your BBC Micro:bit or edit it.

Example Programs

Video Lessons