LED Matrix Controller
A while ago, I got an LED matrix from SparkFun, and soon had it rigged up on a breadboard:
It could scroll any text I wanted, specified as a char array in the code. I had it working fairly well and decided to make a PCB for it…
A month or so later, the PCB arrived from BatchPCB:
I soldered it together pronto:
The resistors were a pain because there were so many, and the FT232RL was a pain because the pitch is so small, but overall I had no major problems and everything came together quickly.
PCB with an LED matrix plugged in:
Sadly I only have one LED matrix and SparkFun are all sold out of the medium sized RG ones; I’ve not been able to find them anywhere else either. While I wait for them to get back in stock, I’ll just work with one.
I was able to burn the Arduino bootloader code to the ATmega168 over the 10pin ICSP, and that worked fine, but then I ran into a few issues.
The first, and most prominent, was that every LED in a column lit up faintly when any of them were on. It turns out that this is because while my previous design had the cathodes connected to the shift register directly, the new design has transistors that pull the cathodes to ground. This means I have to write the shift register HIGH to get a low on the cathode. This was a an easy swap in the code.
The next problem was that the tops of each matrix were flipped over – row 4 appeared on row 1, row 3 on row 2, etc. This turns out to have been a problem in my circuit symbol for the LED matrix, I had the bottom 4 cathodes labelled backwards. Whoops!
Luckily this was easy to fix in software, so I soon had it all working:
However, this wasn’t the end of my issues. The ATmega168 is running at 12MHz from the FT232RL instead of using a seperate crystal and caps. However, the Arduino library expects the chip to be running at 16MHz, so all the serial timings are completely thrown off.
Luckily the ICSP header allows me to program it anyway, and this fits on next to the matrix, so it’s not a massive problem. This does mean that the computer can’t talk to the Arduino easily, however, which will make controlling it later a pain.
A bit of playing around in the software for the Arduino and I found a few defines I can set to get the Serial commands to run at 12MHz. This worked fairly well, I managed to get strings from the Arduino to the computer. All that’s left now is getting it working the other way, and ideally getting programming it to work.
I may make another PCB that is only through-the-hole and so easy to solder, using tinyUSB and just one matrix, possibly having them connect together. I could probably release this as a kit or similar, so watch this space!






Could you post a schematic of the board? I have a r/g matrix that is gathering dust and I want to use it, but have no clue of where to start
biojae said this on April 28th, 2008 at 1:23 am
you can find them on ebay for $0.99 From seller cstevenson88
biojae said this on April 28th, 2008 at 1:29 am
Here’s an image of the schematic:
https://randomskk.net/projects/led_matrix/rev06/schematic.png
I’ll upload the Eagle BRD and SCH files when I get back, sometime tonight.
Random said this on April 28th, 2008 at 6:42 am
could you also post your arduino code?
biojae said this on April 30th, 2008 at 11:42 pm
Okay, I’ve uploaded the sch, brd and code:
Eagle PCB layout:
http://randomskk.net/projects/led_matrix/rev06/rev06_routed_silkscreened.brd
Eagle Schematic:
http://randomskk.net/projects/led_matrix/rev06/rev06_routed_silkscreened.sch
Font header files:
http://randomskk.net/projects/led_matrix/rev06/font.h
Arduino Source (written as plain C, you need to remove the main() function and the WProgram include):
http://randomskk.net/projects/led_matrix/rev06/led_matrix.cpp
By the way – that eBay seller is indeed selling exactly the ones I want, but sadly only ships to the US!
Random said this on May 1st, 2008 at 4:26 pm
what would i have to modify to get it all into through-hole components?
biojae said this on May 1st, 2008 at 10:55 pm
The schematic should be the same, but in Eagle replace all the surface mounted parts with through the hole variants.
The board will probably require a redesign since the components are all different sizes but you can run tracks under resistors etc.
The code should still work so long as everything’s wired up similarly.
That said – why not try surface mounting? I was afraid of doing it at first, but after a small practise board I realised it’s actually not that hard and really fun to pull off, plus looks way better. Surface mounted components don’t cost much, so you may want to have a play on a small board and then perhaps try it out!
Random said this on May 1st, 2008 at 10:58 pm
I will have to try that sometime, I have already ordered my components through hole. I’m trying to make it as an arduino shield I will send you the board files after i am done and
you will be able to do whatever you want with them
biojae said this on May 2nd, 2008 at 4:15 am
speaking of wiring it up properly which pins on the 168 do you use in your code>
biojae said this on May 2nd, 2008 at 5:13 am
Pins 8, 9 and 10 go to the shift registers.
Random said this on May 2nd, 2008 at 4:07 pm
[...] the second matrix for my LED message board arrived [...]
Negative Acknowledge » Blog Archive » Dual LED Matrix Message Board said this on May 14th, 2008 at 6:37 pm
It appears on my led matrix that there are 8 anodes, and 16 cathodes. Would that make a difference to the schematic?
biojae said this on June 3rd, 2008 at 12:05 am
I’m guessing that just means you have a similar matrix with inverted LEDs – instead of the common cathodes of my one, you have common anodes.
The transistors will need to switch the anodes high to activate them, whereas in my design they are switched low – in other words the transistors need to be connected to vcc where they are currently connected to gnd.
Other elements won’t change, though the software will need to write lows to the cathodes to activate them, etc.
Random said this on June 3rd, 2008 at 1:39 am
thank you, and also where did you get the library containing your matrix?
biojae said this on June 4th, 2008 at 3:25 am
I actually made it myself, but it’s just two rows of 0.1″ header pins (i.e. M12 in the Sparkfun library) with a custom symbol to connect to all of them at once.
If you don’t want to make a library item it’l work fine to just use two M12 connectors and position them right, they fit onto the normal grid.
Random said this on June 4th, 2008 at 12:19 pm
wouldn’t i also switch the npn transistors for Pnp ones?
I heard they were mere efficient for power sourcing
biojae said this on June 5th, 2008 at 1:58 am
you’re right, for sourcing PNP transistors should be used rather than NPN.
Random said this on June 5th, 2008 at 11:41 am
Also the shift registers must be able to sink current – many can sink and source the same, but some are designed to only sink or only source.
Random said this on June 5th, 2008 at 11:42 am
the ones that i ordered are tri-state, sink,source, and high impedance
biojae said this on June 6th, 2008 at 2:41 am
They should be fine.
Random said this on June 6th, 2008 at 10:29 am
Hi Random. Would you by any chance be able to share your code? Mine is doing funky things and I’m getting frustrated haha. Thanks
john said this on June 20th, 2008 at 8:35 pm
Sure thing, source code is at http://randomskk.net/projects/led_matrix/rev06/led_matrix.cpp and http://randomskk.net/projects/led_matrix/rev06/font.h
Random said this on June 20th, 2008 at 9:14 pm
thanks. how did you program your atmel chip? through the ftd232 on the board you made? I have a USBTINYISP programmer.
john said this on June 26th, 2008 at 8:25 pm
I used the 10pin ICSP header in the middle of the board with my USBtinyISP. Going through the FT232RL didn’t work out so well, although that was my original plan. The ICSP method is faster anyway.
Random said this on June 26th, 2008 at 8:28 pm
oh never mind. i see you used the header on your board
john said this on June 26th, 2008 at 8:29 pm
hey im tryiing to modify mine to do some midi type things like the monome project.. any think that might be doable?
john said this on June 30th, 2008 at 4:17 am
I’m sure that would be doable, though obviously you’d need completely different code. You could send the visual data over the serial port and then display it on the matrix, but the monome project uses buttons as well which aren’t on the matrix.
Random said this on June 30th, 2008 at 6:38 pm
how are you sending the serial data to the displays? Are you using ‘Processing’ or something? Thanks for the help!
john said this on July 7th, 2008 at 7:20 pm
not sure why but i can’t get my ft232rl to upload either. hmm
john said this on July 17th, 2008 at 4:50 pm
Try using a lower baud rate, I think the line or the clock is noisy so transmissions at high bauds get garbled.
Random said this on August 7th, 2008 at 9:48 pm