Adafruit LED Backpacks Created by lady ada Last updated on 2017-12-26 06:12:13 PM UTC
Guide Contents Guide Contents Overview 1.2" 8x8 Matrix 2 4 7 Mini 8x8 Matrix Software 10 0.8" 8x8 Matrix 13 Mini 8x8 Matrix Software 16 0.54" Alphanumeric Attaching the Backpack Attaching Header 19 19 23 Prepare the header strip: Add the Backpack: 23 24 Downloading the Arduino Library Wiring! Load Demo Library Reference ASCII data Writing Data 0.56" 7-Segment Backpack Seven-Segment Backpack Firmware 1.
Software Files HT16K33 8x16 LED Backpack Breakout 8x8 0.8" LED Backpack 8x8 1.2" LED Backpack 8x8 1.2" Bi-Color LED Backpack 16x8 1.2" LED Backpacks Quad 0.56" 7-Segment Quad 0.54" 14-segment Alphanumeric Quad 1.2" 7-Segment Bicolor 24-Bargraph © Adafruit Industries https://learn.adafruit.
Overview What's better than a single LED? Lots of LEDs! A fun way to make a small display is to use an 8x8 matrix or a 4-digit 7segment display. Matrices like these are 'multiplexed' - so to control 64 LEDs you need 16 pins. That's a lot of pins, and there are driver chips like the MAX7219 that can control a matrix for you but there's a lot of wiring to set up and they take up a ton of space.
The matrices use a driver chip that does all the heavy lifting for you: They have a built in clock so they multiplex the display. They use constant-current drivers for ultra-bright, consistant color (the images above are photographed at the dimmest setting to avoid overloading our camera!), 1/16 step display dimming, all via a simple I2C interface.
The product kit comes with a fully tested and assembled LED backpack, a 4-pin header and the matrix of your choice. A bit of soldering is required to attach the matrix onto the backpack but its very easy to do and only takes about 5 minutes. Of course, in classic Adafruit fashion, we also have a detailed tutorial showing you how to solder, wire and control the display.
1.2" 8x8 Matrix This version of the LED backpack is designed for the 1.2" 8x8 matrices. They measure only 1.2"x1.2" so its a shame to use a massive array of chips to control it. This backpack solves the annoyance of using 16 pins or a bunch of chips by having an I2C constant-current matrix controller sit neatly on the back of the PCB. The controller chip takes care of everything, drawing all 64 LEDs in the background. All you have to do is write data to it using the 2-pin I2C interface.
WATCH OUT! THE MATRIX MUST BE INSTALLED THE RIGHT WAY! Find the corner of the backpack with a filled in dot. Make sure that the text on the side of the matrix is on the same side as the filled dot WATCH OUT! THE MATRIX MUST BE INSTALLED THE RIGHT WAY! Slide the matrix into the backpack and flip it over. Triple check that the text is on the same side as the From Adafruit text © Adafruit Industries https://learn.adafruit.
Solder in all 16 pins Then clip the matrix leads short © Adafruit Industries https://learn.adafruit.
Now you're ready to wire it up to a microcontroller. We'll assume you want to use a 4pin header. You can also of course solder wires directly. Place a 4-pin piece of header with the LONG pins down into the breadboard. Place the soldered backpack on top of the header. Solder the four pins That's it! now you're ready to run the firmware! Mini 8x8 Matrix Software We wrote a basic library to help you work with the mini 8x8 matrix backpack.
capable micro. Wiring to the matrix is really easy Connect CLK to the I2C clock - on Arduino UNO thats Analog #5, on the Leonardo its Digital #3, on the Mega its digital #21 Connect DAT to the I2C data - on Arduino UNO thats Analog #4, on the Leonardo its Digital #2, on the Mega its digital #20 Connect GND to common ground Connect VCC+ to power - 5V is best but 3V also seems to work for 3V microcontrollers. Next, download the Adafruit LED Backpack library from github .
There are also a few small routines that are special to the matrix: setBrightness(brighness)- will let you change the overall brightness of the entire display. 0 is least bright, 15 is brightest and is what is initialized by the display when you start. You can call this function at any time to change the brightness of the -entire- display blinkRate(rate) - You can blink the entire display. 0 is no blinking. 1, 2 or 3 is for display blinking.
0.8" 8x8 Matrix This version of the LED backpack is designed for these very cute miniature 8x8 matrices. They measure only 0.8"x0.8" so its a shame to use a massive array of chips to control it. This backpack solves the annoyance of using 16 pins or a bunch of chips by having an I2C constant-current matrix controller sit neatly on the back of the PCB. The controller chip takes care of everything, drawing all 64 LEDs in the background. All you have to do is write data to it using the 2pin I2C interface.
Turn the backpack over so its sitting flat on the matrix. Solder all 16 pins. © Adafruit Industries https://learn.adafruit.
Clip the long pins. Now you're ready to wire it up to a microcontroller. We'll assume you want to use a 4pin header. You can also of course solder wires directly. Place a 4-pin piece of header with the LONG pins down into the breadboard. © Adafruit Industries https://learn.adafruit.
Place the soldered backpack on top of the header. Solder 'em! That's it! now you're ready to run the firmware! Mini 8x8 Matrix Software We wrote a basic library to help you work with the mini 8x8 matrix backpack. The library is written for the Arduino and will work with any Arduino as it just uses the I2C pins. The code is very portable and can be easily adapted to any I2Ccapable micro.
your arduinosketchfolder/libraries/ folder. You may need to create the libraries subfolder if its your first library. You'll also need to download the Adafruit GFX library that provides the graphics drawing routines. Follow the same instructions as above, but with Adafruit_GFX instead of Adafruit_LEDBackpack. Restart the IDE. Once you've restarted you should be able to select the File->Examples->Adafruit_LEDBackpack->matrix88 example sketch. Upload it to your Arduino as usual.
The default orientation for graphics commands on this display places pixel (0,0) at the top-left when the header is at the top and Adafruit logo at the bottom. matrix.setRotation() can be used to use the display in other orientations. © Adafruit Industries https://learn.adafruit.
0.54" Alphanumeric This version of the LED backpack is designed for two dual 14-segment "Alphanumeric" displays. These 14-segment displays normally require 18 pins (4 'characters' and 14 total segments each) This backpack solves the annoyance of using 18 pins or a bunch of chips by having an I2C constant-current matrix controller sit neatly on the back of the PCB. The controller chip takes care of everything, drawing all the LEDs in the background.
Turn the backpack over so it is sitting flat on the matrix. Solder all of the pins! © Adafruit Industries https://learn.adafruit.
© Adafruit Industries https://learn.adafruit.
Clip the long pins. © Adafruit Industries https://learn.adafruit.
Check your work, making sure each pin is nicely soldered, and there's no cold solder joints or shorted pins Attaching Header Prepare the header strip: Cut the strip to length if necessary. It will be easier to solder if you insert it into a breadboard - long pins down Add the Backpack: Place the backpack board over the pins so that the short pins poke through the breakout pads © Adafruit Industries https://learn.adafruit.
Solder all 5 pins! That's it! now you're ready to run the firmware on your Arduino! Downloading the Arduino Library We wrote a basic library to help you work with the alphanumeric backpack. The library is written for the Arduino and will work with any Arduino as it just uses the I2C pins. The code is very portable and can be easily adapted to any I2Ccapable micro. Begin by downloading our Adafruit LED Backpack library from github.
Wiring! Nex up, let's wire it up to an Arduino. We'll be using an Arduino.
Upload to your Arduino, and open up the Serial console at 9600 baud speed. You'll see each digit light up all the segments, then the display will scroll through the 'font table' showing every character that it knows how to display. Finally, you'll get a notice to start typing into the serial console. Type a message and hit return, you'll see it scroll onto the display! © Adafruit Industries https://learn.adafruit.
Library Reference For the quad displays, we have a special object that can handle ascii data for easy printing. You can create the object with Adafruit_AlphaNum4 alpha4 = Adafruit_AlphaNum4(); There's no arguments or pins because the backpacks use the fixed I2C pins. By default, the address is 0x70, but you can pass in the I2C address used when you initialize the display with begin alpha4.
the 16 bit digit you pass in for raw image has this mapping: 0 DP N M L K J H G2 G1 F E D C B A The first bit isn't used, you can make it 0 or 1 To turn on just the A segment, use 0x0001 To turn on just the G1 segment, use 0x0040 ASCII data If you're just looking to print 'text' you can use our font table, just pass in an ASCII character! For example, to set digit #0 to A call: alpha4.writeDigitAscii(0, 'A') Writing Data Don't forget to 'write' the data to the display with alpha4.
0.56" 7-Segment Backpack This version of the LED backpack is designed for these big bright 7-segment displays. These 7-segment displays normally require 13 pins (5 'characters' and 8 total segments each) This backpack solves the annoyance of using 13 pins or a bunch of chips by having an I2C constant-current matrix controller sit neatly on the back of the PCB. The controller chip takes care of everything, drawing all the LEDs in the background.
Turn the backpack over so it is sitting flat on the matrix. Solder all 14 pins. © Adafruit Industries https://learn.adafruit.
Clip the long pins. Now you're ready to wire it up to a microcontroller. We'll assume you want to use a 4pin header. You can also of course solder wires directly. Place a 4-pin piece of header with the LONG pins down into the breadboard. © Adafruit Industries https://learn.adafruit.
Place the soldered backpack on top of the header and Solder 'em! That's it! now you're ready to run the firmware! Seven-Segment Backpack Firmware We wrote a basic library to help you work with the 7-segment backpack. The library is written for the Arduino and will work with any Arduino as it just uses the I2C pins. The code is very portable and can be easily adapted to any I2Ccapable micro.
Once you're happy that the matrix works, you can write your own sketches. There's a few ways you can draw to the display. The easiest is to just call print - just like you do with Serial print(variable,HEX) - this will print a hexidecimal number, from 0000 up to FFFF print(variable,DEC) or print(variable ) - this will print a decimal integer, from 0000 up to 9999 If you need more control, you can call writeDigitNum(location, number) - this will write the number (0-9) to a single location.
1.2" 7-segment Backpack These backpacks drive the massive 1.2" 7-segment modules. With 2 leds per segment these make a gorgeous and impressive display. The 7-segment displays normally require 16 pins to drive. This backpack uses an I2C constantcurrent matrix controller on the back of the PCB, so you only need 2 pins to drive it! The controller chip takes care of multiplexing all the LEDs in the background. All you have to do is write data to it using the 2-pin I2C interface.
Turn the backpack over so its sitting flat on the matrix and ready to solder. © Adafruit Industries https://learn.adafruit.
Then solder each pin. There are 8 on each end for a total of 16. That completes the basic assembly. For use on a breadboard, you will want to also install a 5-pin header on the edge of the board. © Adafruit Industries https://learn.adafruit.
Clip the long pins close to the board. Cut the header strip to length if necessary and insert LONG pins down into the breadboard. © Adafruit Industries https://learn.adafruit.
Then solder all 5 pins. Now you are ready to wire it to your microcontroller. The required connections are: "D" - I2C Data Pin (SDA) "C" - I2C Clock Pin (SCL) "+" - 5v. (Will not run on 3.3v!) "-" - GND "IO" - I2C bus voltage. Due to the size of this display, there are 2 LEDs in series for each segment. Because of this, the display requires 5v to run. It will not run on 3.3v. For use with 3.3v processors, connect the IO pin to 3.3v. This will keep the I2C bus signals at a safe level for your processor.
Arduino Wiring - R3 and later Connect: D -> SDA C -> SCL + -> 5v - -> GND IO -> jumper to + for 5v. Arduino Due and Other 3.3v Processors Connect: D -> SDA C -> SCL + -> 5v - -> GND IO -> 3.3v Arduino "Classic" Wiring Connect: D -> Analog-4 or Digital 20 for the Mega C -> Analog-5 or Digital 21 for the Mega + -> 5v - -> GND IO -> jumper to + for 5v. OK, now on to the firmware! Seven-Segment Backpack Firmware Our 7-segment backpack library makes it easy to program these displays.
Installing Arduino Libraries https://adafru.it/aYM You'll also need to download the Adafruit GFX library - rename it Adafruit_GFX and install it as the LED backpack library. Close all open IDE windows and restart the IDE. Once you've restarted you should be able to select the File?Examples?Adafruit_LEDBackpack?sevenseg example sketch. Upload it to your Arduino as usual. You should see a "sevenseg" example sketch that will demonstrate various capabilities of the library and the display.
If you want a decimal point, call writeDigitNum(location, number, true) which will paint the decimal point. To draw the colon, use drawColon(true or false) If you want full control of the segments in all digits, you can call writeDigitRaw(location,bitmask) to draw a raw 8-bit mask (as stored in a uint8_t) to anylocation. All the drawing routines only change the display memory kept by the Arduino. Don't forget to call writeDisplay() after drawing to 'save' the memory out to the matrix via I2C.
Bi-Color 8x8 Matrix This version of the LED backpack is designed for these bright and colorful square=pixeled 8x8 matrices. They have 64 red and 64 green LEDs inside, for a total of 128 LEDs controlled as a 8x16 matrix. This backpack solves the annoyance of using 24 pins or a bunch of chips by having an I2C constant-current matrix controller sit neatly on the back of the PCB. The controller chip takes care of everything, drawing all 128 LEDs in the background.
When you buy a pack from Adafruit, it comes with the fully tested and assembled backpack as well as a 8x8 matrix. You'll need to solder the matrix onto the backpack but its an easy task. Remove the parts from packaging and place the LED matrix OVER the silkscreen side. The matrix must be soldered on the correct orientation or it will not work! Check for the side of the matrix that has printing on it.
Turn the backpack over so its sitting flat on the matrix. Solder all 24 pins. © Adafruit Industries https://learn.adafruit.
Clip the long pins © Adafruit Industries https://learn.adafruit.
Now you're ready to wire it up to a microcontroller. We'll assume you want to use a 4pin header. You can also of course solder wires directly. Place a 4-pin piece of header with the LONG pins down into the breadboard. Place the soldered backpack on top of the header. © Adafruit Industries https://learn.adafruit.
Solder 'em! Bi-Color 8x8 LED Backpack Firmware We wrote a basic library to help you work with the bi-color 8x8 matrix backpack. The library is written for the Arduino and will work with any Arduino as it just uses the I2C pins. The code is very portable and can be easily adapted to any I2C-capable micro.
Once you're happy that the matrix works, you can write your own sketches. The 8x8 matrix supports everything the Adafruit GFX library - drawing pixels, lines, rectangles, circles, triangles, roundrects, and small bitmaps. For more details check out the GFX page which will detail all of the GFX routines. All the drawing routines only change the display memory kept by the Arduino. Don't forget to call writeDisplay() after drawing to 'save' the memory out to the matrix via I2C.
Schematic © Adafruit Industries https://learn.adafruit.
Bi-Color 24 Bargraph This version of the LED backpack is designed for these bright and colorful bi-color bargraph modules. Each module has 12 red and 12 green LEDs inside, for a total of 24 LEDs controlled as a 1x12 matrix. We put two modules on each backpack for a 24-bar long bargraph (48 total LEDs). This backpack solves the annoyance of using lots of pins or a bunch of chips by having an I2C constant-current matrix controller sit neatly on the back of the PCB.
To keep the two bargraphs lined up nicely, you can use a little masking or scotch tape on the bargraph modules, tape them so they are in a straight line. There is a little play during soldering so if you don't do this the two modules may not be in a perfect line. © Adafruit Industries https://learn.adafruit.
Turn over the PCB and bend opposite-corner pins of the modules out so that the modules are fixed in place against the PCB. Now is a good time to do a last check that you oriented the modules the right way! Solder all the module pins in! © Adafruit Industries https://learn.adafruit.
OK nice work! © Adafruit Industries https://learn.adafruit.
Once soldered, clip each pin. They're quite short and the pins are thicker than usual, so do this over/inside a trash bin so that the pins don't fly off and it you or your pets. Everything should be neat and clipped, you're done! Soldering on breadboard pins This is an optional step - you only need to do this step if you're planning on using the bargraph in a breadboard. Chances are you may want to solder wires directly to the pads instead, so you can mount the bargraph elsewhere.
Break off a piece of male header, 4 pins long. Plug the long ends into a solderless breadboard. Place the PCB on top. you may need to support it a little since its quite long. © Adafruit Industries https://learn.adafruit.
Solder these 4 pins too, since you're good at it now this should be easy. Bi-Color Bargraph LED Backpack Wiring & Firmware We wrote a basic library to help you work with the bi-color bargraph backpack. The library is written for the Arduino and will work with any Arduino as it just uses the I2C pins. The code is very portable and can be easily adapted to any I2C-capable micro.
digital #20 Connect GND to common ground Connect VCC to power - 5V is best but 3V also seems to work for 3V microcontrollers. Next, download the Adafruit LED Backpack library from github . To download click the DOWNLOADS button in the top right corner, rename the uncompressed folder Adafruit_LEDBackpack. Check that the Adafruit_LEDBackpack folder contains Adafruit_LEDBackpack.cpp and Adafruit_LEDBackpack.h Place the Adafruit_LEDBackpack library folder your arduinosketchfolder/libraries/ folder.
Using the library interface is very easy. Start by creating the object with Adafruit_24bargraph bar = Adafruit_24bargraph(); you can name it whatever you want, not just bar Then initialize it with bar.begin(0x70); // pass in the address You can init with any address from 0x70 to 0x77, just make sure you solder in the matching solder jumpers! Finally, write to the bargraph with bar.setBar(lednumber, ledcolor); Where lednumber is 0 thru 23.
Connecting Multiple Backpacks The coolest part about the I2C backpacks is that you can connect more than one using just the same 2 pins. This opens possibilities for all kinds of multi-display projects. For a project that shows this is practice, check out this page on animating multiple LED backpacks Wire it Up To connect another backpack to your project, just wire it in parallel with the first one as in the diagram below. © Adafruit Industries https://learn.adafruit.
Configure the Address For each backpack you add, you need to configure a different I2C address. You can keep adding backpacks in the same way until you run out of addresses. See the next page for how to configure the address on your backpack. © Adafruit Industries https://learn.adafruit.
Changing I2C Address The HT16K33 driver chip on these LED backpacks has a default I2C address of 0x70. Since each device on an I2C bus must have a unique address, its important to avoid collisions or you'll get a lot of strange responses from your electronic devices! Luckily, the HT16K33 has 2 or 3 address adjust pins, so that the address can be changed! The mini 0.8" 8x8 matrix backpack has 2 address adjust pins. The 1.
Changing the address in your code Once you've adjusted the address on the backpack, you'll also want to adjust the address in the code! For the Arduino library we wrote, its simple. For example, lets say you want to have two seven-segment matrices. One is set to address 0x70 and the other is set to 0x71. Find this code in the example Adafruit_7segment matrix = Adafruit_7segment(); void setup() { Serial.begin(9600); Serial.println("7 Segment Backpack Test"); matrix.
© Adafruit Industries https://learn.adafruit.
F.A.Q. I want to use these modules with other non-Arduino, how can I port the code? The best way to get up and running is to read the HT16K33 driver datasheet available at http://learn.adafruit.com/adafruit-led-backpack/downloads - the backpacks all use this chip to do all the LED driving. You can cross-reference this document with the Arduino library code to adapt it to your platform.
Downloads Software Download the Adafruit LED Backpack library from github - This code provides support for the mini 8x8, 1.2" 8x8, 7segment, bargraph, alphanumeric and bicolor LED matrix backpacks. To download click the ZIP download button, rename the uncompressed folder Adafruit_LEDBackpack. Check that the Adafruit_LEDBackpack folder contains Adafruit_LEDBackpack.cpp and Adafruit_LEDBackpack.h Place the Adafruit_LEDBackpack library folder your arduinosketchfolder/libraries/ folder.
8x8 0.8" LED Backpack © Adafruit Industries https://learn.adafruit.
8x8 1.2" LED Backpack © Adafruit Industries https://learn.adafruit.
8x8 1.2" Bi-Color LED Backpack © Adafruit Industries https://learn.adafruit.
16x8 1.2" LED Backpacks © Adafruit Industries https://learn.adafruit.
Quad 0.56" 7-Segment © Adafruit Industries https://learn.adafruit.
Quad 0.54" 14-segment Alphanumeric Quad 1.2" 7-Segment © Adafruit Industries https://learn.adafruit.
Bicolor 24-Bargraph © Adafruit Industries https://learn.adafruit.
© Adafruit Industries https://learn.adafruit.