The IS31FL3731 will let you get back to that classic LED matrix look, with a nice upgrade! This I2C LED driver chip has the ability to PWM each individual LED in a 16x9 grid so you can have beautiful LED lighting effects, without a lot of pin twiddling. Simply tell the chip which LED on the grid you want lit, and what brightness and it's all taken care of for you.

The IS31FL3731 is a nice little chip - it can use 2.7-5.5V power and logic so its flexible for use with any microcontroller. You can set the address so up to 4 matrices can share an I2C bus. Inside is enough RAM for 8 separate frames of display memory so you can set up multiple frames of an animation and flip them to be displayed with a single command.

This chip is great for making small LED displays, and we even designed the breakout to match up with our ready-to-go LED grids in red, yellow, green, blue and white. Sandwich the driver and matrix breakout, solder together for a compact setup. Or you can DIY your own setup, just follow the LED grid schematic in the IS31FL3731 datasheet.

Pick up a driver board and your favorite color LEDs to match. You'll need to do some basic soldering to attach the driver backpack and matrix together, and run wires to your microcontroller, but its not too hard. Then install our Arduino code to get some LEDs blinking immediately. Our library is Adafruit_GFX compatible so you can draw lines, circles, text, and small bitmaps if you want more graphics control


The IS31FL3731 has a lot of pins, and we wanted to make it easy to use with a breadboard while sandwiched with an LED matrix. The easiest way we could figure out to do this is make the board as large as our 0603-LED 16x9 matrix grids and have a control header on one edge. That way you can solder the two long headers directly to the matrix and still have access to pins for power and data.

Power Pins

You can power the IS31 from 2.7-5.5VDC, but note that the same voltage is used for both power and logic.

If you are using a 5V logic device, just connect VCC to 5V.

If you are using a 3.3V logic, you can either power with 3.3V, which will work fine for red, yellow or light green LEDs or you can power from 5V and then use ~2.2K resistors from SDA and SCL to 3.3V to 'overpower' the built in 20K pullup resistors.

I2C Data Pins

This chip uses I2C for control, it does not use clock stretching or repeated start. There are built in 20K pullups to VCC. You can run it as fast as 400KHz clock speed, but you may need to add additional 2K pullups from SDA and SCL up to VCC for higher speeds

  • SDA - I2C data line, connect to your microcontroller's I2C SDA pin
  • SCL - I2C clock line, connect to your microcontroller's I2C SCL pin

Other Control Pins

  • SD - Shutdown pin, default pulled up to VCC. Connect to ground to put the chip in shutdown mode
  • AUD - Audio input, can be used to modulate the entire display with the amplitude of a line level audio signal, has a series capacitor installed.
  • ADDR and jumpers - By default the address is 0x74 but you can close one of the jumpers to change the address for up to 4 devices with varying addresses
  • INTB - Output interrupt from chip when using the built in animation modes

LED Grid

The LED Grid is much simpler, it just has 2 charlieplex grids, 16x9 total 0603 LEDs, with the two grids broken out to side pins that line up with the driver


Assemble the IS31 Driver Board

We'll start by soldering in the 7-pin 'control' header. Break the headers you received so that you have a 7-pin piece and follow these steps.

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 breakout board:

Place the breakout board over the pins so that the short pins poke through the breakout pads

And Solder!

Be sure to solder all pins for reliable electrical contact.

(For tips on soldering, be sure to check out our Guide to Excellent Soldering).

OK the control port header is done.

Check your solder joints visually and continue onto the next steps

Solder Driver Headers for LEDs

The two side strips are what are used to control the charlie-plexed LEDs

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 breakout board face up:

Place the breakout board over the pins so that the short pins poke through the breakout pads

And Solder!

Be sure to solder all pins for reliable electrical contact.

(For tips on soldering, be sure to check out our Guide to Excellent Soldering).

OK now you have the control and LED pads with headers.

Check your solder joints visually and continue onto the next steps

Attach LED panel

Now we'll sandwich on the charlieplexed LED panel

The LEDs face out and connect to the two side header strips.

The panel is symmetric - you can flip it around either way and it will work fine

Solder in the two long header strips. Not all are connected on the LED matrix but it makes the connections mechanically stable.

Check your solder joints visually and continue onto the next steps

Now you can trim the long header with diagonal cutters. Cut one or two pins at a time

Watch out for flying header bits. Wear eye protection and be careful!

Cut both sides down for the best look

You're done! Check your solder joints visually and continue onto the next steps

Arduino Wiring & Test

You can easily wire this breakout to any microcontroller, we'll be using an Arduino. For another kind of microcontroller, as long as you have I2C pins available, just check out the library, then port the code.


Use this wiring if you want to connect via I2C interface

  • Connect Vin to the power supply, 3-5V is fine. Use the same voltage that the microcontroller logic is based off of. For most Arduinos, that is 5V
  • Connect GND to common power/data ground
  • Connect the SCL pin to the I2C clock SCL pin on your Arduino. On an UNO & '328 based Arduino, this is also known as A5, on a Mega it is also known as digital 21 and on a Leonardo/Micro, digital 3
  • Connect the SDA pin to the I2C data SDA pin on your Arduino. On an UNO & '328 based Arduino, this is also known as A4, on a Mega it is also known as digital 20 and on a Leonardo/Micro, digital 2

Download Libraries

To begin reading sensor data, you will need to dowload the Adafruit IS31FL3731 library from the Arduino library manager.

Open up the Arduino library manager:

Search for the Adafruit IS31FL3731 library and install it

Search for the Adafruit GFX library and install it

We also have a great tutorial on Arduino library installation at:

Load Demo

Open up File->Examples->Adafruit_IS31FL3731->swirldemo and upload to your Arduino wired up to the driver & matrix

Upload to your Arduino, you'll see the LED display swirl different brightnesses!

Library Reference

Now that you have the demo working, you can control the matrix directly.


Start by creating a new matrix object with something like:

Download: file
Adafruit_IS31FL3731 ledmatrix = Adafruit_IS31FL3731();

There's no arguments to the constructor

Then in your setup, call begin(address) to initialize the driver. Begin() will return false if the matrix was not found, and true if initialization worked out

Download: file
  if (! ledmatrix.begin()) {
    Serial.println("IS31 not found");
    while (1);
  Serial.println("IS31 found!");


You can then draw to the display. Note that since we write directly to the driver RAM, any pixels 'drawn' will appear immediately.

You can start with drawPixel(x, y, brightness) where x ranges between 0 and 15 inclusive, and y ranges between 0 and 8 inclusive. Brightness is the PWM of the LED, 0 is off, and 255 is all the way on.

This loop will light up every LED in increasing brightness:

Download: file
int i = 0;
for (uint8_t x=0; x<16; x++) {
  for (uint8_t y=0; y<9; y++) {
    ledmatrix.drawPixel(x, y, i++]);

Adafruit GFX

Once you get pixels drawing, you can use Adafruit GFX to draw lines, rectangles, circles, text, etc.

The Adafruit_GFX library for Arduino provides a common syntax and set of graphics functions for all of our LED, TFT, LCD and OLED displays. This allows Arduino sketches to easily be adapted between display types with minimal fuss…and any new features, performance improvements and bug fixes will immediately apply across our complete offering of color displays.

Check out our detailed tutorial here http://learn.adafruit.com/adafruit-gfx-graphics-library It covers the latest and greatest of the GFX library!

Multiple Buffers

The IS31 has 8 full display frame buffers available. By default you draw and display to frame buffer #0

But! If you want to flip thru different images quickly, you can double buffer by writing to one buffer and then telling the IS31 to switch which one is visible.

To set which frame we are drawing to, use setFrame(n)
where n ranges from 0 to 7 inclusive

Download: file

Then when you are ready to display it, to set which frame we are displaying to, use displayFrame(n)
where n ranges from 0 to 7 inclusive

Download: file

Python & CircuitPython

It's easy to use the IS31FL3731 Charlieplex breakout, the Charlieplex FeatherWing, and the CharliePlex Bonnet with Python or CircuitPython and the Adafruit CircuitPython IS31FL3731 module.  This module allows you to easily write Python code that does all sorts of fun things with the LED matrix.

You can use CharliePlex LED matrices with any CircuitPython microcontroller board or with a computer that has GPIO and Python thanks to Adafruit_Blinka, our CircuitPython-for-Python compatibility library.

CircuitPython Microcontroller Wiring

First wire up a IS31FL3731 breakout to your board exactly as shown on the previous pages for Arduino.

For the FeatherWing, solder on the headers, and attach to the Feather.

Here's an example of wiring a Feather M0 to the breakout with I2C:

  • Board 3V to sensor VCC
  • Board GND to sensor GND
  • Board SCL to sensor SCL
  • Board SDA to sensor SDA

And here is the CharlieWing on a Feather M4:

  • Assemble the CharlieWing by soldering headers onto the board.
  • Once assembled, plug it into a Feather!

Python Computer Wiring

Since there's dozens of Linux computers/boards you can use we will show wiring for Raspberry Pi. For other platforms, please visit the guide for CircuitPython on Linux to see whether your platform is supported

For the Bonnet, simply attach the Bonnet to your Raspberry Pi header.

Here's the Raspberry Pi wired to the breakout with I2C:

  • Pi 3V3 to sensor VIN
  • Pi GND to sensor GND
  • Pi SCL to sensor SCL
  • Pi SDA to sensor SDA

Here is the CharliePlex Bonnet on a Raspberry Pi Zero:

The CharliePlex Bonnet comes fully assembled. Simply plug it into your Raspberry Pi!

CircuitPython Installation of IS31FL3731 Library

You'll need to install the Adafruit CircuitPython IS31FL3731 library on your CircuitPython board.

First make sure you are running the latest version of Adafruit CircuitPython for your board.

Next you'll need to install the necessary libraries to use the hardware--carefully follow the steps to find and install these libraries from Adafruit's CircuitPython library bundle.  Our CircuitPython starter guide has a great page on how to install the library bundle.

For non-express boards like the Trinket M0 or Gemma M0, you'll need to manually install the necessary libraries from the bundle:

  • adafruit_is31fl3731.mpy
  • adafruit_bus_device

Before continuing make sure your board's lib folder or root filesystem has the adafruit_is31fl3731.mpy, and adafruit_bus_device files and folders copied over.

Next connect to the board's serial REPL so you are at the CircuitPython >>> prompt.

Python Installation of IS31FL3731 Library

You'll need to install the Adafruit_Blinka library that provides the CircuitPython support in Python. This may also require enabling I2C on your platform and verifying you are running Python 3. Since each platform is a little different, and Linux changes often, please visit the CircuitPython on Linux guide to get your computer ready!

Once that's done, from your command line run the following command:

  • sudo pip3 install adafruit-circuitpython-is31fl3731 adafruit-circuitpython-framebuf

If your default Python is version 3 you may need to run 'pip' instead. Just make sure you aren't trying to use CircuitPython on Python 2.x, it isn't supported!

CircuitPython & Python Usage

To demonstrate the usage of the sensor we'll initialize it and manipulate the LED matrix from the board's Python REPL.

NOTE: Due to size and design of each CharliePlex matrix form-factor, import and initialisation is different for each. Make sure you're running the correct code for your matrix!

First, run the following code to import the necessary modules and create the I2C object:

Download: file
import board
import busio
import adafruit_is31fl3731
i2c = busio.I2C(board.SCL, board.SDA)

If you're using the CharliePlex breakout, initialise it by running the following code:

Download: file
display = adafruit_is31fl3731.Matrix(i2c)

If you're using the CharliePlex FeatherWing, run the following code:

Download: file
display = adafruit_is31fl3731.CharlieWing(i2c)

If you're using the CharliePlex Bonnet, run the following code:

Download: file
display = adafruit_is31fl3731.CharlieBonnet(i2c)

When the display initializes it will go through and clear each frame (there are 8 frames total) of the display. You might see the display momentarily flash and then turn off to a clear no pixel lit image.

You can control all of the board's pixels using the fill function. Send to this function a value from 0 to 255 where 0 is every LED pixel turned off and 255 is every LED pixel turned on to maximum brightness. For example to set all the pixels to half their brightness run:

Download: file

You might notice some buzzing or ringing sounds from the display when all pixels are lit, this is normal as the Charlieplex driver quickly switches LEDs on and off.

If you've used other displays like LED matrices you might notice the Charlieplex module doesn't need to have a show function called to make the changes visible.  As soon as you call fill or other display functions the display will update!

You can turn all the pixels off with fill set to 0:

Download: file
Be careful setting all pixels to 255 maximum brightness! This might pull more power than your computer's USB port can provide if you are powering your board over USB. Use an external powers supply or battery when lighting lots of LEDs to max brightness.

Now for some fun!  You can set any of the LED pixels using the pixel function.  This function takes the following parameters:

  • X position - The location of the horizontal / X pixel position.
  • Y position - The location of the vertical / Y pixel position.
  • Intensity - This is a value from 0 to 255 which specifies how bright the pixel should be, 0 is off and 255 is maximum brightness.  Use an in-between value to show a less bright pixel.

For example to set pixel 0, 0 to full brightness run:

Download: file
display.pixel(0, 0, 255)

Or to set the pixel next to it horizontally to half brightness run:

Download: file
display.pixel(1, 0, 127)

You can turn off individual pixels by setting them to an intensity of zero.

You can even make pixels blink!  The board supports a fixed blink rate that you set using the blink function.  This function takes in the number of milliseconds to use for the blink rate (but internally it can only blink in 270ms increments so you might not get an exact match).  For example to blink pixels about once every half second call:

Download: file

You'll notice nothing actually changes on the board. This is because in addition to intensity each LED pixel has a blink state which can be enabled and disabled. The fill command can actually set all pixels and turn them on to blink:

Download: file
display.fill(127, blink=True)

You can turn off the blinking by setting blink=False.

The pixel command supports the blink parameter too!  You can turn on and off blinking pixel by pixel as needed.  For example to turn on blinking for pixel 0, 0:

Download: file
display.pixel(0, 0, 127, blink=True)

Currently the Charlieplex module is very simple and only exposes pixel set commands.  In the future more advanced graphics commands like line drawing, text display, etc. might be implemented but for now you'll need to manipulate the pixels yourself.

Finally the display supports holding up to 8 frames of pixel data.  Each frame contains an entire matrix of LED pixel state (intensity, blinking, etc.) and by default the module starts you on frame 0.  You can change to start displaying and drawing on another frame by calling frame which takes these parameters:

  • Frame number - This is the frame number to make the active frame for display or drawing.  There are 8 frames total, 0 through 7.
  • show - An optional boolean that defaults to True and specifies if the frame should be immediately displayed (True) or just made active so that pixel and fill commands draw on it but it's not yet shown.

For example to clear frame 1 and draw a few pixels on it, then display it you can run:

Download: file
display.frame(1, show=False)
display.pixel(0, 0, 255)
display.pixel(1, 1, 255)
display.pixel(2, 2, 255)
display.frame(1)  # show=True is the default, the frame will be displayed!

Notice how the first call switches to make frame 1 the active frame but doesn't display it because show is set to false. Then the frame pixel data is changed with fill and pixel commands, and finally the frame is shown by calling frame again but letting the default show = True be used so the frame is displayed.

Using frames you can build simple animations by drawing each frame and swapping between them over time!

That's all there is to the basic Charlieplex driver module usage!

Full Example Code

import board
import busio
import adafruit_is31fl3731

i2c = busio.I2C(board.SCL, board.SDA)

# initialize display using Feather CharlieWing LED 15 x 7
display = adafruit_is31fl3731.CharlieWing(i2c)

# uncomment next line if you are using Adafruit 16x9 Charlieplexed PWM LED Matrix
#display = adafruit_is31fl3731.Matrix(i2c)

# uncomment next line if you are using Adafruit 16x8 Charlieplexed Bonnet
#display = adafruit_is31fl3731.CharlieBonnet(i2c)

# draw a box on the display
# first draw the top and bottom edges
for x in range(display.width):
    display.pixel(x, 0, 50)
    display.pixel(x, display.height - 1, 50)
# now draw the left and right edges
for y in range(display.height):
    display.pixel(0, y, 50)
    display.pixel(display.width - 1, y, 50)

Text Scrolling Example

NOTE: When running this example on Raspberry Pi, you must have the font8x5.bin file found here in the same directory as the program!

wget https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_framebuf/master/examples/font5x8.bin

import board
import busio
import adafruit_framebuf
import adafruit_is31fl3731

i2c = busio.I2C(board.SCL, board.SDA)

# initial display using Feather CharlieWing LED 15 x 7
#display = adafruit_is31fl3731.CharlieWing(i2c)
# uncomment line if you are using Adafruit 16x9 Charlieplexed PWM LED Matrix
#display = adafruit_is31fl3731.Matrix(i2c)
# uncomment line if you are using Adafruit 16x9 Charlieplexed PWM LED Matrix
display = adafruit_is31fl3731.CharlieBonnet(i2c)

text_to_show = "Adafruit!!"

# Create a framebuffer for our display
buf = bytearray(32)  # 2 bytes tall x 16 wide = 32 bytes (9 bits is 2 bytes)
fb = adafruit_framebuf.FrameBuffer(buf, display.width, display.height, adafruit_framebuf.MVLSB)

frame = 0 # start with frame 0
while True:
    for i in range(len(text_to_show) * 9):
        fb.text(text_to_show, -i + display.width, 0, color=1)

        # to improve the display flicker we can use two frame
        # fill the next frame with scrolling text, then
        # show it.
        display.frame(frame, show=False)
        # turn all LEDs off
        for x in range(display.width):
            # using the FrameBuffer text result
            bite = buf[x]
            for y in range(display.height):
                bit = 1 << y & bite
                # if bit > 0 then set the pixel brightness
                if bit:
                    display.pixel(x, y, 50)

        # now that the frame is filled, show it.
        display.frame(frame, show=True)
        frame = 0 if frame else 1


IS31FL3731 Breakout

Schematics & Fabrication Print (Dimensions in Inches)

16x9 0603 LED Grid

Schematics & Fabrication print (dimensions in inches)

This guide was first published on Mar 09, 2016. It was last updated on Mar 09, 2016.