Bit Guide Poster

Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

Adafruit LED Backpacks

Created by Ladyada
Guide Contents

Guide Contents 2
Overview 3
Mini 8x8 Matrix 5
Mini 8x8 Matrix Software 8
0.56" 7-Segment Backpack 11
Seven-Segment Backpack Firmware 14
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 I2C-capable micro. 14
Bi-Color 8x8 Matrix 17
Bi-Color 8x8 LED Backpack Firmware 20
F.A.Q. 22
Downloads 23
Buy an LED Backpack 24

© Adafruit Industries http://learn.adafruit.com/adafruit-led-backpack Page 2 of 24


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 (http://adafru.it/aLG) or a 4-digit 7-segment display (http://adafru.it/aLH). 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 (http://adafru.it/453) 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. Here at Adafruit we feel
your pain! After all, wouldn't it be awesome if you could control a matrix without tons of wiring?
That's where these adorable LED matrix backpacks come in. We have them in two flavors - a
mini 8x8 (http://adafru.it/aLG) and a 4-digit 0.56" 7-segment (http://adafru.it/aLH). They work
perfectly with the matrices we stock in the Adafruit shop and make adding a bright little display
trivial.

© Adafruit Industries http://learn.adafruit.com/adafruit-led-backpack Page 3 of 24


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 backpacks come with
address-selection jumpers so you can connect up to four mini 8x8's or eight 7-segments (or a
combination, such as four mini 8x8's and four 7-segments, etc) on a single I2C bus.

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. We even wrote a very nice library for the backpacks so you
can get running in under half an hour, displaying images on the matrix or numbers on the 7-
segment. If you've been eyeing matrix displays but hesitated because of the complexity, his is
the solution you've been looking for!

© Adafruit Industries http://learn.adafruit.com/adafruit-led-backpack Page 4 of 24


Mini 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
2-pin I2C interface. There are two address select pins so you can select one of 4 addresses to
control up to 4 of these on a single 2-pin I2C bus (as well as whatever other I2C chips or
sensors you like). The driver chip can 'dim' the entire display from 1/16 brightness up to full
brightness in 1/16th steps. It cannot dim individual LEDs, only the entire display at once.

When you buy a pack from Adafruit, it


comes with the fully tested and
assembled backpack as well as a 8x8
matrix in one of the colors we provide
(say, red, yellow or green). 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. It can go 'either way' - the matrix is
symmetric so as long as it goes onto the
front it will work in any orientation. Do not
solder the matrix over the chip on the
back of the backpack - it will not work
then!

© Adafruit Industries http://learn.adafruit.com/adafruit-led-backpack Page 5 of 24


Turn the backpack over so its sitting flat
on the matrix.

Solder all 16 pins.

© Adafruit Industries http://learn.adafruit.com/adafruit-led-backpack Page 6 of 24


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 http://learn.adafruit.com/adafruit-led-backpack Page 7 of 24


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 I2C-capable micro.
Wiring to the matrix is really easy

Connect CLK to the I2C clock - on Arduino UNO thats Analog #5


Connect DAT to the I2C data - on Arduino UNO thats Analog #4
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 (http://adafru.it/aLI) . To download

© Adafruit Industries http://learn.adafruit.com/adafruit-led-backpack Page 8 of 24


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. You
may need to create the libraries subfolder if its your first library. You'll also need to download
the Adafruit GFX library (http://adafru.it/aJa) that provides the graphics drawing routines. 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.
You should see a basic test program that goes through a bunch of different drawing routines

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, rectancles, circles, triangles,
roundrects, and small bitmaps. For more details check out the GFX page which will detail all of
the GFX routines. (http://adafru.it/aJH)

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.

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
blinkRate(rate) - You can blink the entire display. 0 is no blinking. 1, 2 or 3 is for display
blinking.

© Adafruit Industries http://learn.adafruit.com/adafruit-led-backpack Page 9 of 24


© Adafruit Industries http://learn.adafruit.com/adafruit-led-backpack Page 10 of 24
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. All you have to do is write data to it using
the 2-pin I2C interface. There are two address select pins so you can select one of 8
addresses to control up to 8 of these on a single 2-pin I2C bus (as well as whatever other I2C
chips or sensors you like). The driver chip can 'dim' the entire display from 1/16 brightness up
to full brightness in 1/16th steps. It cannot dim individual LEDs, only the entire display at once.

When you buy a pack from Adafruit, it


comes with the fully tested and
assembled backpack as well as a 7-
segment display in one of the colors we
provide (say, red, yellow, blue or green).
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. DO NOT PUT THE DISPLAY ON
UPSIDE DOWN OR IT WONT
WORK!! Check the image belo w to
make sure the 'decimal po int' do ts
are o n the bo tto m, matching the
silkscreen.

© Adafruit Industries http://learn.adafruit.com/adafruit-led-backpack Page 11 of 24


Turn the backpack over so its sitting flat
on the matrix.

Solder all 14 pins.

© Adafruit Industries http://learn.adafruit.com/adafruit-led-backpack Page 12 of 24


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 http://learn.adafruit.com/adafruit-led-backpack Page 13 of 24


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 I2C-capable micro.

Wiring to the matrix is really easy

Connect CLK to the I2C clock - on Arduino UNO thats Analog #5


Connect DAT to the I2C data - on Arduino UNO thats Analog #4
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 (http://adafru.it/aLI) . 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. You
may need to create the libraries subfolder if its your first library. You'll also need to download
the Adafruit GFX library (http://adafru.it/aJa) - its not actually used for the 7-segment, its only for
the matrix backpacks but its still required. 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 basic test program that goes through a bunch of different routines.

© Adafruit Industries http://learn.adafruit.com/adafruit-led-backpack Page 14 of 24


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. Location #0 is all the way to the left, location #2 is the
colon dots so you probably want to skip it, location #4 is all the way to the right. If you want a
decimal point, call writeDigitNum(location, number, true) which will paint the decimal
point. To draw the colon, usedrawCo lo n(true or false)

If you wnat even more control, you can call writeDigitRaw(location,bitmask) to draw a raw
8-bit mask (as stored in a uint8_t) to that location.

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.

There are also a few small routines that are special to the backpack:

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
blinkRate(rate) - You can blink the entire display. 0 is no blinking. 1, 2 or 3 is for display
blinking.

© Adafruit Industries http://learn.adafruit.com/adafruit-led-backpack Page 15 of 24


© Adafruit Industries http://learn.adafruit.com/adafruit-led-backpack Page 16 of 24
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. All you have to do is
write data to it using the 2-pin I2C interface. There are three address select pins so you can
select one of 8 addresses to control up to 8 of these on a single 2-pin I2C bus (as well as
whatever other I2C chips or sensors you like). The driver chip can 'dim' the entire display from
1/16 brightness up to full brightness in 1/16th steps. It cannot dim individual LEDs, only the
entire display at once.

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.

© Adafruit Industries http://learn.adafruit.com/adafruit-led-backpack Page 17 of 24


Remove the parts from packaging and
place the LED matrix OVER the silkscreen
side.

The matrix must be so ldered o n


the co rrect o rientatio n o r it will
no t wo rk! Check fo r the side o f
the matrix that has printing o n it.
Then lo o k fo r the fro nt o f the PCB
that has a circle instead o f a
square in the co rner and line
tho se up as sho wn o n the left

Do not solder the matrix over the chip on


the back of the backpack - it will not work
then!

Turn the backpack over so its sitting flat


on the matrix.

Solder all 24 pins.

© Adafruit Industries http://learn.adafruit.com/adafruit-led-backpack Page 18 of 24


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 http://learn.adafruit.com/adafruit-led-backpack Page 19 of 24


Place the soldered backpack on top of
the header.

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.
Wiring to the matrix is really easy

Connect CLK to the I2C clock - on Arduino UNO thats Analog #5


Connect DAT to the I2C data - on Arduino UNO thats Analog #4
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 (http://adafru.it/aLI) . 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

© Adafruit Industries http://learn.adafruit.com/adafruit-led-backpack Page 20 of 24


the Adafruit_LEDBackpack library folder 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 (http://adafru.it/aJa) that provides the graphics drawing routines. Restart
the IDE.

Once you've restarted you should be able to select the File->Examples-


>Adafruit_LEDBackpack->bico lo r88 example sketch. Upload it to your Arduino as usual.
You should see a basic test program that goes through a bunch of different drawing routines

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, rectancles, circles, triangles,
roundrects, and small bitmaps. For more details check out the GFX page which will detail all of
the GFX routines. (http://adafru.it/aJH)

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.

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
blinkRate(rate) - You can blink the entire display. 0 is no blinking. 1, 2 or 3 is for display
blinking.

© Adafruit Industries http://learn.adafruit.com/adafruit-led-backpack Page 21 of 24


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 (http://adafru.it/aMx) - 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. Any microcontroller that has I2C host
support should be able to drive the backpacks but we only provide Arduino example code at
this time

The best way to get up and running is to read the HT16K33 driver datasheet available at <a
href="http://learn.adafruit.com/adafruit-led-
backpack/downloads">http://learn.adafruit.com/adafruit-led-
backpack/downloads</a><span class="pdf-short-link"> (http://adafru.it/aMx)</span> - 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. Any microcontroller that has I2C
host support should be able to drive the backpacks but we only provide Arduino example
code at this time<br><br>

© Adafruit Industries http://learn.adafruit.com/adafruit-led-backpack Page 22 of 24


Downloads

Download the Adafruit LED Backpack library from github (http://adafru.it/aLI) - This code
provides support for the mini 8x8, 7-segment and bicolor LED matrix backpacks.

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.
You may need to create the libraries subfolder if its your first library. You'll also need to
download the Adafruit GFX library (http://adafru.it/aJa) - its not actually used for the 7-
segment, its only for the matrix backpacks but its still required. Restart the IDE.
You'll also need to download the Adafruit GFX library (http://adafru.it/aJa) that provides the
graphics drawing routines, and must be installed even if you're not using the GFX routines!
Schematic and PCB files are available from Github (http://adafru.it/aLJ) - in Eagle 6 format.
The backpacks all use the HT16K33 chip solely for LED driving (http://adafru.it/aMy) - the
mini 8x8's use the 24 pin version and the others use the 28 pin vesion

© Adafruit Industries http://learn.adafruit.com/adafruit-led-backpack Page 23 of 24


Buy an LED Backpack
Buy an LED Backpack (http://adafru.it/aLK)

© Adafruit Industries Last Updated: 2012-08-13 11:45:54 PM EDT Page 24 of 24

You might also like