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

Begin by downloading our Adafruit LED Backpack library and the Adafruit GFX library from the Arduino library manager.

Open up the Arduino library manager:

Search for the Adafruit LED Backpack library and install it

When asked to install dependencies, click Install all.

We also have a great tutorial on Arduino library installation at:
http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use

You can use these with a 3.3v or 5v microcontroller. Just make sure the Vi2c pin is the same voltage as the logic on your microcontroller.

Wiring STEMMA QT Version

Here is an example of the STEMMA QT version wired to a Metro using the STEMMA QT connector on the backpack.

  • Board 5V to backpack Vio (red wire)
  • Board GND to backpack GND (black wire)
  • Board SCL to backpack SCL (yellow wire)
  • Board SDA to backpack SDA (blue wire)

Here is an example of the STEMMA QT version wired to a Metro using a solderless breadboard. This example also includes how to wire up the VHi pin, which makes the LEDs appear brighter.

  • Board 5V to backpack Vio (long red wire)
  • Board GND to backpack GND (black wire)
  • Board SCL to backpack SCL (yellow wire)
  • Board SDA to backpack SDA (blue wire)
  • Backpack VIO to backpack VHi (short red wire)

Wiring Original Version

  • Connect CLK to the I2C clock - on Arduino UNO thats Analog #5 (or SCL), on the Leonardo it's Digital #3, on the Mega it's digital #21
  • Connect DAT to the I2C data - on Arduino UNO thats Analog #4 (or SDA), on the Leonardo it's Digital #2, on the Mega it's digital #20
  • Connect GND to common ground
  • Connect VCC+ to power - 5V is best but 3V will work if that's all you've got (it will be dimmer)
  • Connect Vi2c to your microcontroller's logic level (3-5V) - If you're using an Arduino, this is almost certainly 5V. If its a 3V Arduino such as a Due, connect it to 3V

Both Vi2c and Vcc MUST be connected to 3 to 5VDC! Vcc is for the LED driver power, Vi2c is what sets the logic level for communication to the chip.

Load Demo

Restart the Arduino IDE and load up the File→Adafruit_LEDBackpack→quadalphanum demo

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!

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.begin(0x70);  // pass in the address
Next up, the segments can be turned on/off for each digit by writing the 'raw' bitmap you want, for example, all the LEDs off on digit #3 is
alpha4.writeDigitRaw(3, 0x0);
All the segments on for digit #0 is
alpha4.writeDigitRaw(0, 0x3FFF);
This is the segment map:

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.writeDisplay();
That's what actually 'sets' the data onto the LEDs!

This guide was first published on Jul 29, 2012. It was last updated on Sep 28, 2022.

This page (Arduino Wiring and Setup) was last updated on Jan 17, 2020.

Text editor powered by tinymce.