In this article we look at a module with lots of LEDs on it, its an IS31FL3741 LED matrix module from adafruit
Module Information
At the centre of the module is the IS31FL3741
The IS31FL3741 is a general purpose 39×9 LED Matrix programmed via an I2C compatible interface.
Each LED can be dimmed individually with 8-bit PWM data and 8-bit scaling data which allowing 256 steps of linear PWM dimming and 256 steps of DC current adjustable level.
Additionally each LED open and short state can be detected, IS31FL3741 store the open or short information in Open-Short Registers. The Open-Short Registers allowing MCU to read out via I2C compatible interface. Inform MCU whether there are LEDs open or short and the locations of open or short LEDs.
The IS31FL3741 operates from 2.7V to 5.5V and features a very low shutdown and operational current.
FEATURES
Supply voltage range: 2.7V ~ 5.5V
9 Current Sink × 9 SW matrix size: drive up to 351 LEDs or 117 RGBs
Individual 256 PWM control steps
Individual 256 DC current steps
Global 255 current setting
SDB rising edge reset I2C module
Programmable H/L logic: 1.4/0.4, 2.4/0.6
29kHz PWM frequency
1MHz I2C-compatible interface
interrupt and state lookup registers
Individual open and short error detect function
The adafruit module features a 13×9 RGB LED matrix breakout for a grand total of 117 RGB LEDs
You can install the Adafruit IS31FL3741 library for Arduino using the Library Manager in the Arduino IDE.
Click Manage Libraries, search for IS31FL3741 , and select the Adafruit IS31FL3741 library, and install the latest version:
You may be asked about dependencies if this is the first time you have installed an Adafruit library, click “Install all” to install them as well.
The library has several example – this one scrolls text on the matrix and we have toned the brightness down as well – they are bright leds
#include <Adafruit_IS31FL3741.h> Adafruit_IS31FL3741_QT matrix; // If colors appear wrong on matrix, try invoking constructor like so: // Adafruit_IS31FL3741_QT matrix(IS3741_RBG); // Some boards have just one I2C interface, but some have more... TwoWire *i2c = &Wire; // e.g. change this to &Wire1 for QT Py RP2040 char text[] = "esp32learning!"; // A message to scroll int text_x = matrix.width(); // Initial text position = off right edge int text_y = 1; int text_min; // Pos. where text resets (calc'd later) void setup() { Serial.begin(115200); Serial.println("Adafruit QT RGB Matrix Scrolling Text Test"); if (! matrix.begin(IS3741_ADDR_DEFAULT, i2c)) { Serial.println("IS41 not found"); while (1); } Serial.println("IS41 found!"); // By default the LED controller communicates over I2C at 400 KHz. // Arduino Uno can usually do 800 KHz, and 32-bit microcontrollers 1 MHz. i2c->setClock(800000); // Set brightness to max and bring controller out of shutdown state matrix.setLEDscaling(0x10); matrix.setGlobalCurrent(0x10); Serial.print("Global current set to: "); Serial.println(matrix.getGlobalCurrent()); matrix.fill(0); matrix.enable(true); // bring out of shutdown matrix.setRotation(0); matrix.setTextWrap(false); // Get text dimensions to determine X coord where scrolling resets uint16_t w, h; int16_t ignore; matrix.getTextBounds(text, 0, 0, &ignore, &ignore, &w, &h); text_min = -w; // Off left edge this many pixels } void loop() { matrix.setCursor(text_x, text_y); for (int i = 0; i < (int)strlen(text); i++) { // set the color thru the rainbow uint32_t color888 = matrix.ColorHSV(65536 * i / strlen(text)); uint16_t color565 = matrix.color565(color888); matrix.setTextColor(color565, 0); // backound is '0' to erase previous text! matrix.print(text[i]); // write the letter } if (--text_x < text_min) { text_x = matrix.width(); } delay(25); }