This project builds on the Simple Arduino Music Keyboard but expands it to a full octave of chromatic notes. As there are more buttons this time, I’ve actually soldered this together onto a piece of stripboard and built in space to use an Arduino Nano as the controller.
- In Arduino Nano MIDI Keyboard I add MIDI out support.
This is a much more fiddly build and requires soldering, so if you are new to these kinds of projects, I’d recommend trying the Simple Arduino Music Keyboard instead.
Parts list
- Arduino Nano
- 8 ohm speaker or old headphone speaker
- 12x buttons
- 1x 220 resistor
- 12x 10k resistors
- female headers
- male header pins
- Strip (vero) board and jumper wires
The Circuit
As the stripboard design is hard to follow, I’ve also uploaded the equivalent schematic too, but it is essentially the same as the Simple Arduino Music Keyboard just with more connections. Note that the stripboard design is ‘back to front’ as the copper strips are on the top of this picture – they’d normally be on the underside, but this makes it easier to see. The tricky part is remembering where the cuts are required in this “mirror image” view.
I’ve used headers for the Arduino Nano to plug into. This reduces the chance of any damage to the Nano during construction and means it is easy to take out and reprogram or use elsewhere.
There aren’t enough digital pins for all the buttons (at least without repurposing the two pins used for the serial port, which is a world of pain), so two of the buttons are connected to two of the analogue pins, but used in “digital mode”.
The speaker is connected to pin 12.
The Code
The code is the same as the Simple Arduino Music Keyboard but with extra pins used and more notes defined.
Closing Thoughts
This is a lot more fiddly to build, and making sure all the tracks were cut in the right places is critical! In my first build, I’d missed a cut and found that +5V was directly connected to GND – something you really don’t want to find out when you power it up!
But I now have this a very simple piano keyboard which can be used for a range of further experiments. At some point I’ll use it to generate MIDI note messages and get it to play a real synthesizer.
Here are some pictures of my board (including my messy soldering).
Kevin