My Cart:

0 item(s) - £0.00
You have no items in your shopping cart.

0

Use The BBC micro:bit As An Instrument Tuner

In this tutorial we are going to highlight how easy it is to code the BBC micro:bit as an instrument tuner. We will focus mainly on making a Guitar tuner but we will also provide code download links for several different types of tuner.

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

We love coming up with simple but useful applications for the BBC micro:bit. The ease with which these things can be done is a key strength of both the BBC micro:bit and the excellent code editors that are provided on the BBC micro:bit website. 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.
  • 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 microbit As An Instrument Tuner The Process:

  • Step 1 Build the circuit.
  • Step 2 Obtain the frequency values you need.
  • Step 3 Write the code.
  • Step 4 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 2 Obtain Frequency Values:

Each note has its own specific frequency, the units are expressed in Hertz (Hz), if you would like to make a tuner for other Guitar tuning's, such as drop C, you can substitute the frequencies we have chosen for ones that are more suitable. You can find some useful frequency information here.

All of our tuners feature the code block shown below, it causes a tone to be played via the sounder at the frequency shown for a specified number of milliseconds. You can edit either of these values to suit your needs.

Use The BBC micro:bit As An Instrument Tuner  -frequency-870

Step 3 Write The Code:

We've written some very simple code to respond to the following key-presses.

  • Pressing button A will: Play the lowest three open string notes on the Guitar (A, E & D).
  • Pressing button B will: Play the highest three open string notes on the Guitar (G, B & E).
  • 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 the Guitar tuner in the picture below.

BBC micro:bit As An Instrument Tuner -the-code-870

Step 4 Download The Code And Test:

We've created the code for five different types of instrument tuner, you can grab the code you want from the links below.

Choose your preferred option from the links above. Press the Edit button to view the code and then select compile. The code will now download to the default download folder on your computer.

Once you've downloaded the code from one of the links above, 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).

Note: You may find, when you cycle through the tones, that one of the notes sounds a little out. This can happen from time to time. Cycle through the notes again and the note that is out should be back in.

Electronic Project Kits
← Previous Post Next Post →

Leave a Reply