# 5x5 RGB Matrix Breakout and arduino

**URL:** <https://forums.pimoroni.com/t/5x5-rgb-matrix-breakout-and-arduino/13297>\
**Category:** Arduino & AVR\
**Created:** [March 14, 2020, 7:48pm UTC](https://forums.pimoroni.com/t/5x5-rgb-matrix-breakout-and-arduino/13297 "2020-03-14T19:48:13Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Jasonic8](https://avatars.discourse-cdn.com/v4/letter/j/6de8d8/32.png) [@Jasonic8](https://forums.pimoroni.com/u/Jasonic8)\
**Post date:** [April 25, 2020, 11:47pm UTC](https://forums.pimoroni.com/t/5x5-rgb-matrix-breakout-and-arduino/13297/5 "2020-04-25T23:47:19Z")

</div>

I’d like to get something to use in C, maybe based on the Adafruit code.

From the Python code I’ve added comments by cross-referencing the terminology in the ISSI spec sheet which helps us understand it a bit better. The controller has 8 images it can display either as a static picture or as an animation - these are referred to as ‘frames’ but the Python code calls them ‘banks’. The special, Function Register, accessed by setting the frame to 11 (0x0b). The 75 LEDS are mapped to some of the 144 supported (it seems defined in the enable\_pattern). What’s also confusing to me is why there are 28 pixel addresses defined in the RGBMatrix5x5 lookup (matching the 84 ones in the binary enable\_pattern) .

Any answers or corrections welcome.

//\*\*\*\*COMMAND REGISTER (frame to receive data: 0-7 or function:11) \*\*\*\*\*\*\*  
\_BANK\_ADDRESS = 0xfd

// **FRAME REGISTER OFFSETS** \*\*\*  
// “ENABLE” -is LED ON/OFF 144 bits in 18x 8bit bytes; “COLOR” IS PWM 0-255 144 8bit bytes  
\_ENABLE\_OFFSET = 0x00  
\_BLINK\_OFFSET = 0x12  
\_COLOR\_OFFSET = 0x24

//\*\*\*\* FUNCTION ‘FRAME’ OFFSETS\*\*\*\*\*\*  
\_MODE\_REGISTER = 0x00  
\_FRAME\_REGISTER = 0x01  
\_AUTOPLAY1\_REGISTER = 0x02  
\_AUTOPLAY2\_REGISTER = 0x03  
\_BLINK\_REGISTER = 0x05  
\_AUDIOSYNC\_REGISTER = 0x06  
\_BREATH1\_REGISTER = 0x08  
\_BREATH2\_REGISTER = 0x09  
\_SHUTDOWN\_REGISTER = 0x0a  
\_GAIN\_REGISTER = 0x0b  
\_ADC\_REGISTER = 0x0c

//\*\*\*\* COMMAND REGISTER VALUE FOR FUNCTION REGISTER (SPECIAL FRAME 11)  
\_CONFIG\_BANK = 0x0b

//\*\*\*\* DISPLAY MODES FOR USE IN \_MODE\_REGISTER  
\_PICTURE\_MODE = 0x00  
\_AUTOPLAY\_MODE = 0x08  
\_AUDIOPLAY\_MODE = 0x18

UPDATE (26th April):  
I’ve modified the begin() function of a new derived class (shown below) along with its own drawPixel() method and lednumber lookup and will test later.

`
bool Pimoroni_IS31FL3731_5x5RGB::begin(uint8_t addr) {
  Wire.begin();
  Wire.setClock(400000);
_i2caddr = addr;
_frame = 0;
// A basic scanner, see if it ACK’s
Wire.beginTransmission(_i2caddr);
if (Wire.endTransmission () != 0) {
return false;
}
// shutdown
writeRegister8(ISSI_BANK_FUNCTIONREG, ISSI_REG_SHUTDOWN, 0x00);
delay(10);
// out of shutdown
writeRegister8(ISSI_BANK_FUNCTIONREG, ISSI_REG_SHUTDOWN, 0x01);
// picture mode
writeRegister8(ISSI_BANK_FUNCTIONREG, ISSI_REG_CONFIG, ISSI_REG_CONFIG_PICTUREMODE);
displayFrame(_frame);
// all LEDs on & 0 PWM
clear(); // set each led to 0 PWM
//define which of the 144 led addresses are valid for 5x5 RGB
uint8_t enable_pattern[18] = {
0b00000000, 0b10111111,
0b00111110, 0b00111110,
0b00111111, 0b10111110,
0b00000111, 0b10000110,
0b00110000, 0b00110000,
0b00111111, 0b10111110,
0b00111111, 0b10111110,
0b01111111, 0b11111110,
0b01111111, 0b00000000,
};
for (uint8_t f = 0; f < 8; f++) {
for (uint8_t i = 0; i <= 0x11; i++)
writeRegister8(f, i, enable_pattern[i]); // only the RGB LEDs in 5x5 array
}
audioSync(false);
return true;
}
`

---

_[View the full topic](https://forums.pimoroni.com/t/5x5-rgb-matrix-breakout-and-arduino/13297)._
