How To Make Wireless RGB LED Matrix Text Display
Create your own RGB LED Matrix Text Display with this comprehensive DIY tutorial! Perfect for tech enthusiasts and hobbyists, this video will guide you through each step, from selecting the right components to programming and assembling your LED matrix. Watch as we break down the entire process in an easy-to-understand way, helping you bring vibrant, customizable text displays to life. Enhance your projects and impress your friends with this exciting LED project.
Diagram:
Components:
- RGB 8×8 WS2812 LED Matrix : https://roboman.in/wgis
- ESP32 Module : https://roboman.in/ur20
- XL4015 Buck Converter : https://roboman.in/81ea
- DC Socket : https://roboman.in/xezf
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
#include <BluetoothSerial.h> #include "Arduino.h" #include <Wire.h>//Include libraries: SoftwareSerial & Wire BluetoothSerial ESP_BT; //Define PIN11 & PIN12 as RX and TX pins //#include "BluetoothSerial.h" //BleSerial ble; #include <Adafruit_GFX.h> #include <Adafruit_NeoMatrix.h> #include <Adafruit_NeoPixel.h> #include <EEPROM.h> #define EEPROM_SIZE 512 #ifndef PSTR #define PSTR // Make Arduino Due happy #endif #define PIN 5 // MATRIX DECLARATION: // Parameter 1 = width of NeoPixel matrix // Parameter 2 = height of matrix // Parameter 3 = pin number (most are valid) // Parameter 4 = matrix layout flags, add together as needed: // NEO_MATRIX_TOP, NEO_MATRIX_BOTTOM, NEO_MATRIX_LEFT, NEO_MATRIX_RIGHT: // Position of the FIRST LED in the matrix; pick two, e.g. // NEO_MATRIX_TOP + NEO_MATRIX_LEFT for the top-left corner. // NEO_MATRIX_ROWS, NEO_MATRIX_COLUMNS: LEDs are arranged in horizontal // rows or in vertical columns, respectively; pick one or the other. // NEO_MATRIX_PROGRESSIVE, NEO_MATRIX_ZIGZAG: all rows/columns proceed // in the same order, or alternate lines reverse direction; pick one. // See example below for these values in action. // Parameter 5 = pixel type flags, add together as needed: // NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs) // NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers) // NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products) // NEO_GRBW Pixels are wired for GRBW bitstream (RGB+W NeoPixel products) // NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2) // Example for NeoPixel Shield. In this application we'd like to use it // as a 5x8 tall matrix, with the USB port positioned at the top of the // Arduino. When held that way, the first pixel is at the top right, and // lines are arranged in columns, progressive order. The shield uses // 800 KHz (v2) pixels that expect GRB color data. //Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix( // 32, //Select LEDs of each row (15 in my case) // 8, //Select amount of rows (7 in my case) // PIN, // NEO_MATRIX_BOTTOM + NEO_MATRIX_RIGHT + //Define first data pin (right bottom corner is my first pin) // NEO_MATRIX_ROWS + NEO_MATRIX_ZIGZAG, //Define the type of connection (in a zig zag connections and divided by rows not columns) // NEO_RGB + NEO_KHZ800); Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(32, 8, PIN, NEO_MATRIX_TOP + NEO_MATRIX_RIGHT + NEO_MATRIX_COLUMNS + NEO_MATRIX_PROGRESSIVE, NEO_RGB + NEO_KHZ800); int Red=255,Green=0,Blue=0; String text="Easy Tech"; String RGB; int pixelPerChar = 5,RGB_Completed=0; int Delay, Brightness; const uint16_t colors[] = {matrix.Color(Green,Red,Blue)}; // matrix.Color(255, 0, 0), matrix.Color(0, 255, 0), matrix.Color(0, 0, 255) };//matrix.Color(Red, Green, Blue), void setup() { Serial.begin(115200); ESP_BT.begin("RGB LED DISPLAY"); EEPROM.begin(EEPROM_SIZE); initdata(); // Serial.println("Start"); const uint16_t colors[] = {matrix.Color(Green,Red,Blue)}; matrix.begin(); matrix.setTextWrap(false); matrix.setBrightness(Brightness); matrix.setTextColor(colors[0]); //matrix.setTextColor(matrix.Color(Green,Red,Blue)); } int x = matrix.width(); int pass = 0; void loop() { while(ESP_BT.available()){ char ReadChar = (char)ESP_BT.read(); Serial.println(ReadChar); // Right parentheses ) indicates complet of the string if(ReadChar == ')' ||ReadChar == '}' || ReadChar == ']'){ if(ReadChar == ')' ){ RGB_Completed = 1; } if(ReadChar == '}'){ RGB_Completed = 2; } if(ReadChar == ']'){ RGB_Completed = 3; } } else{ RGB += ReadChar; } } if(RGB_Completed!=0){ if(RGB_Completed==1){ Light_RGB_LED(); RGB_Completed=0; } if (RGB_Completed==2){ text=RGB; int _size = text.length(); int i; for(i=0;i<_size;i++) { EEPROM.write(50+i,text.charAt(i)); Serial.println(text.charAt(i)); } EEPROM.write(50+_size,'\0'); //Add termination null character for String Data RGB_Completed=0; RGB=""; } if (RGB_Completed==3){ int val=RGB.toInt(); if(val>0 && val<=100){ if(val==0){ val=1; } Delay=(100-val)*2.5; //scroll(Delay); EEPROM.write(0,Delay); } else{ val=val-100; matrix.setBrightness(val); EEPROM.write(5,val); } RGB=""; RGB_Completed=0; } } if(RGB_Completed==0){ //. Serial.println(RGB_Completed); scroll(); } } void scroll(){ //Serial.println(text); int maxDisplacement = text.length() * pixelPerChar + matrix.width(); matrix.fillScreen(0); matrix.setCursor(x, 0); matrix.print(text); if(--x < -maxDisplacement) { x = matrix.width(); if(++pass >= 1){ pass = 0; // matrix.setTextColor(colors[pass]); matrix.setTextColor(matrix.Color(Green,Red,Blue)); // matrix.setTextColor(matrix.Color(Red,Green,Blue)); } } matrix.show(); delay(Delay); } void Light_RGB_LED(){ int SP1 = RGB.indexOf('.'); int SP2 = RGB.indexOf('.', SP1+1); int SP3 = RGB.indexOf('.', SP2+1); String R = RGB.substring(0, SP1); String G = RGB.substring(SP1+1, SP2); String B = RGB.substring(SP2+1, SP3); Red=R.toInt();Green=G.toInt();Blue=B.toInt(); // Serial.println(R); matrix.setTextColor(matrix.Color(Green,Red,Blue)); EEPROM.write(10,Red);EEPROM.write(15,Green);EEPROM.write(20,Blue); RGB=""; } void initdata(){ int Speed=EEPROM.read(0); if(Speed==NULL || Speed==0){ Delay=100; } else{ Delay=Speed; } int bright= EEPROM.read(5); if(bright==NULL || bright==0){ Brightness=40; } else{ Brightness=bright; } int r= EEPROM.read(10); if(r==NULL){ Red=0; } else{ Red=r; } int g= EEPROM.read(15); if(g==NULL){ Green=255; } else{ Green=g; } int b= EEPROM.read(20); if(b==NULL){ Blue=0; } else{ Blue=b; } char data[100]; //Max 100 Bytes int len=0; char k; String Text= ""; k=EEPROM.read(50); while(k != '\0' && len<500) //Read until null character { k=EEPROM.read(50+len); data[len]=k; Text+=k; len++; } data[len]='\0'; if(Text==NULL){ text="EASY TECH"; } else{ text=Text; } Serial.println(Speed); Serial.println(Brightness); Serial.println(Red); Serial.println(Green); Serial.println(Blue); Serial.println(text); } |