A Monome is a simple array of lights and switches, mainly used by musicians to control synthesisers, sequencers and mixers. It is an open hardware project and all schematics and code are freely available on the net. The home of the Monome is here and you can down load all you want. So what am I doing making one when all this is available? Well, the Monome only has single colour LEDs, and while the brightness can be controlled, it is all LEDs at once that are affected. This Monome uses RGB LEDs whose brightness can individually set to produce a very large range of colours. Most Monomes use four of the 4 by 4 Spark Fun switch key pads, this can be expensive and I wanted to explore an alternative idea. This implementation uses only a 4 by 4 matrix and is more of a technology prover for a much bigger project, but for now let’s see what to do.

Just the switch caps glowing

Underside of switches

The Mini Monome

Design

The basic design can be summed up as a multiplexed TLC5940 driven by an Arduino. The TLC5940 is a 16 channel PWM constant current LED driver. That means the LEDs are driven by a constant current set by a single external resistor so no resistors are required on the individual LEDs. Each LED is turned on and off with a duty cycle of 4096 steps to control it’s brightness. The on / off ratio determines the brightness, for example if the LED is on for half the time or 2048 clock cycles, and off for half the time then the LED is at only half brightness. The TLC5940 will control 16 LEDs at the same time, however, this project calls for 16 LEDs of the RGB type. That is each LED is actually three LEDs in the same package, giving a total of 48 LEDs to control. One solution would be to use three TLC5940s, but as there is a microprocessor in the equation we can use this to multiplex a single TLC5940, loading it with a new set of data for every row. If this is done for each LED faster that about 32 times a second then it appears to the eye that it is on continuously.

The TLC5940 controls the LEDs by means of a current sink, that is, it pulls the LED to earth. Therefore, in order to multiplex it we have to connect four cathodes, one on each row, to the input of the driver chip and the other end of the LEDs have to be pulled up to 5V when it is time to light up that row. This can be done with a p-channel FET, when it’s gate is a 5V then the FET is off or high resistance, when the gate is at earth then it is turned on, or has a very low resistance. The Arduino drives these FETs by pulling one low at any one time. However, during the time the Arduino is in reset, the output pins are automatically set as inputs, and so are high impedance. Therefore one of more FETs could be on at this time. To prevent this their is a pull up resistor on the gate of each FET, this ensures that the FET is always off unless driven low, and hence turned on, by the Arduino.

The schematic in essence is simple, what can make it appear complex is that being a matrix, the signals criss cross each other and this can look messy. The schematic shown here is simplified by not showing all the cathodes connecting together, but all the cathodes in a column should connect together. As the schematic is rather large there is a PDF of it 4 X 4 RGB LED Matrix.pdf available for download, this is in vector format so you can blow it up as large as you like without loosing quality.

Switches and LEDs

An RGB Monome based on the Arduino

As well as the LEDs there is a push switch associated with each point in the matrix. As we have to activate each row to multiplex the LED drivers, we can use this line to also multiplex the switches at the same time. Each switch is connected to the drive line and the other end, through a diode, to an input of the Arduino. If we had more columns we would use a shift register here but for four it is simpler to use input pins. The diode is needed to stop the switches interfering with each other when two or more are pressed at the same time. There is a 15K pull down resistor on each of the Arduino’s inputs so that normally it sees a logic zero. This, is then pulled up to a logic one if a button is pushed. Just as each successive row is activated, the inputs are scanned and the switch state is stored. I used the analogue inputs but defined them as digital inputs in the code.

Shield type mounting

Construction

You can spend quite a bit of money on the SparkFun keyboard PCB and silicone cover, and that’s before you fit LEDs in it. Besides, these keypads are of the resistive ink type, this technology can give trouble over the long term. I wanted to see if I could come up with a low cost alternative, using some simple push buttons I had. Also, I didn’t want to use a PCB, but to use prototype pad board. What I did, was to mount the LED and the switch as close as possible on the board. Then arrange for a plastic tube to slip over the LED with the wall of the tube hitting the switch. One end of the tube had a small piece of acrylic rod glued in the end and rubbed with sand paper to act as a diffuser. Finally, another short length of tube was glued on the other end, so that they didn’t fall out of the holes in the MDF top. I cut the rods up with a Proxxon chop saw, that allowed me to get them all the same length, well nearly. The tubes do a good job of mixing and diffusing the light, it is notoriously difficult to photograph LEDs as they usually look burnt out or washed out. The photos here don’t do the display justice, it is much better than this for real.

I mounted the MDF, LEDs and buttons, TLC5940 board and the Arduino in a four layer stack. I used hex pillars to separate the first three and plugged the Arduino into the base. To finish off the project I really need to give it sides and a base and then paint it all black. The wiring looks a bit of a mess but it is straight forward enough with the exception of the FETs. The only P-channel FET I had to hand was a surface mount type. However, it is possible to mount this between two tracks of strip board. It looks simpler in the diagram but there is also a photograph. If you are not confident of your fine soldering skills then look for a through the hole type. The top two connections on each side are all the drain and should be all soldered together.

The light diffusers worked really well but, lesson learned for next time, I would use thicker slices of acrylic rod and use fine sand paper to make them even, before I glued them in the tube. I would also do it to both sides of the acrylic. Also the lengths need to me more even than I managed, I have seen there is a hot wire cutter for these tubes so maybe this would produce a cleaner cut. What tended to happen with the chop saw was that as the cut was nearly complete the tube would sometimes get caught up on the cutting disk and get thrown out and a bit mangled.

Monme in a System

A Monome will do nothing without software, this can be written as an application or patch in a number of different systems. For example, max/msp is a music language popular with musicians, unfortunately it costs quite a lot. However, you can use other peoples applications using a free run time module, you can’t change what it does but you can run them. Pure Data or PD is a public domain free version of a max/msp like environment. They are not compatible in that you can’t run a program written on one on the other, but they do work and look rather similar. Chuck is a new and free language for generating sounds, and Processing is another free language but mainly for producing art type graphics and images. The thing they have in common is that they communicate with a Monome using a protocol called OSC (Open Sound Control) based on ethernet protocols. These applications feed their OSC into a translator application like Monome Serial or Arduino Serial and talk directly to the hardware.

USB ID

The job of the translator is to take the OSC commands and turn them into serial commands to send to the hardware. This also looks at the USB port to see if it can find a Monome to pass the data to. It recognises a Monome by it’s USB identifier and in order to get it to recognise the Arduino you either have to hack the translator, or change the Arduino’s USB ID. The translator source code is available but it is quite long and written in a mixture of C, C++ and objective C so it takes some unravelling. The simplest solution is to change the USB ID, this is known as “Flashing” the USB bridge. It will still work with the other Arduino software if you do this, but unfortunately you can only do this using a PC only application, so it’s time Boot Camp earned it’s keep.

First you need to download the drivers and the Mprog application onto your Windows partition:-

To have your board recognised as a Monome by MonomeSerial, or ArduinoSerial you have to enter something like

m40h-xxx

a40h-xxx

m64-xxxx

m128-xxx

m256-xxx

Where the xxx is a serial number, I used the ID a40h-123, the first part lets the translator application decide what protocol message to send in response to a particular OS message.

5/ Click on File > save as.

6/ Once saved, click on the flash icon (Program all existing devices, Ctrl+P).

7/ Unplug the board from the usb port.

8/ Boot up back into the Macintosh OS and breath a sigh of relief, maybe have a shower as you will feel dirty.

9/ Run ArduinoSerial, and you should see your device ID appear on the devices list.

Arduino Firmware

The full firmware package is available here Arduino_Arduino_Firmware.zip.zip. It has two parts, the library file Tlc5940mux and the application file Arduinome. Put the library in the normal place and the Arduinome files in your software folder. The library file is not all my own work but a hacked early version of an Arduino library, hacked to make it work with multiplexing. I used some extra commands to allow me to set the RGB values to use for all subsequent LED ON commands. These are unofficial and not supported by the Monome Serial application and I haven’t got round to hacking them in yet. Therefore the only way of testing them out is by talking the the board directly, Processing_Examples.zip is an example using the Processing language. One will allow you to set individual LEDs with a mouse click and the other two just selects a random colour and then plots it on a row with the other LEDs on the row the same colour but with one each of the R, G and B LEDs set to zero. I was not too bothered about what way round columns and rows were when I wired it up because I could easily change it round in software. That’s why you will see the x co-ordinate is swapped round in the commands in the Arduino software, feel free to modify this for your wiring.