Hello Makers,
I'm with another simple and cool Instructable.
In this Instructable we will learn how to Interface LED Dot Matrix (8x8) with NodeMCU.
So, let's begin.
Step 1: Things Needed
These are the required things to do this Instructables.
Hardware Requirement
- LED Dot Matrix (8x8)
- NodeMCU
- Jumper wires / Connecting wires ( Optional )
- BreadBoard
- Micro USB Cable
Software Requirements
- Arduino IDE ( with ESP8266 library installed )
Step 2: Description
An LED Dot Matrix or LED Display is a large, low-resolution form of dot-matrix display.
It is useful for both industrial and commercial purpose, to display information as well as for hobbyist human–machine interfaces.
It consists of a 2-D diode matrix with their cathodes joined in rows and their anodes joined in columns (or vice versa).
By controlling the flow of electricity through each row and column pair it is possible to control each LED individually.
Step 3: Circuit Wiring
The Dot Matrix has 5 pins i.e.,
VCC - To be connected to NodeMCU Vin.
GND - To be connected to Ground Pin (GND) of the NodeMCU.
Din - To be connected to Digital Pin D0 of the NodeMCU.
CS - To be connected to Digital Pin D1 of the NodeMCU.
CLK - To be connected to Digital Pin D2 of the NodeMCU.
Step 4: Library Setup
Before you get started with coding you need Arduino IDE.
To download Arduino IDE and for NodeMCU setup, you can check my previous instructable. And for this Instructable you need LedControl Matrix LIbrary, you can download it from the link below.
Ok, let's begin with coding.
Step 5: Source Code
CODE :
#include <LedControl.h>
int DIN = 16; // D0 int CS = 5; // D1 int CLK = 4; // D2
LedControl lc=LedControl(DIN,CLK,CS,0);
void setup(){ lc.shutdown(0,false); //The MAX72XX is in power-saving mode on startup lc.setIntensity(0,15); // Set the brightness to maximum value lc.clearDisplay(0); // and clear the display }
void loop() { byte a[8] = {0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xFF,0xFF}; // L byte b[8] = {0xFF,0xFF,0x18,0x18,0x18,0x18,0xFF,0xFF}; // I byte c[8] = {0x7F,0xFF,0xC0,0xDF,0xDF,0xC3,0x7F,0x3F}; // G byte d[8] = {0xC3,0xC3,0xC3,0xFF,0xFF,0xC3,0xC3,0xC3}; // H byte e[8] = {0xFF,0xFF,0x18,0x18,0x18,0x18,0x18,0x18}; // T byte f[8] = {0xC3,0xC3,0xC3,0xFF,0xFF,0xC3,0xC3,0xC3}; // H byte g[8] = {0x3C,0x7E,0xC3,0xC3,0xC3,0xC3,0x7E,0x3C}; // O byte h[8] = {0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xFF,0xFF}; // U byte i[8] = {0x7F,0xFE,0xC0,0xFE,0x7F,0x03,0x7F,0xFE}; // S byte j[8] = {0xFF,0xFF,0xC0,0xF8,0xF8,0xC0,0xFF,0xFF}; // E printByte(a); delay(1000); printByte(b); delay(1000); printByte(c); delay(1000); printByte(d); delay(1000); printByte(e); delay(1000); printByte(f); delay(1000); printByte(g); delay(1000); printByte(h); delay(1000); printByte(i); delay(1000); printByte(j); delay(1000); }
void printByte(byte character []){ int i = 0; for(i=0;i<8;i++) { lc.setRow(0,i,character[i]); } }
Download the code " LED_DotMatrix_NodeMCU.ino" attached below.
You can tinker with the code as you wish, or use it as it is.
Step 6: OUTPUT
That's all makers!
I hope you liked this. Stay Tuned for more Projects!
Thank You.
Discussions
2 months ago on Step 5
Thanks for nice instructable! Let me add two modification proposals:
- There seems to be discrepancy between pin numbers in text
int DIN = 16; // D0
int CS = 5; // D1
int CLK = 4; // D2
and in an attached example.
int DIN = 12; // D0
int CS = 11; // D1
int CLK = 10; // D2
The pin numbers in text seems to work.
- Someone might also get a problem with include in LedControl.h. One can safely comment out the include:
//#include <avr/pgmspace.h>
as it refers to wrong processor