MicroPython driver for MAX7219 8x8 LED matrix
This library provides support for the MAX7219 8x8 LED matrix on ESP8266 with MicroPython.
It uses framebuf
internally to provide drawing primitives and text support.
You can chain several matrices the way you like: if you use two 4x 8x8 matrices, you can have
one of the left, and the other on the right giving you a 64x8 area, or have one on top of the other to have a 32x16 display!
Tested on ESP8266 and ESP32 systems.
ESP8266 | MAX7219 |
---|---|
5V | VCC |
GND | GND |
GPIO13 (HWSPI #1 MOSI) | DIN |
GPIO14 (HWSPI #1 SCK) | CLK |
GPIO15 | CS |
ESP32 | MAX7219 |
---|---|
5V | VCC |
GND | GND |
GPIO13 (HWSPI #1 MOSI) | DIN |
GPIO14 (HWSPI #1 SCK) | CLK |
GPIO15 | CS |
Using 10000000
as baudrate
is recommended as greater values don't seem to work well...
from machine import Pin, SPI
import max7219
spi = SPI(1, baudrate=10000000)
screen = max7219.Max7219(8, 8, spi, Pin(15))
screen.text('A', 0, 0, 1)
screen.show()
from machine import Pin, SPI
import max7219
spi = SPI(1, baudrate=10000000)
screen = max7219.Max7219(32, 8, spi, Pin(15))
screen.text('ABCD', 0, 0, 1)
screen.show()
from machine import Pin, SPI
import max7219
spi = SPI(1, baudrate=10000000)
screen = max7219.Max7219(64, 8, spi, Pin(15))
screen.text('ABCDEFGH', 0, 0, 1)
screen.show()
from machine import Pin, SPI
import max7219
spi = SPI(1, baudrate=10000000)
screen = max7219.Max7219(32, 16, spi, Pin(15))
screen.text('ABCD', 0, 0, 1)
screen.text('EFGH', 0, 8, 1)
screen.show()
This library is based on:
Thank you for the inspiration!