Bjorklund: Hardware Notes

November 1, 2014

I’ve got the beer on ice, so tonight I will make a video demonstration of the finished item, and it has far surpassed my expectations! 🙂

Some quick snippets…

But first, here’s a catch-up on construction and materials used. Rather than explain in minute detail each step, I will for now just point to the resources that provided the most direct and useful information. They are the nuggets gleaned from numerous trawls through crappy/broken code and bad schematics. :/

I keep the power supply on a separate board. It’s a common diode-protected, RC filtered 5v regulated design…

MIDI output is easy-peasy…(but remember to map the pins of the ATMega)

The LED matrices are just too big for the breadboard, so I propped-them up on stackable headers to allow me access to the pins. I’m using 2 x MAX7219 driver chips. Connecting these to the ATMega and to each other was a breeze, however wiring the matrices themselves was a little tricky. I mostly followed the instructions here, however this wiring was not correct for my particular LED matrix (common cathode – from Tayda). I found the wiring diagram here to work for me.


The encoders were connected and via the MCP23017 I/O port expander. I got these encoders from Reichelt – they are quite stiff and they have been problematic.


Firstly they wouldn’t stay on the breadboard (legs too short!) so I made a breakout. Those funny protrustions are my attempt at hardware ‘debouncing’. I soldered sockets to the pins so that I could experiment with different capacitor values. In the end, 100n capacitors connected between each pin and common ground were best, although the encoders were still somewhat jumpy. I used a healthy dose of contact cleaner on each and this helped significantly. These encoders need to be ‘broken-in’.

In the code I am polling these controls according to this helpful post. This works well but is quite the resource drain. To circumvent this I tried using interrupts, however they proved even more problematic because they were detecting even the slightest tap of the encoders. Also, setting-up interrupts via the MCP23017 is no trivial task. I managed to fry two chips for my troubles. Interrupts are for another day….

In the next version I will abandon the mechanical encoders in favour of optical. I think the additional cost will be more than compensated by time spent, in frustration, fixing a problem that is beyond my control.

Finally there is a RGB LED which provides instant access to 7 colours as menu indicators. I’ve coded a state machine that allows me to turn 4 encoders into 40 controls, depending on what sequence of buttons is pressed. The mode is indicated by the single-or-mixed colours of the RGB. Thus there is always a clear visual indication of which menu is currently in use.


Overall, a fairly small parts count, easily obtained. Here is the Bill of Materials and sources:

Main Board:
1 x ATMega 328-PU
1 x 16MHz Quartz Crystal
2 x 22n Ceramic Capacitors
3 x 47K Resistors
1 x MCP23017 I/O Port Expander
2 x 8×8 Dot Matrix LED display – Common Cathode
2 x MAX7219 LED Display Drivers (Tayda’s are much cheaper, but apparently counterfeit. They work!)
4 x 24/24 Encoders (optical would be sooo much nicer)
10 x 100n Ceramic Capacitors
2 x 10uf Electrolytic Capacitors
1 x RGB LED 5mm Common Anode
3 x 220 Ohm Resistors
1 x 27K Resistor
Lots of jumper wire!

MIDI Output:
1 x MID DIN Socket
1 x 220 Ohm resistor

When I finish the code I will publish it, along with a proper schematic (hey, I’m still learning).



Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: