Adafruit RGB Matrix + Real Time Clock HAT for Raspberry Pi Created by lady ada Last updated on 2018-10-04 09:39:28 PM UTC
Guide Contents Guide Contents Overview Pinouts I2C / RTC pins 5V protection circuitry and backpower diode Matrix Drive pins Matrix Color Pins Matrix Control pins RGB Matrix Address pins Assembly Solder on Headers and Terminal Block And Solder! 8 8 8 10 10 12 64x64 Matrices: Solder “E” Jumper Driving Matrices Step 1. Plug HAT/Bonnet into Raspberry Pi Step 2. Connect Matrix Power cable to terminal block Step 3. Connect RGB Matrix Data cable to IDC Step 4.
Overview You can now create a dazzling display with your Raspberry Pi with the Adafruit RGB Matrix HAT or Bonnet. These boards plug into your Pi and makes it super easy to control RGB matrices such as those we stock in the shop and create a colorful scrolling display or mini LED wall with ease. The RGB Matrix HAT works on any Raspberry Pi with a 40-pin GPIO header — Zero, Zero W/WH, Model A+, B+, Pi 2 and Pi 3. It does not work with older 26-pin boards like the original Model A or B.
This HAT is our finest to date, full of some really great circuitry. Let me break it down for you: Simple design - plug in power, plug in IDC cable, run our Python code! Power protection circuitry - you can plug a 5V 4A wall adapter into the HAT and it will automatically protect against negative, over or under-voltages! Yay for no accidental destruction of your setup. Onboard level shifters to convert the RasPi's 3.3V to 5.
Works with any of our 16x32, 32x32 or 32x64 RGB LED Matrices with HUB75 connections (https://adafru.it/emd). The latest “Rev C” HAT also supports 64x64 matrices by soldering a small jumper on the PCB. You can even chain multiple matrices together for a longer display - we've only tested up to 32x128 but it works just fine. The bigger the display the harder it is on the Pi, so keep that in mind if you're using a lower-powered Pi Zero. Please note: this HAT is only for use with HUB75 type RGB Matrices.
Pinouts This HAT uses a lot of pins to drive the RGB Matrix. You'll still have a couple left over but just be aware a majority are in use by the matrix. Unused GPIO pins include: RX, TX, 25, MOSI, MISO, SCLK, CE0, CE1, 19. Pin 24 is free if you are not using a 1/32 scan (i.e. 64x64) matrix. Pin 18 is free if using the “convenience” (vs “quality”) setting during installation. The 1-Wire interface as enabled by raspi-config will interfere with the operation of the matrix! By default it uses pin 4.
Amps That's if all the LEDs are on at once, which is not likely - but still, its good to have at least half for the power supply in case you get bright! 5V power from a wall plug goes into the DC jack on the HAT which then goes through a fancy protection circuit that makes sure the voltage is not higher than 5.8V - this means that if you accidentally grab a 9V or 12V plug or a reverse polarity plug you will not damage the HAT, Pi and panels.
Matrix Color Pins Pi GPIO #5 - Matrix R1 (Red row 1) pin This pin controls the red LEDs on the top half of the display Pi GPIO #13 - Matrix G1 (Green row 1) pin This pin controls the green LEDs on the top half of the display Pi GPIO #6 - Matrix B1 (Blue row 1) pin This pin controls the blue LEDs on the top half of the display Pi GPIO #12 - Matrix R2 (Red row 2) pin This pin controls the red LEDs on the bottom half of the display Pi GPIO #16 - Matrix G2 (Green row2) pin This pin controls the green LEDs on th
This pin is part of the 1->16 or 1->8 multiplexing circuitry. Pi GPIO #20 - Matrix D (address D) pin This pin is part of the 1->32, 1->16 multiplexing circuitry. Used for 32-pixel and 64-pixel tall displays only Pi GPIO #24 - Matrix E (address E) pin This pin is part of the 1->32 multiplexing circuitry. Used for 64-pixel tall displays only. Present on newer “Rev C” HATs only. Requires minor soldering, explained on next page. © Adafruit Industries https://learn.adafruit.
Assembly Solder on Headers and Terminal Block Before we can a-blinkin' there's a little soldering to be done. This step will attach the 2x20 socket header so that we can plug this HAT into a Raspberry Pi, the 2x8 header so we can plug the RGB matrix into the HAT, and a terminal block so you can power the matrix through the HAT. Start by plugging the 2x20 header into a Raspberry Pi, this will keep the header stable while you solder. Make sure the Pi is powered off! © Adafruit Industries https://learn.
Place the HAT on top so that the short pins of the 2x20 header line up with the pads on the HAT And Solder! Heat up your iron and solder in one header connection on the right. Once it is soldered, put down the solder and reheat the solder point with your iron while straightening the HAT so it isn't leaning down (For tips on soldering, be sure to check out our Guide to Excellent Soldering (https://adafru.it/aTk)). © Adafruit Industries https://learn.adafruit.
Solder one point on the opposite side of the connector © Adafruit Industries https://learn.adafruit.
Solder each of the connections for the top row Flip the board around and solder all the connections for the other half of the 2x20 header © Adafruit Industries https://learn.adafruit.
© Adafruit Industries https://learn.adafruit.
Check over your work so far, make sure each solder point is shiny, and isn't bridged or dull or cracked Place the 2 pin terminal block first, make sure the two 'mouths' are facing outwards © Adafruit Industries https://learn.adafruit.
Use some tape to stick the terminal down in place Flip the board over, the tape should keep the terminal block in place © Adafruit Industries https://learn.adafruit.
Solder the two big connections, use plenty of solder! © Adafruit Industries https://learn.adafruit.
Check your work, the connections should be solid and shiny Next up we will attach the 2x8 IDC header. Unlike the 2x20 header, this connector has a direction! Notice in the middle there's an outline for the connector in the middle. On the right it says HUB75 and on the left of the connector there is a little 'cutout' shape. This cutout shape must match up with the cut out on the connector.
Place the connector in the slot so that the notched side is on the left Use some tape to hold the IDC connector in place Flip the board over, the tape should keep the connector from falling out © Adafruit Industries https://learn.adafruit.
Solder in all the pins like you did with the 2x20 connector © Adafruit Industries https://learn.adafruit.
Check your work! Make sure all the solder points are clean and not shorted or cracked or dull Flip the board around & solder up the other half! © Adafruit Industries https://learn.adafruit.
Check your work one last time...now continue to testing! 64x64 Matrices: Solder “E” Jumper 64x64 matrices are supported on the latest “Rev C” HATs only. Look for the Address E pads located between the HUB75 connector and Pi camera cutout. Melt a blob of solder between the center “E” pad the the “8” pad just above it (for 64x64 matrices in the Adafruit shop)…or the “16” pad below (rare, for some third-party 64x64 matrices…check datasheet). © Adafruit Industries https://learn.adafruit.
Driving Matrices OK we're onto the fun part now! Be sure you have completed the Assembly step before continuing, the soldering is not optional Step 1. Plug HAT/Bonnet into Raspberry Pi © Adafruit Industries https://learn.adafruit.
Shut down your Pi and remove power. Plug the HAT or Bonnet on so all the 2x20 pins go into the GPIO header. Step 2. Connect Matrix Power cable to terminal block Your RGB matrix came with a red & black power cable. One end has a 4-pin MOLEX connector that goes into the matrix. The other end probably has a spade connector. If you didn't get a spade connector, you may have to cut off the connector and tin the wires to plug them into the terminal block © Adafruit Industries https://learn.adafruit.
Either way, unscrew the terminal blocks to loosen them © Adafruit Industries https://learn.adafruit.
Plug the red wire into the + side, and the black wire into the - side. Step 3. Connect RGB Matrix Data cable to IDC © Adafruit Industries https://learn.adafruit.
The RGB matrix also came with a 2x8 data cable. Connect one end to the matrix's INPUT side and the other end to the IDC socket on the HAT/bonnet. It wont damage the matrix if you accidentally get the cable connected to the output end of the matrix but it wont work so you might as well get it right first time! © Adafruit Industries https://learn.adafruit.
If you're using a 64x64 RGB matrix and either a Bonnet or a Rev C HAT, use your soldering iron to melt a blob of solder on the bottom solder jumper so the middle pad is 'shorted' to 8. (This is compatible with 64x64 matrices in the Adafruit store. For 64x64 matrices from other sources, you might need to use 16 instead, check the datasheet.) Step 4. Power up your Pi via MicroUSB (optional but suggested) Connect your Raspberry Pi to power via the microUSB cable, just like you normally would to power it up.
OK now you can plug in your 5V 2A or 4A or larger wall adapter into the HAT/bonnet. This will turn the green LED on but nothing will display on your matrix yet because no software is running! Check that the Matrix plugs are installed and in the right location © Adafruit Industries https://learn.adafruit.
IDC goes into the INPUT side (look for any arrows, arrows point from INPUT side to OUTPUT) Power plug installed, red wires go to VCC, black wires to GND Step 6. Log into your Pi to install and run software OK now you are ready to run the Pi software. You will need to get into a command line via the HDMI monitor, ssh or console cable. You will also need to make sure your Pi is on the Internet via a WiFi or Ethernet connection. We have a script that downloads the code and any prerequisite software.
Next the script will ask you what kind of adapter you’re using between the Pi and RGB matrix: either an Adafruit RGB Matrix Bonnet, or RGB Matrix HAT with RTC. If you select the latter, you’ll also be asked if you want to install additional drivers for the realtime clock. Then you’re asked whether you need the absolute best image possible from the LED matrix, or can accept slightly reduced quality for the sake of simplicity. The “quality” option comes at a cost.
The script will confirm your selections and offer one more chance to cancel without changes. There’s a lot of software to update, download and install, so it may take up to 15 minutes or so to complete. Afterward, you’ll be asked whether you want to reboot the system. If you’ve selected to install RTC support (for the Matrix HAT + RTC) or have made a change in the “quality” vs “convenience” setting, a reboot is required.
Here’s how to run one of the examples — a rotating colored square. Because this code is performing low-level hardware operations, it must be run using the sudo command: sudo ./demo -D0 --led-rows=32 --led-cols=16 That’s for a single 32x16 pixel RGB matrix. If you have a different size, change the --led-rows and/or --led-cols values. Add a --led-chain value if multiple matrices are chained. There are 12 different examples in the demo program (0 through 11), chosen with -D .
Graphics functions (lines, etc.) are here: The ImageDraw Module (https://adafru.it/dfH) Reminder: the older Adafruit fork of the RGB matrix library (https://adafru.it/ewy) is still available if you need it for existing code, but consider this deprecated. For new projects we recommend the more up-to-date hzeller code installed by the rgb-matrix.sh script! © Adafruit Industries https://learn.adafruit.
Using the RTC We had a little space and thought a real time clock would be a nice pairing for this HAT so we tossed on a DS1307 real time clock (RTC). This clock uses a 32.768KHz crystal and backup battery to let the HAT & Pi keep track of time even when power is lost and there's no network access. This makes it great for time displays! A 12mm 3V Lithium Coin Cell (CR1220) is REQUIRED to use the RTC! It will not work without one! (https://adafru.it/em8) The rgb-matrix.
HELP! I'm using a Raspberry Pi 2 and things are all not working right! Run sudo raspi-config and in the “Overclock” options set the core frequency to 350 MHz or less. Reboot and see if the image is stable. There seems to be an issue when toggling GPIO too quickly. Also see the “Driving Matrices” page for notes about dialing back the GPIO speed.
Downloads Datasheets DS1307 Real Time Clock (https://adafru.it/em5) MAX4866 5V protection chip (https://adafru.it/em6) Fritzing object in the Adafruit Fritzing Library (https://adafru.it/aP3) EagleCAD PCB files on GitHub (https://adafru.it/qHc) Schematic Click to embiggen Fabrication Print Here's the fabrication print with dimensions in inches. This HAT is compatible with the Raspberry Pi mechanical HAT specification! © Adafruit Industries https://learn.adafruit.
© Adafruit Industries https://learn.adafruit.