Research & Development

Posted by James Gibson on , last updated

Recently at BBC Research & Development, we got our hands on the new BBC micro:bit v2, a pocket-sized computer first launched in 2015 to help teach computer science. The first generation of this device was initially developed in collaboration with BBC R&D - as we described it back then: "[it's] an entry-level, pocket-sized computer that children can program to do all sorts of fun and clever things."

Two new features of the micro:bit v2 are the built-in speaker and microphone. To help you create new projects that use these, code blocks (ready-made components) such as; tone, pause, volume, tempo, and sound level have been added to the MakeCode editor.

So to test out these new features, 30 members of R&D took part in a workshop run by the Micro:bit Educational Foundation, where the brief was to split off into groups and create something from one of the following themes:

  • Re-enact a famous line from a film
  • Make a 'theremin' and perform a song with it
  • Make a mimic that perfectly sings a song

Below are three examples we created during the workshop. If you would like to give them a go and see what you could make, we have links to access the code in the MakeCode editor.


Taylor Swift Jukebox by Oscar Schafer

Taylor Swift Jukebox - micro:bit Example

Get and edit the code for this in the MakeCode editor

I explored how the micro:bit v2's new capabilities could be used to play out some hit tunes. Piecing together tone blocks of various lengths, I was able to put together recognisable snippets from various Taylor Swift songs. I put these sequences of tones into different function blocks which could then be called. To play a song snippet, you shake the micro:bit – triggering its "shake" gesture recognition. From there, a song is randomly selected and the appropriate function called. To add a visual element, I used the "show LEDs" block to spell out "TAY TAY" – with the letters radiating out from the centre pixel on the LED matrix.

Possible Extensions

A future development could maybe use some of the simple speech recognition demoed by the micro:bit team to create a guessing game where you have to say the name of the song played out.


Light Theremin by Henry Cooke

Light Theremin - micro:bit Example

Get and edit the code for this in the MakeCode editor

I made a theremin-like thing! It uses the micro:bit's light sensor, one of the buttons, and the speaker. While I hold down button A, a tone is played out of the speaker whose pitch is set by the amount of light detected by the sensor. I can then 'play' this like an instrument by waving my phone torch above the sensor and holding the button down when I want to sound a note. The fun thing about this is, it's very easy to make sliding notes by holding down the button while the torch moves.

Possible Extensions

There's a couple of possible extensions. First: tweaking the range of notes made, using the "map" block to map the amount of light detected by the sensor to a different range of frequencies of tone. Currently, it's C3 to B6, chosen fairly arbitrarily. Second: adding another control for volume level, so it's more like a 'proper' theremin. You could do this with the motion sensor, for instance, but then you'd be turning the light sensor away from the torch!


Light Theremin in C Major by Galen Reich

Light Theremin in C Major - micro:bit Example

Get and edit the code for this

For this example you will also need to copy this Python code to a MicroPython editor and use the editor to flash the Python code onto the micro:bit.

I also made a theremin-like musical toy! Like Henry's version, this one is played by changing the amount of light falling on the micro:bit. But my theremin plays notes in the C major scale over three octaves while holding the A-button down instead.

The program starts by calibrating the light level, beginning with the darkest light level and finishing with the brightest. Then the program waits for the A-button to be pressed before playing a note which corresponds to how bright it is.

Possible Extensions

There is no volume control in this program (it's either playing a note or not). A second micro:bit could be used to control the volume, and the in-built radio could be used to communicate the values between the micro:bits.


The micro:bit box

It's great to see the impact this device initially developed in collaboration with BBC R&D has had on computer science education across the globe and exciting to learn about the new v2 features which will hopefully mean it can continue to enable young people's interest in technology.

We had great fun making lots of fun noises with the new speaker, and we would love to see the results of what you manage to create, please tweet your creations to us @bbcrd @microbit_edu.

Thanks to Gareth, Jonny and Mark from the Micro:bit Foundation for facilitating the workshop. I hope that hearing about what we created with the new micro:bit has inspired you to see what you could make.

Tweet This - Share on Facebook

BBC R&D - Prototyping the BBC micro:bit

BBC R&D - Teaching coding to kids at Hack to the Future

BBC R&D - The Blue Peter Garden Explorer

BBC R&D - What Do Young People Want From a Radio Player?

BBC R&D - Inspiring Hacks at Hacked.io

BBC R&D - Digital Creativity: Making Building Fun

BBC R&D - Teen Tech Coventry

This post is part of the Future Experience Technologies section

Topics