Introduction: NODEMCU LUA ESP8266 With MAX7219 and 8x8 LED Matrix

This is to show how to drive a MAX7219, an 8 x 8 LED Matrix with an ESP8266 using NODEMCU LUA.

Step 1: Basics

I was wondering if it was possible to drive a MAX7219 and an 8 x 8 LED matrix with an ESP8266, but could not find any code to do just that.

There is code out there to drive 8 segment numeric displays but not a matrix. There are also other programs that don't work, and there are videos on YouTube that don't have any code. This is my effort from 3 or 4 different sources and cobbled together into this.

I am assuming that you know how to use your ESP8266 and can load code into it.

Step 2: The LUA Code

I am using NodeMCU 0.9.5 build 20150318 powered by Lua 5.1.4 on ESPlora v0.2.0-rc2, which is standard stuff.

There were lots of time delays in the original code which I have removed - the code works OK without them.

Here are two examples of Lua code.

matrix.lua displays 8 x 8 sprites

scroll.lua displays a moving sine wave

Step 3: Connecting Everything Together


ESP8266 GPIO13 - MAX7219 DIN pin

ESP8266 GPIO15 - MAX7219 CS pin

ESP8266 GPIO14 - MAX7219 CLK pin

You can assign any pins on the ESP8266 - the above match an SPI set up.

If there are problems try changing from GPIO15 to another pin. (Of course you will need to change the code!)

Connect the MAX7219 Vcc to 5v and Gnd to ground.

Don't forget to connect all the grounds together.

I use a CH340G to program the ESP8266 set to 3.3v.

Connect CH340G TXD to ESP8266 RXD and CH340G RXD to ESP8266 TXD

I am using an ESP-12 for this program although you can use whatever you like.

I use a cheap breadboard power supply for the 3.3v and Gnd for the ESP8266.

Step 4: Final Result

Summer Fun Contest 2016

Participated in the
Summer Fun Contest 2016