Smart Notice Board with ESP32-C6 & Dot Matrix LED Display

22.12.23 06:36 AM By AKB

                

In today's fast-paced world, communication is key. Traditional notice boards are getting a tech-savvy upgrade with the integration of ESP32-C6 and dot matrix LED displays. In this blog post, we'll create a Smart Notice Board that combines the power of ESP32-C6 with the dot matrix LED display. Get ready to transform your notice board into an intelligent, interactive board!


The traditional methods of writing the notice on paper, and having a person deliver the information to the respective groups, are prone to errors. The person delivering could deliver it to the wrong group, or tamper with the information being sent, etc.

With the electronics industry moving at a fast pace, we are able to solve many such problems with digital replacements. Our project aims at eliminating the use of paper in offices, schools & colleges, and other institutions which are used for the purpose of notice boards. It also minimizes the risk of errors, by replacing paper with Dot Matrix LED displays.


In this tutorial, we will understand how to make a Web Controlled Smart Notice Board with ESP32-C6 & Dot Matrix LED Display.

Project Overview

In this project, the ESP32-C6 WiFi Module can be interfaced with an 8-in-1 MAX7219 Dot Matrix LED Display. The ESP32-C6 connects to a WiFi Network and generates a Web page. We can access the web page using the local IP Address of ESP32-C6. Using the Web Dashboard, we can send any message and display it on Dot Matrix LED Display.


Material Requirements:

1

) ESP32-C6 Module

ESP-32-C6-WROOM-1


2

)8-in-1 MAX7219 Dot Matrix LED Display

8x1-LED-Matrix



3

)Jumper Wires

jumper wire



4

) Breadboard

breadboard

Lets Understand the Features of Dot Matrix LED Display

  • LED matrices come in various styles: single color, dual color, multi-color, and RGB.

  • They also come in various dimensions: 5 x 7, 8 x 8, 16 x 16, 8 x 32, 32 x 32, etc.

  • This specific 8×64 LED Matrix Display is a cluster of 8 single modules that are internally connected.

  • These modules can be separated because each one has the same Maxim MAX7219 chip and the same power and data connection.

Smart Notice Board with ESP32-C6 & Dot Matrix LED Display Interface

Make the connections of ESP32-C6 with the DOT Matrix LED display as shown in the schematic below



Connecting the Dot Matrix Display to the NodeMCU:

  • Power: Connect the VCC pin of the Dot Matrix Display to the 3.3V pin of the NodeMCU.

  • Ground: Connect the GND pin of the Dot Matrix Display to the GND pin of the NodeMCU.

SPI Interface:

  • Use the NodeMCU's default SPI GPIO pins.

  • Connect the DIN pin of the MAX7219 to the NodeMCU D7 pin.

  • Connect the CS pin of the MAX7219 to the NodeMCU D8 pin.

  • Connect the CLK pin of the MAX7219 to the NodeMCU D5 pin.

Source Code/Program

 You will require this 2 Libraries to successfully run the project

Add this library to the Arduino IDE, and then call it in the main program. Upload the following code to the ESP32-C6 board.

Main Code

#include <ESP8266WiFi.h>

#include <MD_Parola.h>

#include <MD_MAX72xx.h>

#include <SPI.h>

// Turn on debug statements to the serial output

#define DEBUG 0

#if DEBUG

#define PRINT(s, x) { Serial.print(F(s)); Serial.print(x); }

#define PRINTS(x) Serial.print(F(x))

#define PRINTX(x) Serial.println(x, HEX)

#else

#define PRINT(s, x)

#define PRINTS(x)

#define PRINTX(x)

#endif

 #define HARDWARE_TYPE MD_MAX72XX::FC16_HW

#define MAX_DEVICES 8

#define CS_PIN 15 // or SS

// HARDWARE SPI

MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);

// WiFi login parameters - network name and password

const char* ssid = "campus";

const char* password = "component";

// WiFi Server object and parameters

WiFiServer server(80);

// Scrolling parameters

uint8_t frameDelay = 25; // default frame delay value

textEffect_t scrollEffect = PA_SCROLL_LEFT;

// Global message buffers shared by Wifi and Scrolling functions

#define BUF_SIZE 512

char curMessage[BUF_SIZE];

char newMessage[BUF_SIZE];

bool newMessageAvailable = false;

const char WebResponse[] = "HTTP/1.1 200 OK\nContent-Type: text/html\n\n";

const char WebPage[] =

"<!DOCTYPE html>" \

"<html>" \

"<head>" \

"<title>MajicDesigns Test Page</title>" \

"<script>" \

"strLine = \"\";" \

"function SendData()" \

"{" \

" nocache = \"/&nocache=\" + Math.random() * 1000000;" \

" var request = new XMLHttpRequest();" \

" strLine = \"&MSG=\" + document.getElementById(\"data_form\").Message.value;" \

" strLine = strLine + \"/&SD=\" + document.getElementById(\"data_form\").ScrollType.value;" \

" strLine = strLine + \"/&I=\" + document.getElementById(\"data_form\").Invert.value;" \

" strLine = strLine + \"/&SP=\" + document.getElementById(\"data_form\").Speed.value;" \

" request.open(\"GET\", strLine + nocache, false);" \

" request.send(null);" \

"}" \

"</script>" \

"</head>" \

"<body>" \

"<p><b>Smart Notice Board</b></p>" \

"<formdata_form\"" name="\"frmText\"">" \

"<label>Message:<br><input type="\"text\"" name="\"Messa"ge\" maxlength="\"255\""></label>" \

"<br><br>" \

"<input type = \"radio\" name = \"Invert\" value = \"0\" checked> Normal" \

"<input type = \"radio\" name = \"Invert\" value = \"1\"> Inverse" \

"<br>" \

"<input type = \"radio\" name = \"ScrollType\" value = \"L\" checked> Left Scroll" \

"<input type = \"radio\" name = \"ScrollType\" value = \"R\"> Right Scroll" \

"<br><br>" \

"<label>Speed:<br>Fast<input type="\"ran"ge\" name="\"Speed\"min=\"10\"" max="\"200\"">Slow"\

"<br>" \

"</form>" \

"<br>" \

"<input type="\"submit\"" value="\"Send" Data\"SendData()\"">" \

"</body>" \

"</html>";

const char *err2Str(wl_status_t code)

{

 switch (code)

 {

 case WL_IDLE_STATUS: return("IDLE");  break; // WiFi is in process of changing between statuses

 case WL_NO_SSID_AVAIL: return("NO_SSID_AVAIL"); break; // case configured SSID cannot be reached

 case WL_CONNECTED: return("CONNECTED"); break; // successful connection is established

 case WL_CONNECT_FAILED: return("CONNECT_FAILED"); break; // password is incorrect

 case WL_DISCONNECTED:  return("CONNECT_FAILED"); break; // module is not configured in station mode

 default: return("??");

 }

}

 

uint8_t htoi(char c)

{

 c = toupper(c);

 if ((c >= '0') && (c <= '9')) return(c - '0');

 if ((c >= 'A') && (c <= 'F')) return(c - 'A' + 0xa);

 return(0);

}

 

void getData(char *szMesg, uint16_t len)

// Message may contain data for:

// New text (/&MSG=)

// Scroll direction (/&SD=)

// Invert (/&I=)

// Speed (/&SP=)

{

 char *pStart, *pEnd; // pointer to start and end of text

 // check text message

 pStart = strstr(szMesg, "/&MSG=");

 if (pStart != NULL)

 {

 char *psz = newMessage;

 pStart += 6; // skip to start of data

 pEnd = strstr(pStart, "/&");

 if (pEnd != NULL)

 {

 while (pStart != pEnd)

 {

 if ((*pStart == '%') && isxdigit(*(pStart + 1)))

 {

 // replace %xx hex code with the ASCII character

 char c = 0;

 pStart++;

 c += (htoi(*pStart++) << 4);

 c += htoi(*pStart++);

 *psz++ = c;

 }

 else

 *psz++ = *pStart++;

 }

 *psz = '\0'; // terminate the string

 newMessageAvailable = (strlen(newMessage) != 0);

 PRINT("\nNew Msg: ", newMessage);

 }

 }

 // check scroll direction

 pStart = strstr(szMesg, "/&SD=");

 if (pStart != NULL)

 {

 pStart += 5; // skip to start of data

 PRINT("\nScroll direction: ", *pStart);

 scrollEffect = (*pStart == 'R' ? PA_SCROLL_RIGHT : PA_SCROLL_LEFT);

 P.setTextEffect(scrollEffect, scrollEffect);

 P.displayReset();

 }

 // check invert

 pStart = strstr(szMesg, "/&I=");

 if (pStart != NULL)

 {

 pStart += 4; // skip to start of data

 PRINT("\nInvert mode: ", *pStart);

 P.setInvert(*pStart == '1');

 }

 // check speed

 pStart = strstr(szMesg, "/&SP=");

 if (pStart != NULL)

 {

 pStart += 5; // skip to start of data

 int16_t speed = atoi(pStart);

 PRINT("\nSpeed: ", P.getSpeed());

 P.setSpeed(speed);

 frameDelay = speed;

 }

}

void handleWiFi(void)

{

 static enum { S_IDLE, S_WAIT_CONN, S_READ, S_EXTRACT, S_RESPONSE, S_DISCONN } state = S_IDLE;

 static char szBuf[1024];

 static uint16_t idxBuf = 0;

 static WiFiClient client;

 static uint32_t timeStart;

 

 switch (state)

 {

 case S_IDLE:  // initialise

 PRINTS("\nS_IDLE");

 idxBuf = 0;

 state = S_WAIT_CONN;

 break;

 case S_WAIT_CONN:  // waiting for connection

 {

 client = server.available();

 if (!client) break;

 if (!client.connected()) break;

#if DEBUG

 char szTxt[20];

 sprintf(szTxt, "%03d:%03d:%03d:%03d", client.remoteIP()[0], client.remoteIP()[1], client.remoteIP()[2], client.remoteIP()[3]);

 PRINT("\nNew client @ ", szTxt);

#endif

 timeStart = millis();

 state = S_READ;

 }

 break;

 case S_READ: // get the first line of data

 PRINTS("\nS_READ ");

 while (client.available())

 {

 char c = client.read();

 

 if ((c == '\r') || (c == '\n'))

 {

 szBuf[idxBuf] = '\0';

 client.flush();

 PRINT("\nRecv: ", szBuf);

 state = S_EXTRACT;

 }

 else

 szBuf[idxBuf++] = (char)c;

 }

 if (millis() - timeStart > 1000)

 {

 PRINTS("\nWait timeout");

 state = S_DISCONN;

 }

 break;

 case S_EXTRACT: // extract data

 PRINTS("\nS_EXTRACT");

 // Extract the string from the message if there is one

 getData(szBuf, BUF_SIZE);

 state = S_RESPONSE;

 break;

 case S_RESPONSE: // send the response to the client

 PRINTS("\nS_RESPONSE");

 // Return the response to the client (web page)

 client.print(WebResponse);

 client.print(WebPage);

 state = S_DISCONN;

 break;

 case S_DISCONN: // disconnect client

 PRINTS("\nS_DISCONN");

 client.flush();

 client.stop();

 state = S_IDLE;

 break;

 default: state = S_IDLE;

 }

}

void setup()

{

 Serial.begin(57600);

 PRINTS("\n[MD_Parola WiFi Message Display]\nType a message for the scrolling display from your internet browser");

 P.begin();

 P.setIntensity(0);

 P.displayClear();

 P.displaySuspend(false);

 P.displayScroll(curMessage, PA_LEFT, scrollEffect, frameDelay);

 curMessage[0] = newMessage[0] = '\0';

 // Connect to and initialise WiFi network

 PRINT("\nConnecting to ", ssid);

 WiFi.begin(ssid, password);

 

 while (WiFi.status() != WL_CONNECTED)

 {

 PRINT("\n", err2Str(WiFi.status()));

 delay(500);

 }

 PRINTS("\nWiFi connected");

 // Start the server

 server.begin();

 PRINTS("\nServer started");

 // Set up first message as the IP address

 sprintf(curMessage, "%03d:%03d:%03d:%03d", WiFi.localIP()[0], WiFi.localIP()[1], WiFi.localIP()[2], WiFi.localIP()[3]);

 PRINT("\nAssigned IP ", curMessage);

}

void loop()

{

 handleWiFi();

 if (P.displayAnimate())

 {

 if (newMessageAvailable)

 {

 strcpy(curMessage, newMessage);

 newMessageAvailable = false;

 }

 P.displayReset();

 }

}

Testing the ESP8266 Smart Notice Board

After uploading the code, the ESP8266 will connect to the WiFi Network using the WiFi Credentials. The Dot Matrix LED Display will show the IP Address after a successful connection. 

                                         


Open your Web Browser and enter the IP Address. The browser will display the following page.

                                               


From the Web Page enter any message that you want to display on DoT Matrix Display as a Notice. Then hit the send button. The Dot Matrix will show the new message in a few seconds.

                                               

Conclusion

In conclusion, building a Smart Notice Board with ESP32-C6 and dot matrix LED display opens up new ways for dynamic communication. This tutorial empowers enthusiasts to work on this exciting project, combining hardware, programming, and creativity. Elevate your notice board game and embrace the future of interactive communication. 


If you are looking for different types of DOT matrix, LED display or LCD display and electronic components and different microcontrollers from Espressif, Arduino, and many more, reach out to electronics components suppliers in india - Campus Component today!        


Added to cart
- There was an error adding to cart. Please try again.
Quantity updated
- An error occurred. Please try again later.
Deleted from cart
- Can't delete this product from the cart at the moment. Please try again later.