max7219-matrix v0.2.0
MAX7219-Matrix
Interfacing with MAX7219 8x8 LED arrays for the Raspberry Pi over SPI
Install
npm install max7219-matrix
Dependencies
The SPI device needs to be enabled on your Raspberry Pi. Sparkfun tutorial on how to do this
Check in /dev if the devices installed successfully:
$ ls -l /dev/spi*
crw-rw---- 1 root spi 153, 0 Aug 14 22:22 /dev/spidev0.0
crw-rw---- 1 root spi 153, 1 Aug 14 22:22 /dev/spidev0.1Wiring

How to use the package
let maxMatrix = require("max7219-matrix");
let m = new maxMatrix.MAX7219Matrix("/dev/spidev0.0", 4);
m.processText("TEST");Run node example/demo.js to run the snippet from above
--- The demo is set for 4 LED Arrays.
- The displayed text will always be trimmed to the first N characters, where N is the number or screens specified in the constructor. ex.:
If we set the screen count to 4, and we send the text "APPLE" (
max7219.processText("APPLE");), our screen will displayAPPL.
maxMatrix.MAX7219Matrix(device, screenCount)
- Constructor
- Creates an instance of the object, and initializes it with the required values.
- The
deviceargument specifies the SPI Device to which the screens are connected. ex.:"/dev/spidev0.0". - The
screenCountargument specifies the number of daisy-chained MAX7219 driven 8x8 LED arrays ex.:4.
setBrightness(brightness)
- Set the brightness of the matrices.
brightnessshould be between 0 and 15 (inclusive)
processText(text, font)
- Display the
text, in the selectedfont. If thefontis not specified, it defaults toCP437_FONT. - The following fonts can be used:
CP437_FONT,SINCLAIR_FONT,LCD_FONT,UKR_FONT,TINY_FONT,CP437_FONT_ROTATED(default),SINCLAIR_FONT_ROTATEDandLCD_FONT_ROTATED.- Syntax :
m.processText("TEST", "SINCLAIR_FONT_ROTATED");Example
The demo, found at example/demo.js, displays " TEST " in the SINCLAIR_FONT_ROTATED.
(it's set for 4 daisy-chained MAX7219 matrices)
TO-DOs
- Text rotation
- Scrolling text
- "Breathing" text effect
- "Blinking" text effect
Notes
This is a project I work on in my spare time, and it's very much a work-in-progress. If you have any problems, open an issue on GitHub. Pull requests are very welcome! Any improvements made to the code are much appreciated.
Special thanks to
- Larry Bank (bitbank2), and his awesomely documented C++ project.