MAX7219 library for NodeMCU in the making

This is just a quick heads-up to let you know that I’m working on a MAX7219 library for NodeMCU. In October last year I first experimented with MAX7219 8×8 matrix displays. Ever since then I wanted to create a library that would support daisy-chained displays and a few text animations. I finally kicked myself in the butt and started tinkering.

The library will allow you to

  • define number of displays you connected
  • set characters as bytes
  • set text and a font table (8 bytes per char)
  • scroll the text left and right
  • oscillate text
  • rotate and invert individual characters

That last feature is quite important for daisy-chained displays. Depending on the module and how they’re chained characters may have to be transformed to appear as you expect them to.

Text displayed on 4-in-1 modules must be rotated left by 90°. If you daisy-chain the standalone modules manually no rotating is necessary but you may want to invert the characters to turn your chain up-side down.

MAX7219 4-in-1 display
MAX7219 library for NodeMCU running on NodeMCU devkit V2 and a 4-in-1 display.
MAX7219 manually daisy-chained
MAX7219 library for NodeMCU running on NodeMCU devkit V2 and manually daisy-chained display modules.

 

The library is on GitHub at https://github.com/marcelstoer/nodemcu-max7219 and I invite you give it a try. I appreciate if you create an issue on GitHub should you run into problems. General remarks are very welcome here, however.

14 thoughts on “MAX7219 library for NodeMCU in the making

  1. Wow, I have been looking for solutions to control LED matrices and here I stumble upon this. I will definitely keep an eye on it. Thanks.

  2. Cool library. Excellent work. Thank you!
    I just added tmr.wdclr() in the loop in commit() function, because I test it using 8 modules and the watchdog did reset the device.
    And the last one – may be the library will stop working if the compilation is “float”…

    1. Thanks for this feedback, much appreciated. Feel free to open individual issue on GitHub for your findings. It’s true, I have neither tested with more than 4 display modules nor with a float firmware.

      As for watch dod feeding and performance, there are low-level functions in the NodeMCU SPI module which would probably greatly improve things. I don’t really understand SPI though and haven’t dared to touch them yet. I’m actually surprised I got this far with this library despite my lack of SPI/electronics know-how.

      1. Any thoughts about using more than 4 modules — or in general, what might have to change? I’m interested in using this module with my own setup, which uses 16 MAX7219 devices, but it doesn’t seem to work past 4. I wouldn’t mind poking around the code a bit but I’m still getting a feel for the NodeMCU.

  3. Thanks, Marcel, for pointing… I should have scrolled down a bit in README.md first.
    As I had suspected from a first quick look into the code, it’s not possible to show “…” (one has to write7segment(“,,,”) instead (dots are collapsed into a single one and “kerned” to the preceding character). Not a big problem 😉
    What I’m missing (Arduino’s LedControl library has them) is graphics primitives: Something to set and clear (and perhaps toggle) individual dots. (This might require a backing store to “know” about the current state, in particular if mixed with string operations.) I’ll look into it when I’m back from the vacation…

Leave a Reply