Arduino Led Matrix
Hello everyone today we gonna make an arduino 6*24 led matrix its kind of intermediate level project but you can make it very simple
Components and supplies
1
Arduino UNO
3
74HC595
1
Jumper wires (generic)
144
5 mm LED: Red
6
Resistor 1k ohm
1
Custom PCB
1
General Purpose Transistor NPN
24
Resistor 220 ohm
1
Dotted Pcb
1
CD4017
2
Male-Header 36 Position 1 Row- Long (0.1")
Tools and machines
1
Solder Flux, Rosin Mildly Activated RMA
1
Soldering iron (generic)
1
Solder Wire, Lead Free
Apps and platforms
1
Arduino IDE
Project description
Code
Arduino Code
c_cpp
Led Matrix Arduino Code
1//feel free to contact 2//www.youtube.com/ZenoModiff 3//sreeramaj53@gmail.com 4 5#define BA {B01110000,B10001000,B10001000,B11111000,B10001000,B10001000} 6#define BB {B11110000,B10001000,B10001000,B11110000,B10001000,B11111000} 7#define BC {B11111000,B10000000,B10000000,B10000000,B10000000,B11111000} 8#define BD {B11110000,B10001000,B10001000,B10001000,B10001000,B11110000} 9#define BE {B11111000,B10000000,B10000000,B11110000,B10000000,B11111000} 10#define BF {B11111000,B10000000,B10000000,B11110000,B10000000,B10000000} 11#define BG {B01110000,B10001000,B10000000,B10011000,B10001000,B01110000} 12#define BH {B10001000,B10001000,B11111000,B10001000,B10001000,B10001000} 13#define BI {B11111000,B00100000,B00100000,B00100000,B00100000,B11111000} 14#define BJ {B00111000,B00010000,B00010000,B00010000,B10010000,B01100000} 15#define BM {B10001000,B11011000,B10101000,B10101000,B10001000,B10001000} 16#define BN {B10001000,B11001000,B10101000,B10101000,B10011000,B10001000} 17#define BL {B10000000,B10000000,B10000000,B10000000,B10000000,B11111000} 18#define BO {B01110000,B10001000,B10001000,B10001000,B10001000,B01110000} 19#define BP {B11110000,B10001000,B10001000,B11110000,B10000000,B10000000} 20#define BQ {B01110000,B10001000,B10101000,B10011000,B01111000,B00001000} 21#define BR {B11110000,B10001000,B10001000,B11110000,B10001000,B10001000} 22#define BS {B01110000,B10001000,B01100000,B00010000,B10001000,B01110000} 23#define BK {B10001000,B10010000,B11100000,B11100000,B10010000,B10001000} 24#define BT {B11111000,B00100000,B00100000,B00100000,B00100000,B00100000} 25#define BU {B10001000,B10001000,B10001000,B10001000,B10001000,B01110000} 26#define BV {B10001000,B10001000,B10001000,B10001000,B01010000,B00100000} 27#define BW {B10001000,B10001000,B10101000,B10101000,B10101000,B01010000} 28#define BX {B10001000,B01010000,B00100000,B00100000,B01010000,B10001000} 29#define BY {B10001000,B01010000,B00100000,B00100000,B00100000,B00100000} 30#define BZ {B11111000,B00001000,B00110000,B01100000,B10000000,B11111000} 31#define LA{B00000000,B01110000,B00001000,B01111000,B10001000,B01111000} 32#define LB{B10000000,B10000000,B10110000,B11001000,B10001000,B11110000} 33#define LC{B00000000,B01110000,B10000000,B10000000,B10001000,B01110000} 34#define LD{B00001000,B00001000,B01111000,B10001000,B10001000,B01111000} 35#define LE{B00000000,B01110000,B10001000,B11111000,B10000000,B01110000} 36#define LF{B00110000,B01001000,B01000000,B11100000,B01000000,B01000000} 37#define LG{B00000000,B01111000,B10001000,B01111000,B00001000,B01110000} 38#define LH{B10000000,B10000000,B10110000,B11001000,B10001000,B10001000} 39#define LI{B00100000,B00000000,B01100000,B00100000,B00100000,B01111000} 40#define LJ{B00010000,B00000000,B00111000,B00010000,B10010000,B01100000} 41#define LK{B10000000,B10010000,B10100000,B11000000,B10100000,B10010000} 42#define LL{B01100000,B00100000,B00100000,B00100000,B00100000,B01111000} 43#define LM{B00000000,B00000000,B11010000,B10101000,B10101000,B10001000} 44#define LN{B00000000,B00000000,B10110000,B11001000,B10001000,B10001000} 45#define LO{B00000000,B01110000,B10001000,B10001000,B10001000,B01110000} 46#define LP{B00000000,B11110000,B10001000,B11110000,B10000000,B10000000} 47#define LQ{B00000000,B01101000,B10011000,B01111000,B00001000,B00001000} 48#define LR{B00000000,B00000000,B10110000,B11001000,B10000000,B10000000} 49#define LS{B00000000,B01110000,B10000000,B01110000,B00001000,B11110000} 50#define LT{B01000000,B01000000,B11100000,B01000000,B01001000,B00110000} 51#define LU{B00000000,B00000000,B10001000,B10001000,B10011000,B01101000} 52#define LV{B00000000,B00000000,B10001000,B10001000,B01010000,B00100000} 53#define LW{B00000000,B00000000,B10001000,B10101000,B10101000,B01010000} 54#define LX{B00000000,B10001000,B01010000,B00100000,B01010000,B10001000} 55#define LY{B00000000,B10001000,B10001000,B01111000,B00001000,B01110000} 56#define LZ{B00000000,B11111000,B00010000,B00100000,B01000000,B11111000} 57#define SPACE{B00000000,B00000000,B00000000,B00000000,B00000000,B00000000} 58#define NUM0{B01110000,B10011000,B10101000,B10101000,B11001000,B01110000} 59#define NUM1{B00100000,B01100000,B10100000,B00100000,B00100000,B01110000} 60#define NUM2{B01110000,B10001000,B00001000,B01110000,B10000000,B11111000} 61#define NUM3{B11110000,B00001000,B00001000,B01111000,B00001000,B11110000} 62#define NUM4{B10001000,B10001000,B10001000,B11111000,B00001000,B00001000} 63#define NUM5{B11111000,B10000000,B11110000,B00001000,B10001000,B01110000} 64#define NUM6{B11111000,B10000000,B11111000,B10001000,B10001000,B11111000} 65#define NUM7{B11111000,B00001000,B00001000,B01111000,B00001000,B00001000} 66#define NUM8{B11111000,B10001000,B11111000,B10001000,B10001000,B11111000} 67#define NUM9{B11111000,B10001000,B11111000,B00001000,B00001000,B11111000} 68#define DEVIDE{B00001000,B00010000,B00100000,B00100000,B01000000,B10000000} 69#define TWODOTS{B01100000,B01100000,B00000000,B00000000,B01100000,B01100000} 70#define DOT{B00000000,B00000000,B00000000,B00000000,B01100000,B01100000} 71#define COMA{B00000000,B00000000,B00000000,B00110000,B00110000,B01100000} 72#define LINE{B00000000,B00000000,B11111000,B11111000,B00000000,B00000000} 73#define QUASTION{B01110000,B10001000,B00010000,B00100000,B00000000,B00100000} 74#define MARK{B00100000,B01110000,B01110000,B00100000,B00000000,B00100000} 75 76int latchPin = 10; 77int clockPin = 13; 78int dataPin = 11; 79int clock = 9; 80int Reset = 8; 81int latchPinPORTB = latchPin - 8; 82int clockPinPORTB = clockPin - 8; 83int dataPinPORTB = dataPin - 8; 84int i = 0; 85long scrolling_word[6]; 86int array_turn=0; 87byte your_text[8][6]={BZ,BE,BN,BO,BSPACE,BM,BO,BD,BI,BF,BF};//PUT YOU TEXT HERE 88 89 90void setup(){ 91 Serial.begin(9600); 92 pinMode(dataPin,OUTPUT); 93 pinMode(clockPin,OUTPUT); 94 pinMode(latchPin,OUTPUT); 95 pinMode(clock,OUTPUT); 96 pinMode(Reset,OUTPUT); 97 digitalWrite(Reset,HIGH); 98 digitalWrite(Reset,LOW); 99 setupSPI(); 100} 101 102void display_word(int loops,byte word_print[][6],int num_patterns,int delay_langth){// this function displays your symbols 103 i = 0;// resets the counter fot the 4017 104 for(int g=0;g<6;g++)//resets the the long int where your word goes 105 scrolling_word[g] = 0; 106 for(int x=0;x<num_patterns;x++){//main loop, goes over your symbols 107 // you will need to find a better way to make the symbols scroll my way is limited for 24 columns 108 109 for(int r=0;r<6;r++)//puts the buildes the first symbol 110 scrolling_word[r] |= word_print[x][r]; 111 for (int z=0;z<6;z++){//the sctolling action 112 for(int p=0;p<6;p++) 113 scrolling_word[p] = scrolling_word[p] << 1; 114// end of the scrolling funcion 115 for(int t=0;t<delay_langth;t++){// delay function, it just loops over the same display 116 for(int y=0;y<6;y++){// scaning the display 117 if(i == 6){// counting up to 6 with the 4017 118 digitalWrite(Reset,HIGH); 119 digitalWrite(Reset,LOW); 120 i = 0; 121 } 122 latchOff(); 123 spi_transfer(make_word(0x01000000,y));// sending the data 124 spi_transfer(make_word(0x00010000,y)); 125 spi_transfer(make_word(0x00000100,y)); 126 latchOn(); 127 delayMicroseconds(800);//waiting a bit 128 latchOff(); 129 spi_transfer(0);// clearing the data 130 spi_transfer(0); 131 spi_transfer(0); 132 latchOn(); 133 digitalWrite(clock,HIGH);//counting up with the 4017 134 digitalWrite(clock,LOW); 135 i++; 136 } 137 } 138 } 139 } 140 finish_scroll(delay_langth); 141} 142 143void finish_scroll(int delay_scroll){// this function is the same as the funcion above, it just finishing scrolling 144 for (int n=0;n<24;n++){ 145 for(int h=0;h<6;h++) 146 scrolling_word[h] = scrolling_word[h] << 1; 147 for(int w=0;w<delay_scroll;w++){ 148 for(int k=0;k<6;k++){ 149 if(i == 6){ 150 digitalWrite(Reset,HIGH); 151 digitalWrite(Reset,LOW); 152 i = 0; 153 } 154 latchOff(); 155 spi_transfer(make_word(0x01000000,k)); 156 spi_transfer(make_word(0x00010000,k)); 157 spi_transfer(make_word(0x00000100,k)); 158 latchOn(); 159 delayMicroseconds(800); 160 latchOff(); 161 spi_transfer(0); 162 spi_transfer(0); 163 spi_transfer(0); 164 latchOn(); 165 digitalWrite(clock,HIGH); 166 digitalWrite(clock,LOW); 167 i++; 168 } 169 } 170 } 171} 172 173byte make_word (long posistion,byte turn){ 174 byte dummy_word = 0; 175 for(int q=0;q<8;q++){ 176 if(scrolling_word[turn] & (posistion<<q)) 177 dummy_word |= 0x01<<q; 178 } 179 return dummy_word; 180} 181 182 183 void loop() { 184 185 display_word(1,your_text,8,15); 186 187 } 188 189 190 191void latchOn(){ 192 bitSet(PORTB,latchPinPORTB); 193} 194 195void latchOff(){ 196 bitClear(PORTB,latchPinPORTB); 197} 198 199 200void setupSPI(){ 201 byte clr; 202 SPCR |= ( (1<<SPE) | (1<<MSTR) ); // enable SPI as master 203 //SPCR |= ( (1<<SPR1) | (1<<SPR0) ); // set prescaler bits 204 SPCR &= ~( (1<<SPR1) | (1<<SPR0) ); // clear prescaler bits 205 clr=SPSR; // clear SPI status reg 206 clr=SPDR; // clear SPI data reg 207 SPSR |= (1<<SPI2X); // set prescaler bits 208 //SPSR &= ~(1<<SPI2X); // clear prescaler bits 209 210 delay(10); 211} 212byte spi_transfer(byte data) 213{ 214 SPDR = data; // Start the transmission 215 while (!(SPSR & (1<<SPIF))) // Wait the end of the transmission 216 { 217 }; 218 return SPDR; // return the received byte, we don't need that 219} 220 221
Downloadable files
Gerber File
Upload The Gerber File To JLCPCB Paste The link in a new Tab https://bit.ly/3vbqZvs order from jlcpcb
Gerber File

Gerber File
Upload The Gerber File To JLCPCB Paste The link in a new Tab https://bit.ly/3vbqZvs order from jlcpcb
Gerber File

Comments
Only logged in users can leave comments