Print This Post Print This Post

MIDI Chord Button Keyboard Using PIC Microcontroller – 1

Every time I sit down to document one of my projects, I try to remember the occasions in the past when looking at the finished web page, I might say ‘Well, I won’t do that again!’, because despite how many drafts I’ve gone through, there is always some aspect of the presentation that fails to measure up to my expectations. Then there’s the question of boredom. I don’t want all my project pages to look exactly alike, just reasonably easy to look at and above all else accurate. Finally, there is the thorny issue of the media itself. Most will realise that these pages are formed using WordPress php code, with a few (very few!) additional pieces of my own php. Presentation using combinations of tables, pictures and lots of text hits size problems which I don’t understand, and moreover, I’m unwilling to spend hours, even days trying to fix, so that there is a finite limit to some post lengths. Rather than pushing the boundaries, and risk the non-presentation of a post, I intend keeping each article instalment reasonably small in future. This will also cut down the loading time from the http://joebrown.org.uk/wp root, which several users have noted has grown a little too long lately!

The article presented here documents an update of my MIDI Chord Button unit described originally on connectable.org.uk. That article used a 28 pin PIC and was written in PIC assembly language. The unit is still in use, and I decided to build a bigger, hopefully better unit, and write the code in ‘C’.

The unit supports a button matrix of (up to) 20 columns, by 8 rows. Each column is a particular musical key e.g. Ab, and each row a chord type, e.g. Maj7th. A momentary-action shift key provides for a further 8 chord types.

The basic mechanism for scanning the matrix is essentially the same as in the original article, and I don’t want to repeat work, simply for the sake of it. Those of you contemplating basing your own project on the following are urged to read the original article.

For the uninitiated, the 20 key columns are arranged in a virtual ‘circle of fifths’. Which means that if you learn a chord sequence, you can transpose up or down the keyboard and play the same sequence again in a different key. This is very similar to the stradella layout of some Italian chord button accordians, and makes a lot of sense, being relatively easy to play.

There is a table of the columns and keys in the original article, but I’ve provided a sample set of panels for the matrix, so make no excuses for showing the new layout here.

PIC MIDI Chord Button Keyboard - LH Side

PIC MIDI Chord Button Keyboard - LH Side

PIC MIDI Chord Button Keyboard - LH Side

PIC MIDI Chord Button Keyboard - RH Side

I’ve drawn the unshifted chords available on the LH side of the buttons and the shifted chords available on the RH side of the buttons, this has been repeated at each 4th multiple of the columns only, so as to reduce eye strain!

The small table below shows the layout in schematic form, with the base note value for each key/chord combination (given in hex). Note that the keys marked with the suffix ‘1′ represent an octave key – i.e. a musical key that is also further down the keyboard. Also note that I’ve followed the convention of the accordian and renamed the octave keys for Db as C#, Bb as A# etc. If you are confused, look at the base note values given, these will show the relationships.

Perhaps the best thing about a home-built instrument is that you can mash it up to do exactly what you want, and not what some manufacturer (or people like myself) think you want.

Because the full source-code will be provided, you can choose any layout you may prefer, and any different set of chords you prefer. Moreover, you can select different layouts at the touch of the control hexpad button.

Musical Key Db Ab Eb Bb F C G D A E B F# C# G# D# A# F1 C1 G1 D1 Musical Key
Note number 01 08 03 0a 05 00 07 02 09 04 0b 06 0d 14 0f 16 11 0c 13 0e Note Number
Unshifted Chords Shifted Chords
6th Aug
9th Sus
Maj Min9
Min 7b5
7th Aug7
Maj7 7Sus4
Min6 7b9
Min7 Dim (0)

As it stands, the arrangement above supports 20 columns – not a full two octaves. But if you wish, the hardware can be modified to support an extra 4 musical keys. In the matrix-decoder schematic below, note the spare, unused pins on the 74LS138N in the upper part of the drawing.

PIC MIDI Chord Button Keyboard Matrix Decoder Schematic

PIC MIDI Chord Button Keyboard Matrix Decoder Schematic

A few words about the schematic above. The two connectors on the left of the drawing connect to the keyboard matrix columns and rows. The socket on the far right is provided on the board so that both the 0.6 inch, and 0.3 inch wide versions of the 74LS154 can be accomodated.
SV1 and SV4 carry the 8 lines from PORT D on the PIC Microcontroller, which is located on a separate board. SV7, at the bottom right of the drawing, facilitates the connection of the 5v supply line and ground, together with the keydown strobe and it’s inverse.
It’s probably worth mentioning that strictly speaking, the top row of 10K resistors are not really necessary. I found these invaluable for testing purposes so left them in.

I’ll discuss the processor board and software in the next installment, but for now here are some photos taken during the prototype development.

First a close-up of the hexpad and processor board. The ribbon-cable connectors to the vero-board key matrix are just left of the hexpad.

Hexpad and processor board

Hexpad and processor board

The unit connected up and working.

Matrix decoder, hexpad and processor boards

Matrix decoder, hexpad and processor boards

The front of the working prototype.

Front of the working prototype. Panel is 500mm across

Front of the working prototype. Panel is 500mm across

Copy the code below to your web site.
x 
  • Share/Bookmark
PDF Download    Send article as PDF   

You must be logged in to post a comment.