Use The BBC micro:bit As An Instrument Tuner
In this tutorial, we are going to highlight how easy it is to use the BBC micro:bit as an Instrument Tuner. We will focus on making a Guitar tuner but you can easily hack the code for any instrument or alternate tuning. Recent changes to the MakeCode Editor have made this a much easier task than it was previously.

Use The BBC micro:bit As An Instrument Tuner prs-p22-guitar-870

We love coming up with simple but useful applications for the microbit. The ease with which these things can be done is a key strength of the BBC micro:bit.  Within minutes of having an idea you can produce the code, drop it onto the BBC microbit and begin using your creation.

Level Of Difficulty:

  • Easy.

Parts List:


Or The More Portable Option:


You Will Also Need:


You Will Learn:

  • How to set up the BBC micro:bit as an instrument tuner.
  • Then, how to code the BBC microbit to produce a tone of your choosing.
If you've never used a tuner like this before, the principle is very simple; The sounder outputs a tone and you turn the tuning peg on the instrument until the sound of the string matches the tone from the sounder.  

Use The BBC micro:bit As An Instrument Tuner - The Process:

  • 1 Build the circuit.
  • 2 Write the code.
  • 3 Download the code and test.

Step 1 Build the Circuit:

We are going to highlight two different ways that you might approach connecting the BBC microbit to a sounder. The first method is to use two Crocodile leads to connect the sounder to the BBC microbit via the edge connector, as shown in the diagram below.

microbit instrument-tuner-guitar-circuit-870

If you use the same Piezo Buzzer that we used then it can be used either way around, as can be seen in the table below.
BBC micro:bit Pin. Sounder Pin.
GND Either sounder pin.
P0 The remaining sounder pin.
  The second method is as simple as connecting the BBC micro:bit to one of our MI:power boards for the BBC micro:bit. Once connected the code will work straight away as the board features a built in sounder that is connected in the right way once it has been assembled. See below for links to the product pages:

BBC micro:bit As An Instrument Tuner -watch-1-870

You can see the benefits that the portability of the MI:power can deliver in the above picture. You can find more ideas for making your BBC microbit projects more portable, including free dxf files, in this blog post.  

Step 3 Write The Code:

We've written some very simple code to respond to the following key-presses.
  • Firstly, Pressing button A will: Play the lowest three open string notes on the Guitar (A, E & D).
  • Then, Pressing button B will: Play the highest three open string notes on the Guitar (G, B & E).
  • finally, Pressing buttons A+B will: Quickly cycle through all six open string notes to serve as a final check.
We chose to display the note about to play on the BBC micro:bits LED matrix, then to have the note play for a specific period of time before moving onto the next note. You can see the full code example for a standard tuning Guitar tuner in the embedded editor below. Bonus Tip; try and sing the notes as you go to help to develop your ear at the same time!

Step 4 Download The Code And Test:

You can download the code directly from the embedded editor above. The download link is at the bottom of the editor. You can also click on edit to open the code in the online MakeCode editor, where you can tweak the code to suit. Once you've downloaded the code, connect your BBC microbit to your computer via USB. Navigate to the file you downloaded in your downloads folder and drag it straight onto the BBC micro:bit in File Explorer (Windows). You can now use your powered BBC micro:bit as an instrument tuner.  

Extension Task:

Do you play another tunable instrument like a Bass or ukelele? See if you can adapt the code for tuning other instruments. How do you use yours?

1 comment



Shared! This is AWESOME stuff! Thank you!

Leave a comment

All comments are moderated before being published