Introduction: ESP8266-To-LED Matrix (Look Ma No Arduino)
This project came about when I created this instructional: https://www.instructables.com/id/WIFI-Enabled-LED-...
I received comments from people that it could be accomplished without the Arduino. I took that as a challenge.
The purpose of this project is to program an ESP8266-12 to service up a web page with a form, then take the text loaded into the form and display it on a LED Matrix.
The ESP8266-12 (NodeMCU)
- Connects to your Wifi (you supply SSID and password)
- Starts a web server on port 80
- Display IP Address on the LED Matrix until Text is entered.
- Remove URL tags from text enter on webpage and send to LED Matrix
- On your home internet router you may forward port 80 on that IP to enable it on the internet.
Step 1: Parts Needed
You will need....
- Wifi Development board (esp8266-12 NodeMCU) for about $5 on Amazon here.
- 7219 LED Matrix 4 - 8x8 modules for about $8 on Amazon here
- Programmer for WIFI module, I used this one from Tayda Electronics for about $2 (make sure it has 3.3v option.
- Enclosure. I use a cigar box
- Power supply. I cut the end off an old 5v phone charger.
- Wires. Female to Female
Step 2: Overview of the ESP8266 Development Board.
I used the ESP8266-12e development board. One advantage this board has is the voltage regulator so I can power both the ESP8266 and LED Matrix with the same 5v line. This board is also tolerant of 5v inputs. If you want to be very careful you could attach the pins to bi directional level shifts. I did that originally but found it worked fine without them.
Add Support for the ESP8266 NodeMCU to the Arduino IDE:
- In the Arduino IDE go to File menu, under preferences
- Enter the following in the "Additional Board Managers URLs" 'http://arduino.esp8266.com/stable/package_esp8266com_index.json'
- The in the Tools menu, click on "Board" and then "boards Manager'
- "Install the ESP8266 by the ESP8266 Community
Step 3: Add the LED Matrix Library
The LED Matrix Library:
I was unable to compile the library I used on the Arduino so I had to switch to a different one. I picked the "LEDMatrixDriver"
To install this LEDMatrixDriver library:
- In the top menu bar click "Sketch"
- Then click "Include Library"
- Then click "Manage Libraries..."
- You will be given a list of libraries. Use search and find the LEDMatrixDriver
- Click "Install"
Step 4: Program the ESP8266
Programming the ESP8266:
- Connect the programmer to your PC or Laptop
- Connect he GPIO0 jumper before powering on the ESP8266
- Connect TX (transmit) and RX(receive)
- Connect Ground to Ground
- Connect 3.3v from programmer to ESP8266
Upload the program:
- Get program from GITHUB: https://github.com/aapicella/WiFi-enables-LED-Matrix/tree/master/ESP8266-max7219-no_arduino
- Change SSID and Password for your WiFi router.
- Click on Sketch menu then Upload. (Ctrl+u) shortcut.
- The program will upload to the ESP8266.
- Once complete remove jumper from GPIO0
Step 5: Connecting It Together
Connect the ESP8266 to the LED Matrix.
Connect pins with Female/Female wires:
- DIN (data in) on Matrix ---> 13 or MOSI on ESP8266
- Clock(CLK) on Matrix --> 14 or SCK on ESP8266
- CS pin on Matrix define below --->( picked 15 on ESP8266)
- Ground on Matrix --> Ground on ESP8266
- +5v to Matrix
- +5v to ESP8266 if you have a built in voltage regulator.
- If not you can just a LM1117 and pull the 3.3v from it.
Step 6: Programming Notes
Notes:
This program differed from having an Arduino because delays were in the original code. The ESP8266 could loop and wait for a web client to submit data and the Arduino could wait for serial traffic. Since the two were combined it wasn't possible to wait.
In order to move the characters smoothly across the screen I setup it up like this and put in the displayText() any time the code was in a loop waiting for something that it checks to see if the time to move the text.
const int ANIM_DELAY = 75; //speed of animation or text unsigned long myTime=millis(); //Now void displayText ( char * theText) { if ( myTime + ANIM_DELAY < millis()) { myTime=millis(); //now // Draw the text to the current position drawString(theText, len, x, 0); lmd.display(); // Advance to next coordinate if( --x < len * -8 ) x = LEDMATRIX_WIDTH; } }
I hope you enjoy this Instructable.
6 Comments
Question 4 years ago on Step 6
Somehow, the sketch doesn't compile, I keep getting the following error message
Arduino: 1.8.5 (Windows 7), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, 4M (1M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"
In file included from C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/ESP8266WiFi.h:40:0,
from C:\Users\USER\Desktop\SP8266_LED_MATRIX\SP8266_LED_MATRIX.ino:5:
C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/WiFiServer.h:52:14: error: invalid abstract return type for member function 'WiFiClient WiFiServer::available(uint8_t*)'
WiFiClient available(uint8_t* status = NULL);
^
In file included from C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/ESP8266WiFi.h:39:0,
from C:\Users\USER\Desktop\SP8266_LED_MATRIX\SP8266_LED_MATRIX.ino:5:
C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/WiFiClient.h:45:7: note: because the following virtual functions are pure within 'WiFiClient':
class WiFiClient : public Client, public SList<WiFiClient> {
^
In file included from C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/WiFiClient.h:27:0,
from C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/ESP8266WiFi.h:39,
from C:\Users\USER\Desktop\SP8266_LED_MATRIX\SP8266_LED_MATRIX.ino:5:
C:\Users\USER\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2\cores\esp8266/Client.h:37:22: note: virtual void Client::flush()
virtual void flush() = 0;
^
C:\Users\USER\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2\cores\esp8266/Client.h:38:22: note: virtual void Client::stop()
virtual void stop() = 0;
^
In file included from C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/WiFiServerSecure.h:21:0,
from C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/ESP8266WiFi.h:41,
from C:\Users\USER\Desktop\SP8266_LED_MATRIX\SP8266_LED_MATRIX.ino:5:
C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/WiFiServerSecureBearSSL.h:58:22: error: invalid abstract return type for member function 'BearSSL::WiFiClientSecure BearSSL::WiFiServerSecure::available(uint8_t*)'
WiFiClientSecure available(uint8_t* status = NULL);
^
In file included from C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/WiFiServerSecureBearSSL.h:24:0,
from C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/WiFiServerSecure.h:21,
from C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/ESP8266WiFi.h:41,
from C:\Users\USER\Desktop\SP8266_LED_MATRIX\SP8266_LED_MATRIX.ino:5:
C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/WiFiClientSecureBearSSL.h:34:7: note: because the following virtual functions are pure within 'BearSSL::WiFiClientSecure':
class WiFiClientSecure : public WiFiClient {
^
In file included from C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/WiFiClient.h:27:0,
from C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/ESP8266WiFi.h:39,
from C:\Users\USER\Desktop\SP8266_LED_MATRIX\SP8266_LED_MATRIX.ino:5:
C:\Users\USER\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2\cores\esp8266/Client.h:37:22: note: virtual void Client::flush()
virtual void flush() = 0;
^
C:\Users\USER\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2\cores\esp8266/Client.h:38:22: note: virtual void Client::stop()
virtual void stop() = 0;
^
In file included from C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/WiFiServerSecure.h:20:0,
from C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/ESP8266WiFi.h:41,
from C:\Users\USER\Desktop\SP8266_LED_MATRIX\SP8266_LED_MATRIX.ino:5:
C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/WiFiServerSecureAxTLS.h:36:20: error: invalid abstract return type for member function 'axTLS::WiFiClientSecure axTLS::WiFiServerSecure::available(uint8_t*)'
WiFiClientSecure available(uint8_t* status = NULL);
^
In file included from C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/WiFiClientSecure.h:23:0,
from C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/ESP8266WiFi.h:42,
from C:\Users\USER\Desktop\SP8266_LED_MATRIX\SP8266_LED_MATRIX.ino:5:
C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/WiFiClientSecureAxTLS.h:33:7: note: because the following virtual functions are pure within 'axTLS::WiFiClientSecure':
class WiFiClientSecure : public WiFiClient {
^
In file included from C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/WiFiClient.h:27:0,
from C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/ESP8266WiFi.h:39,
from C:\Users\USER\Desktop\SP8266_LED_MATRIX\SP8266_LED_MATRIX.ino:5:
C:\Users\USER\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2\cores\esp8266/Client.h:37:22: note: virtual void Client::flush()
virtual void flush() = 0;
^
C:\Users\USER\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2\cores\esp8266/Client.h:38:22: note: virtual void Client::stop()
virtual void stop() = 0;
^
C:\Users\USER\Desktop\SP8266_LED_MATRIX\SP8266_LED_MATRIX.ino: In function 'void loop()':
SP8266_LED_MATRIX:169: error: cannot allocate an object of abstract type 'WiFiClient'
WiFiClient client = server.available();
^
In file included from C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/ESP8266WiFi.h:39:0,
from C:\Users\USER\Desktop\SP8266_LED_MATRIX\SP8266_LED_MATRIX.ino:5:
C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/WiFiClient.h:45:7: note: since type 'WiFiClient' has pure virtual functions
class WiFiClient : public Client, public SList<WiFiClient> {
^
SP8266_LED_MATRIX:169: error: cannot declare variable 'client' to be of abstract type 'WiFiClient'
WiFiClient client = server.available();
^
In file included from C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/ESP8266WiFi.h:39:0,
from C:\Users\USER\Desktop\SP8266_LED_MATRIX\SP8266_LED_MATRIX.ino:5:
C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi\src/WiFiClient.h:45:7: note: since type 'WiFiClient' has pure virtual functions
class WiFiClient : public Client, public SList<WiFiClient> {
^
Multiple libraries were found for "ESP8266WiFi.h"
Used: C:\Users\USER\Documents\Arduino\libraries\ESP8266WiFi
Not used: C:\Users\USER\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2\libraries\ESP8266WiFi
Multiple libraries were found for "SPI.h"
Used: C:\Users\USER\Documents\Arduino\libraries\SPI
Not used: C:\Users\USER\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2\libraries\SPI
exit status 1
cannot allocate an object of abstract type 'WiFiClient'
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Kindly help !!
4 years ago
Nice work.
My matrices are orientated the other way - is there any way to scroll the text the other way (rotate the direction of scrolling by 90 degrees)?
Thanks
Shane
Reply 4 years ago
basically you want to rotate the font bits so instead of taking colums you take rows.
I would think you could accomplish that in drawSprite function by swapping x and y. If I get some time this week I will test it.
4 years ago
drove me crazy today trying to get this to work. Went over the code so many times I could retype it from memory. Finally I got it going only after reflashing my NodeMCU. Worked first time after that.
Thanks for a fun learning experience.
5 years ago
Hello, very interesting project. I am interested in connecting several of these 7219 LED Matrix 8x8 modules, in beginning 8 pieces. What do i need to change in the conecction and in code. If you can help me.
Thanks a lot.
Reply 5 years ago
In the code you would change the lines
to (assuming straight line)
I hope that helps, Good luck.