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() {
}