Project showcase
LED Matrix 8x32 Internet News Feed

LED Matrix 8x32 Internet News Feed

Showing real-time news feed from the internet on a LED Matrix 8x32 panel using WIFI connection with NodeMCU ESP8266.

  • 260 views
  • 0 comments
  • 0 respects

Components and supplies

MAX7219 LED Matrix 8x32
You can also use 4x "Max 7219 LED Matrix 8x8" modules
×1
Nodemcu
NodeMCU ESP8266 Breakout Board
×1
Adafruit industries ada258 image 75px
Li-Ion Battery 1000mAh
[Optional] Any power supply grater than 5v to supply the LED Matrix
×1

Necessary tools and machines

09507 01
Soldering iron (generic)
USB -> Micro USB Cable
Cut it and connect the VCC and Ground to the LED Matrix

Apps and online services

About this project

Demonstration
  • What is it?

This project was made in association between the Software Engineering and Programming Languages 2 fields of the University of Pernambuco Campus Caruaru in Brazil, Pernambuco.

It's just a simple way to fulfill the need for information inside the university by (for instance) bringing useful topics from the official website of the university to the LED panel making it more visible for the students.

  • What does it do?

What this does is to show headlines of the website so that the students can read it and access the website to read the full story.

Using AIThinker's NodeMCU ESP8266 it connects to the webpage where the data is stored and fetches the data to the board's memory, then shows it in the LED Matrix.

  • How does it do?

The target webpage is larger than the memory, using http requests it would request the entire page source code so we had to come up with a way to filter the data before fetching it, we do it with PHP, there's a PHP page where it filters and shows only the necessary data from the target website.

So via WIFI the NodeMCU ESP8266 sends httpp requests to the webpage where the data is filtered, there is also a function to filter this data to make sure we show only the exact piece of information we need and store it in a variable.

This variable is used in the Matrix function which shows text on the matrix.

You can easily learn how to use the LED Matrix with the help of the libraries .

Note: You'll ned a 5v power supply or a USB Cable connected to the LED Matrix 8x32 module. In this case we cut and sold the vcc and ground from the USB Cable on the Matrix pins

  • Be advised

DO NOT connect the Matrix positive and negative pins directly to your NodeMCU this will cause problems with your board. It'll fry your NodeMCU board

Code

UPE News - Internet News Feed on LED Matrix 8x32 using NodeMCU ESP8266C/C++
Internet News Feed on LED Matrix 8x32

Using MAX 7266 LED Matrix 8x32
NodeMCU ESP8266.
Arduino IDE
//------------- Libraries --------------

#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <Wire.h>  // This library is already built in to the Arduino IDE

#include <SPI.h>
#include <bitBangedSPI.h>
#include <MAX7219_Dot_Matrix.h>


//-------------------------------------

const byte chips = 4; //how many MAX 8x8 display modules 
unsigned long lastMoved = 0;        
unsigned long MOVE_INTERVAL = 50;  // mS
int  messageOffset;

MAX7219_Dot_Matrix display (chips, 2);  // Number of Chips / LOAD pin (set in the MAX library)

int value = 0;
 
const char* ssid = "WIFISSID";     // Wifi SSID and Password
const char* password = "Pasword";
 
void setup () {

   display.begin ();   / From the MAx library, this fucntion set up the  displays


//============= Initiate WIFI ==================
 
  Serial.begin(115200);
  WiFi.begin(ssid, password);
 
  while (WiFi.status() != WL_CONNECTED) {
 
    delay(1000);
    Serial.print("Connecting..");
  }

 
  Serial.println("conectado!");
//================================================


} 
void loop() {


// Sometimes we print in the Serial Monitor to see if it's working
// it's a good practice

 static String exibir[10];
 
  String payload = "";
    char texto[90];
    int i;


// Fetch data from website
// You can learn more by searching for "Http requests"

  if (WiFi.status() == WL_CONNECTED) { //Check WiFi connection status if connected then...
 
    HTTPClient http;  //Declare an object of class HTTPClient
 
    http.begin("http://leiturasiteupe.esy.es/");  //Specify request destination
    int httpCode = http.GET(); //Send the request

    Serial.println(httpCode);
 
    if (httpCode > 0) { //Check the returning code

      Serial.println("teste");
      payload = http.getString();   //Get the request response payload which is the whole website in textf format
      Serial.flush();
      Serial.println(payload); //Print the response payload
 
    }
    http.end();   //Close connection
 
  }

  filtro(payload,exibir); //Filters the text from the website

  while(i<10){
    messageOffset = 0;
    lastMoved = 0;
    
   exibir[i].toCharArray(texto,90);
    while(messageOffset<strlen (texto)* 8){
     
     // update display if time is up
  if (millis () - lastMoved >= MOVE_INTERVAL)
    {
    display.sendSmooth(texto, messageOffset);
  
  // next time show one pixel onwards
  if (messageOffset++ >= (int) (strlen (texto) * 8))
    messageOffset = - chips * 8;
    lastMoved = millis ();
    delay(50);
    }
    }

   i++;
}
  delay(30000);    //Send a request every 30 seconds
 
}

//==========================================================================================


/*
  Since the board NodeMCU can't hold too much data, you have to come up with a way
  to filter the data before fetching it. Here we use a custom PHP webpage to get the data
  from the target website and then we get the filtered data from the PHP page.

  NodeMCU <--- ----> [Filtered Data (PHP webpage)] <--- [Target Webpage]

*/


// This function filters the payload from the website, since every website has different kinds of 
//structures you will have to  come up with a different funcion accodging with your needs. 

// Here we search for the line between  the <br> html tag in the website source code (payload)
// Which gives us the news headline

//==========================================================================================

void filtro(String payload, String *exibir){
  
  int posicao_busca = 0;
  int final_noticia = 0;
  
  
  for(int i = 0; i < 10; i++){
  
    posicao_busca = payload.indexOf("br",posicao_busca);
    final_noticia = payload.indexOf('<',posicao_busca);
    exibir[i] = payload.substring(posicao_busca + 4,final_noticia);
    posicao_busca = final_noticia +17;

// The MAX library only works with English based keyboard characters     
// So we have to hange special characters for normal characters here 
// If you don't have special characters you don't need to write this

    exibir[i].replace("","a");
    exibir[i].replace("","a");
    exibir[i].replace("","a");
    exibir[i].replace("","a");
    exibir[i].replace("","e");
    exibir[i].replace("","e");
    exibir[i].replace("","i");
    exibir[i].replace("","o");
    exibir[i].replace("","o");
    exibir[i].replace("","o");
    exibir[i].replace("","u");
    exibir[i].replace("","c");
    exibir[i].replace("","A");
    exibir[i].replace("","A");
    exibir[i].replace("","A");
    exibir[i].replace("","A");
    exibir[i].replace("","E");
    exibir[i].replace("","E");
    exibir[i].replace("","I");
    exibir[i].replace("","O");
    exibir[i].replace("","O");
    exibir[i].replace("","O");
    exibir[i].replace("","U");
    
    Serial.println(exibir[i]);
  }

//==========================================================================================


}

Schematics

Schematics
Schematics xp6lor7dt4
Pins LED Display <-> NodeMCU
Schematics nodemcu 6b1rbdihpn
NodeMCU
Nodemcu schematics ctitbh01ib

Comments

Add projectSign up / Login