Level Of Difficulty:
- Easy.
Parts List:
- 1 x BBC micro:bit.
- 2 x Crocodile Leads.
- 1 x Piezo Sounder.
Or The More Portable Option:
You Will Also Need:
- An Internet browser.
- A USB cable to connect the BBC micro:bit to the computer.
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.
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. 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. |
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.
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?©Kitronik Ltd – You may print this page & link to it, but must not copy the page or part thereof without Kitronik's prior written consent.
1 comment
Chad
Shared! This is AWESOME stuff! Thank you!