ESP8266/Arduino: MAX7219 8×8 Led Matrix Library

Twice a year the company I work for (Netcetera) organizes a retreat for programmers, usually in the mountains. In the Spring issue this year we went to a resort in a beautiful mountain region. Inspired by the wonderful landscape I managed to write a library for the recently published Arduino IDE for ESP8266 which allows you to manipulate pixels and write animated text on 8×8 led matrices with a MAX7219 driver.

These boards (affiliate link) only cost a bit more than $2/piece and you can connect several of them by daisy chaining one with the next. This allows you to create wonderful led bar on the cheap: lets say you buy 10 of them plus an ESP8266 and mount them on a piece of card board you’ll have a wonderful remote programmable eye catcher for shop display for less than $30!

Not being fluent anymore in C/C++ I had to get used again to the hard work of managing memory, dealing with a weird String object (yes, even weirder than the String object in Java;-)) and some other pitfalls for a 10+ years Java programmer.

But I finally managed it and here you can see the result:

Connect the Modules like this:

Led Matrix ESP8266
VCC +3.3V
GND GND
DIN GPIO13 (HSPID)
CS Choose free GPIO, e.g. GPIO2
CLK GPIO14 (HSPICLK)

Here you’ll find the library:
https://github.com/squix78/MAX7219LedMatrix

Please note:

  • this library is made for the ESP8266 and might or might not work for “normal” Arduino boards.
  • I had to patch the Mac OS X release with the SPI folder from Github. In other words there wasn’t an up-to-date release for Mac OS X (and maybe for the other platforms as well) and the SPI.h/SPI.cpp wouldn’t compile
Related:  3D Printing: My First 3 Weeks with a 3D Printer

Now a beer! Did you like this post? It often takes me several hours of my free time to write one. If I was your neighbour would you offer me a beer for the hard work I did for you? The beauty is: beers can be teletransported with a painless donation using Paypal. A beer in a Swiss bar costs about USD $4.80. Or use this affiliate link if you order something on Banggood and I'll get a small kickback. Thank you!