Tag Archives: matrix

Raspberry Pi and an 8×8 LED Matrix, using C.

Below is some information on how to get an 8x8 led matrix working on your Raspberry Pi using C.
I have also included the code needed to get text scrolling.

The matrix I am using is this one from Adafruit. This matrix uses a HT16K33 controller chip and communicates with the Pi via the i2c bus.


Adafruit has very good and detailed tutorials on how to solder it up and get i2c working between your Pi and the Matrix.
http://learn.adafruit.com/adafruit-led-backpack/
http://learn.adafruit.com/matrix-7-segment-led-backpack-with-the-raspberry-pi/configuring-your-pi-for-i2c


In brief;

  1. Scan the i2c bus for your device.
  2. Download the code needed.
  3. Compile.
  4. Run.



1. Scan i2c bus

Adafruit have some great instructions in the links above on how to do this.
When using i2cdetect to scan my bus, 0x70 was returned for the address of my matrix.
I am using a Rev B board and my bus is 1. If you get nothing back, check bus 0 with i2cdetect -y 0.

pi@raspberrypi ~ $sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: 70 -- -- -- -- -- -- --
pi@raspberrypi ~ $




Continue reading Raspberry Pi and an 8×8 LED Matrix, using C.