A friend requested if it was possible to scroll text across three 8×8 LED matrices, specifically this type from Adafruit, which are very bright.
So, I got to work.
1. Give each Matrix a unique i2c address
These matrices uses a HT16K33 controller chip and communicate with the Pi via the i2c bus.
Adafruit have very good and detailed tutorials on how to solder it up and get i2c working between your Pi and your matrices.
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
Since we are having multiple matrices using the same i2c bus, we need to make sure that each uses a unique address. By default they will have 0x70 (hexadecimal notation). This value can be changed by brindgin the gap on some copper pads on the back of the matrix.
Adafruit have very good instructions on what needs to be done to give the maxtrices unique addresses;
http://learn.adafruit.com/animating-multiple-led-backpacks/wiring
[wp_ad_camp_4]
After joining some of the pads on two of my matrices, I used i2cdetect to scan my bus, 0x70, 0x71 and 0x72 was returned for the addresses of my matrices.
I am using a Rev B board and my bus is 1. If you get nothing back, check bus 0 with i2cdetect -y 0.
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 71 72 — — — — —
pi@raspberrypi ~ $
2. Download the code
pi@raspberrypi ~ $ cd scrollingtext_raspberrypi/
3. Install ncurses
Ncurses allows us to access the keyboard input in raw mode, allowing us to capture keyboard input without having to press the enter key after each keystroke.
4. Compile the program
Compile the program with;
5. Run it!
When starting the program, you need to specify the text you would like to scroll.
When the program is running, you can use these keys to change how it behaves
1
Scroll left
r
Scroll right
-
or +
to change the speed of the horizontal scroll
u
or d
to change the speed of the vertical scroll.
[wp_ad_camp_3]
2 thoughts on “Scrolling text with a Raspberry Pi and LED Matrix”