Friday 13 February 2015

MIDI controlled electronic keyboard

MIDI keyboards? Yeah, they were cool.... in the 80s!

MIDI has been around for ages. It is still a pretty cool thing to get into if you're a musician and fancy playing with the "nuts and bolts" of music (Jason makes some awesome MIDI arpeggiators for example). Most electronic keyboards these days have some kind of MIDI support - but, more often than not, it's MIDI out. We're looking at building a keyboard with a MIDI IN port.

It's all in the pursuit of learning. Some people find music theory just plain confusing. Personally, I find it fascinating. All those "algorithms" to make scales and chords and stuff is pretty interesting. The problem comes when you have to apply the music theory and actually play something slightly melodic on your musical instrument. That's when things get tricky!

For a while we've been considering a light-up fretboard for a guitar, to practice and visual scales and chord shapes across the neck. Originally it was just going to be a bunch of LEDs and some custom-written software to drive them. Then it was suggested that a far more useful learning tool would be something that could accept MIDI data, and light up the corresponding key/note/fret, in time to the music.

That's what we're aiming for. But rather than jump into a guitar neck from the off, we're going to start with something a bit "simpler" - a piano keyboard.

First things first, we had to get hold of a piano-style keyboard.
This monster was for sale, locally, for £20. Given it has two layers of keys, there's loads of opportunity for expansion in the future, should it be deemed necessary. For now, we'll just focus on the top keys.



Now, before we go crazy with the Dremel and start making holes throughout the keyboard, a bit of planning is called for. We're essentially creating an array of LEDs which can be turned on and off by a microcontroller. Already it's crying out for a MAX7219 driver chip! These little devices use multiplexing to ensure a constant brightness across all LEDs, no matter how many are lit at the same tiem.

Thinking ahead, we might want to use the lower keyboard at some time in the future - perhaps to select a chord and have the scale displayed on the upper keys, or something like that. So we're going to want at least 12 input/buttons.

It'd be nice to be able to use the keyboard in a "standalone" mode too (for practicing scales, sorting out MIDI cables and getting a PC hooked up can be a bit of a faff). So some kind of input device and screen would be handy.

So we're going to need a load of inputs, quite a few outputs, preferably hardware UART (for the MIDI signals, which are just serial data, running at 31250 bps) - we're going to need a big microcontroller for this!

Not knowing how far we're going to go with the firmware, we plumped for a PIC 18F4550, just because we know that it has all the hardware peripherals we need, pull-up resistors on at least two input ports, can run at 20Mhz easily (up to 48Mhz if absolutely necessary) - and we've quite a few knocking about in the bits box!


A screen, a rotary encoder for selecting from some simple menus, a 16x2 character LCD display, some buttons and a MAX7219 LED driver. What more could you need?




No comments:

Post a Comment