Skip to content

Light Module

This module provides a matrix of LEDs in an 8x8 pattern. Each light can be individually controlled.

Hardware Specifications

The module is using a MAX7221 chip for addressing the individual LEDs. It is driven directly from the mainbord and uses SPI (Serial Peripheral Interface) for communication.

Pinout

Pin Number Name Description
10 CS Tells the MAX7221 that it should pay attention to the data being sent. When this pin is low, the device is selected and communication can occur. When it is high, the device ignores the SPI bus.
11 DIN This pin is used for sending data from the mainboard to the light module. In SPI terminology, this is also known as MOSI (Master Out Slave In).
12 CLK This pin provides the clock signal generated by the mainboard.

Usage

In order to be able to interface with the MAX7221 controller, we have to import a library. Add the following to your platformio.ini:

lib_deps =
  MD_MAX72XX

This adds the MD_MAX72XX library for accessing the MAX7221 chip. The following example lights up the LED at coordinates (0,0):

#include <MD_MAX72xx.h>

#define HARDWARE_TYPE 
#define CS_PIN 10
#define SEGMENTS 1

MD_MAX72XX display = MD_MAX72XX(MD_MAX72XX::FC16_HW, CS_PIN, SEGMENTS);

void setup() {
    display.begin();
    display.clear();
    display.setPoint(0, 0, true);
}

void loop() {
}

Technical Details

The MAX7721 display driver must be configured correctly to accommodate specific LEDs. This board uses LEDs with a forward current of 20mA and a forward voltage range of 1.6V to 2.6V. The chip is configured by selecting an appropriate resistance value for R1, as specified in the following table:

Current (mA) Voltage (V)
1.5
2.0
2.5 3.0 3.5
40 12.2 11.8
11.0 10.6 9.69
30 17.8
17.1 15.8 15.0 14.0
20 29.8
28.0 25.9 24.5 22.6
10 66.7 63.7 59.3 55.4 51.2

In our case, the appropriate resistance value is approximately 25.9kΩ. However, the board is currently using a resistor with a value of 26.1kΩ.