Playing Music through Speakers with the BBC micro:bit

Playing Music through Speakers with the BBC micro:bit

What is the BBC micro:bit – The BBC MicroBit (also referred to as BBC micro:bit) is an open source hardware ARM-based embedded system designed by the BBC for use in computer education in the UK. The BBC micro:bit was first announced on the launch of BBC’s Make It Digital campaign on 12 March 2015 with the intent of delivering 1 million devices to pupils in the UK.

BBC micro:bit

Here’s some of what’s packed into micro:bit –

  1. The micro:bit is half the size of a credit card and has an ARM Cortex-M0 processor
  2. The micro:bit comes along with an accelerometer and magnetometer sensors
  3. The micro:bit offers Bluetooth and USB connectivity
  4. Also embedded into the micro:bit front face is a display consisting of 25 LEDs and two programmable buttons

The micro:bit can be powered by either USB or an external battery pack. The device inputs and outputs are through five ring connectors that form part of a larger 23-pin edge connector. As a pocket-sized computer the BBC micro:bit is approximately 70 times smaller and 18 times faster than the original BBC Micro computers used in schools. It has 25 red LED lights that can flash eye catching messages and be used to create challenging games. The two programmable buttons on the micro:bit can be used to control games or pause and skip songs on a playlist. The accelerometer on the micro:bit can detect motion and knows when you’re on the move so you can use it to create a pedometer or even an interactive game that detects motion. The built-in compass knows which direction you’re heading in and it can use a low energy Bluetooth connection to interact with other devices and the Internet.

Playing music with the BBC micro:bit – Bring your projects to life with the Speaker Module for the BBC micro:bit from Waveshare. This speaker expansion module designed for micro:bit, allows you to add music player functionality and listen to the music either using a headphone or through the speaker on the board. This is a nifty little board that can be used to bring your micro:bit games, projects to life. Furthermore, this board can also be used for Arduino development. This board is compatible with other  3.3V/5V Arduino boards.

Check out the Speaker board for the BBC micro:bit here – Click Here for Speaker for BBC micro:bit.

Let’s have a brief look at the specifications for the speaker board for the BBC micro:bit –

  1. Dimensions:36.52mm*30.72mm
  2. Operating Voltage: 2.0V~5.5V
  3. On-board Speaker
  4. Dial for Volume adjustment
  5. Audio Earphone jack
External Speaker Board for the BBC micro:bit

There board is designed to allow you to connect the BBC micro:bit to the speaker in two different ways –

  1. Using off the shelf DuPont wires to connect the micro:bit to the speaker board
  2. Using alligator clip wires to connect the micro:bit to the speaker board
Speaker board connected to the BBC micro:bit

You should choose one of the options depending on what works best for you. So go ahead, follow one of the connection options and get your BBC micro:bit connected to the speaker board. Connections are to be made as follows –

  1. Ground from the BBC micro:bit connected to Ground on the speaker board
  2. 3V3 from the BBC micro:bit connected to 3V3 on the speaker board
  3. Pin 0 from the BBC micro:bit connected to Pin 0 on the speaker board

Let’s write some code – It’s time now to test out the capabilities of the speaker board for the BBC micro:bit. We have a few different options here and the choice of coding platform would depend on where you are with your STEM learning journey including what programming language, platform you are comfortable with.

You can write code for the BBC micro:bit using the Makecode (https://makecode.microbit.org) block based coding interface, Makecode Javascript editor including Micropython. Let’s have a look at some code examples based on the Makecode Block based coding editor. Feel free to fire up the Makecode interface and put together the blocks of code below.

Create music with the BBC micro:bit and external speakers – I
Create music with the BBC micro:bit and external speakers – II

Once you’ve put together the code using the Makecode Block based editor use the “Download” option to copy the Hex file to your micro:bit. All you need to do is just drag the Hex file onto the drive your BBC micro:bit shows up as. Once you’ve copied the code onto the BBC micro:bit reboot the micro:bit and press the buttons to play the music.

The BBC micro:bit is a powerful board and in addition to programming with Makecode Block, Javascript you can also program the board using Micropython. That’s what makes the BBC micro:bit a really powerful board for purposes of STEM learning. So now, let’s quickly have a look at a code example based on the Micropython.

Programming the BBC micro:bit in Micropython
Programming the BBC micro:bit in Micropython

Creating music with the BBC micro:bit and playing music with the speaker board for BBC micro:bit is super easy. From the examples above you would have seen that programming the BBC micro:bit to play sound through the external speaker board is both easy and lots of fun. We encourage you to try out many other tunes and play them through the speaker board.

Check out the Speaker board for the BBC micro:bit here – Click Here for Speaker for BBC micro:bit.


So if you are keen on keeping up with the Digital revolution head and help your kids gain the skills to move from being digital consumers to digital creators head over to KidzCanCode.com and checkout the 70+ learning courses we have on offer. Get yourself and your kids started on their own STEM learning journey right away!!!!!!

At KidzCanCode.com we offer FREE access to various STEM (Science, Engineering, Technology, Math) development courses at KidzCanCode.com . At KidzCanCode.com you will find courses on Scratch, BBC Micro:Bit, Arduino, Raspberry Pi, fundamentals and advanced Robotics, fundamentals and advanced Electronics, Web development, Mobile application development, Python development, 3D modelling, etc.

If you are looking for a BBC micro:bit, Arduino, Raspberry Pi, starter kits, electronics kits, robotics kits including other STEM learning kits we would recommend you drop by our online store here – <OzToyLib>. Hopefully you have enjoyed the post. If you have any questions, comments or suggestions for future tutorials drop us a note at – learning at hack2 dot live.

Hopefully you have enjoyed the tutorials. If you have any questions, comments or suggestions for future tutorials drop us a note at – learning at hack2 dot live.

0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments