Table of Contents:
Overview:
Hey, If you looking to find an Electronics creative way to propose your Crush, you have stumbled at the right place. This article will help you to propose and get a good impression on you. We will get this done by using the LED Dot matrix. Here you are going to experience the Best way to propose ECE girl with MAX7219 and Arduino.
In this tutorial, we will be going through interfacing an 8X8 Dot Matrix which has a MAX7219 driver, to an Arduino Uno. The components required are pretty less but coding is quite a bit here. So put on your coding hats and let’s get started.
You can watch the following video tutorial for better understanding and real-time experience, or you can go through this article.
Required Components:
1.Arduino UNO Buy from Amazon
2.MAX7219 board Buy from Amazon
3. Bread Board Buy from Amazon
4. Connecting wires Buy from Amazon
Introduction to MAX7219 based 8X8 led matrix board:
A Dot Matrix is a two dimensional patterned LED array, which is used to represent characters, symbols, and images. Almost all the modern display technologies make use of dot matrices including cell phones, television, etc.
A typical 8×8 Dot Matrix unit has 64 LEDs arranged in a plane. You can get your hands on two types of Dot Matrices. One which comes as a plain single matrix which has 16 pins to control the rows and columns of the array. This one would use a lot of wires and things can get a lot messier.
Picture: 8×8 Led dot matrix board.
Interfacing Led dot matrix with Arduino without MAX7219
To simplify these things, it is also available integrated with MAX7219 Driver, which has 24 pins. In the end, you have 5 pins to connect to your I/O which makes your job a lot more easier. There are 16 output lines from 7219 to drive the 64 individual LEDs. This small IC is a 16-bit serial shift register.
The connection between MAX7219 with 8×8 LED dot matrix:
We know that our eyes remember a flash for about 20ms. So the Driver flashes the LEDs at a rate greater than 20ms which makes us feel that the light never goes off. In this way, the 16 pins control 64 LEDs.
You can find the datasheet of MAX7129 here. if you want to know in-depth about the MAX7129.
Circuit Diagram to interface MAX7219 with Arduino:
The MAX7219 driver works on SPI protocol, SPI protocol needs at least 4 pins(MISO-DO, MOSI-DI, CLK, CS) for data transmission and two pins(VCC, GND) for power Total 6 pins are required. but if you observer the module shown below is having only 5 pins(VCC, GND, DI, CS, CLK). Now in the current application, we don’t want to take any data output from the MAX7219 driver, we will just transmit whatever the data we wanted print on the 8×8 Led dot matrix. So while designing th breakout boaard they have left MISO-DO pin open, and didn’t connected any pin to that.
Connect the circuit as shown in the circuit diagram. for your reference, I have mentioned the same connections below the circuit diagram cross-check once.
Arduino ---->>> MAX7219 LED matrix module 1)5V VCC 2)GND GND 3)D12DIN 4)D11 CS 5)D10 CLK
Here we have been done with the interfacing. Now let’s go for the coding.
Arduino Source code:
This sketch will help you to print a string “I LOVE YOU JESSIE” on the LED matrix array. You can replace the same with your crush name for that, you have to modify code from line number 198 to 209. You just need to replace the letter inside the printByte(“letter”); function without “”. Ex: printByte(A); printByte(z);
Here we are using MaxMatrix library to make the process easier which can be downloaded from GitHub.
Download the library from the Github and install in your computer. Similarly, copy/download the below source code to upload the Arduino, for a complete understanding of the code refer the explanation below the source code.
/* Developed by Electronics Innovation Project: Best way to propose ECE crush.||intterfacing MAX7219 led dot matrix module with Arduino Electronics Innovation - www.electronicsinnovation.com GitHub - https://github.com/VeeruSubbuAmi YouTube - http://bit.ly/Electronics_Innovation Upload date: 13 March 2019 Libraries: Adafruit GFX:- https://github.com/adafruit/Adafruit-GFX-Library Adafruit SSD1306:- https://github.com/adafruit/Adafruit_SSD1306 Adafruit-Fingerprint-Sensor-Library:- https://github.com/adafruit/Adafruit-Fingerprint-Sensor-Library This sketch is developed to print characters, symbols, and images on the LED matrix array with the help of MAX7219 driver. Note: 1)Connect the circuit as shown in the circuit diagram. 2) Download and install all the required libraries. All the Links are given above. */ #include <LedControl.h> int DIN = 12; int CS = 11; int CLK = 10; // CAPITAL ALPHABETICS byte A[8]= {0x18,0x3C,0x66,0xC3,0xFF,0xFF,0xC3,0xC3}; byte B[8]= {0xFE,0xFF,0xC3,0xFE,0xFF,0xC3,0xFE,0xFE}; byte C[8]= {0x7E,0xFF,0xC3,0xC0,0xC0,0xC3,0xFF,0x7E}; byte D[8]= {0xFC,0xFE,0xC6,0xC6,0xC6,0xC6,0xFE,0xFC}; byte E[8]= {0x7E,0x7E,0x60,0x78,0x78,0x60,0x7E,0x7E}; byte F[8]= {0x7E,0x7E,0x60,0x78,0x78,0x60,0x60,0x60}; byte G[8]= {0x7E,0xFF,0xC0,0xCF,0xCF,0xC3,0xFF,0x7E}; byte H[8]= {0x66,0x66,0x66,0x7E,0x7E,0x66,0x66,0x66}; byte I[8]= {0x7E,0x7E,0x18,0x18,0x18,0x18,0x7E,0x7E}; byte J[8]= {0x7E,0x7E,0x18,0x18,0xD8,0xD8,0xF8,0xF8}; byte K[8]= {0x63,0x66,0x6C,0x78,0x78,0x6C,0x66,0x63}; byte L[8]= {0xF0,0x60,0x60,0x60,0x60,0x66,0x7E,0xFE}; byte M[8]= {0xC3,0xE7,0xFF,0xDB,0xC3,0xC3,0xC3,0xC3}; byte N[8]= {0xC3,0xE3,0xF3,0xFB,0xDF,0xCF,0xC7,0xC3}; byte O[8]= {0x7E,0xFF,0xC3,0xC3,0xC3,0xC3,0xFF,0x7E}; byte P[8]= {0x7C,0x7E,0x66,0x66,0x7E,0x7C,0x60,0x60}; byte Q[8]= {0x7E,0xFF,0xC3,0xC3,0xC3,0xFF,0x7C,0x0E}; byte R[8]= {0x7C,0x7E,0x66,0x66,0x7E,0x7C,0x6E,0x67}; byte S[8]= {0x7E,0x7E,0x60,0x7E,0x7E,0x06,0x7E,0x7E}; byte T[8]= {0xFF,0xFF,0x99,0x18,0x18,0x18,0x18,0x18}; byte U[8]= {0x66,0x66,0x66,0x66,0x66,0x66,0x7E,0x3C}; byte V[8]= {0x66,0x66,0x66,0x66,0x66,0x66,0x3C,0x18}; byte W[8]= {0xC3,0xC3,0xC3,0xC3,0xDB,0xFF,0xE7,0xC3}; byte X[8]= {0xC3,0x66,0x3C,0x18,0x3C,0x66,0xC3,0x00}; byte Y[8]= {0x81,0xC3,0x66,0x3C,0x18,0x18,0x18,0x18}; byte Z[8]= {0xFF,0xFF,0x8E,0x1C,0x38,0x71,0xFF,0xFF}; //small alphabetics byte a[8]= {0x00,0x18,0x04,0x04,0x1C,0x24,0x1C,0x00}; byte b[8]= {0x20,0x20,0x38,0x24,0x24,0x24,0x38,0x00}; byte c[8]= {0x00,0x00,0x38,0x40,0x40,0x40,0x38,0x00}; byte d[8]= {0x08,0x08,0x38,0x48,0x48,0x48,0x38,0x00}; byte e[8]= {0x00,0x00,0x18,0x24,0x3C,0x20,0x18,0x00}; byte f[8]= {0x00,0x0C,0x10,0x10,0x38,0x10,0x10,0x10}; byte g[8]= {0x00,0x00,0x30,0x48,0x48,0x38,0x08,0x70}; byte h[8]= {0x20,0x20,0x20,0x38,0x24,0x24,0x24,0x00}; byte i[8]= {0x10,0x00,0x30,0x10,0x10,0x10,0x38,0x00}; byte j[8]= {0x08,0x00,0x08,0x08,0x08,0x28,0x18,0x00}; byte k[8]= {0x20,0x20,0x24,0x28,0x30,0x28,0x24,0x00}; byte l[8]= {0x30,0x10,0x10,0x10,0x10,0x10,0x38,0x00}; byte m[8]= {0x00,0x00,0x78,0x54,0x54,0x54,0x54,0x00}; byte n[8]= {0x00,0x00,0x38,0x24,0x24,0x24,0x24,0x00}; byte o[8]= {0x00,0x00,0x18,0x24,0x24,0x24,0x18,0x00}; byte p[8]= {0x00,0x00,0x38,0x24,0x24,0x38,0x20,0x20}; byte q[8]= {0x00,0x00,0x18,0x24,0x24,0x1C,0x04,0x04}; byte r[8]= {0x00,0x00,0x2C,0x30,0x20,0x20,0x20,0x00}; byte s[8]= {0x00,0x00,0x3C,0x40,0x38,0x04,0x78,0x00}; byte t[8]= {0x00,0x10,0x10,0x38,0x10,0x14,0x1C,0x00}; byte u[8]= {0x00,0x00,0x24,0x24,0x24,0x24,0x1C,0x00}; byte v[8]= {0x00,0x00,0x44,0x44,0x44,0x28,0x10,0x00}; byte w[8]= {0x00,0x00,0x54,0x54,0x54,0x54,0x28,0x00}; byte x[8]= {0x00,0x00,0x44,0x28,0x10,0x28,0x44,0x00}; byte y[8]= {0x00,0x00,0x24,0x24,0x24,0x1C,0x04,0x38}; byte z[8]= {0x00,0x00,0x3C,0x04,0x18,0x20,0x3C,0x00}; //Numerics byte zero[8]= {0x18,0x24,0x24,0x24,0x24,0x24,0x24,0x18}; //0 byte one[8]= {0x10,0x30,0x10,0x10,0x10,0x10,0x38,0x00}; //1 byte two[8]= {0x18,0x24,0x04,0x08,0x10,0x20,0x3C,0x00}; //2 byte three[8]= {0x18,0x24,0x04,0x18,0x04,0x24,0x18,0x00}; //3 byte four[8]= {0x04,0x0C,0x14,0x24,0x7E,0x04,0x04,0x00}; //4 byte five[8]= {0x78,0x40,0x70,0x08,0x08,0x48,0x30,0x00}; //5 byte six[8]= {0x30,0x48,0x40,0x70,0x48,0x48,0x30,0x00}; //6 byte seven[8]= {0x00,0x7C,0x04,0x08,0x10,0x10,0x10,0x00}; //7 byte eight[8]= {0x18,0x24,0x24,0x3C,0x24,0x24,0x18,0x00}; //8 byte nine[8]= {0x18,0x24,0x24,0x18,0x04,0x04,0x18,0x00}; //9 //Special Characters byte space[8]= {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; //Space byte exclamation[8]= {0x00,0x10,0x10,0x10,0x10,0x00,0x10,0x00}; // ! byte doublequote[8]= {0x00,0x14,0x14,0x00,0x00,0x00,0x00,0x00}; // " byte hash[8]= {0x00,0x24,0x7E,0x24,0x24,0x7E,0x24,0x00}; // # byte dollar[8]= {0x10,0x3C,0x40,0x38,0x04,0x78,0x10,0x00}; // $ byte percent[8]= {0x00,0x32,0x34,0x08,0x10,0x2C,0x4C,0x00}; // % byte annd[8]= {0x10,0x28,0x28,0x10,0x2A,0x24,0x1A,0x00}; // & byte singlequote[8]= {0x00,0x04,0x04,0x00,0x00,0x00,0x00,0x00}; // ' byte l_brac[8]= {0x00,0x0C,0x10,0x20,0x20,0x10,0x0C,0x00}; // ( byte r_brac[8]= {0x00,0x18,0x04,0x02,0x02,0x04,0x18,0x00}; // ) byte star[8]= {0x00,0x10,0x7C,0x28,0x44,0x00,0x00,0x00}; // * byte plus[8]= {0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00}; // + byte comma[8]= {0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x20}; // , byte minus[8]= {0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x00}; // - byte dot[8]= {0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00}; // . byte slash[8]= {0x00,0x00,0x02,0x04,0x08,0x10,0x20,0x00};// /(Slash) byte colon[8]= {0x00,0x18,0x18,0x00,0x00,0x18,0x18,0x00}; // : byte semicolon[8]= {0x00,0x18,0x18,0x00,0x00,0x18,0x18,0x20}; // ; byte lessthan[8]= {0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x00}; // < byte equal[8]= {0x00,0x00,0x00,0x3C,0x00,0x3C,0x00,0x00}; // = byte greaterthan[8]= {0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x00}; // > byte question[8]= {0x38,0x44,0x44,0x08,0x10,0x10,0x00,0x10}; // ? byte attherate[8]= {0x00,0x38,0x44,0x54,0x6C,0x50,0x40,0x38}; // @ byte l_squarebrac[8]= {0x00,0x38,0x20,0x20,0x20,0x20,0x38,0x00}; // [ byte backslash[8]= {0x00,0x40,0x20,0x10,0x08,0x04,0x02,0x00}; // \ backslash byte r_squarebrac[8]= {0x00,0x1C,0x04,0x04,0x04,0x04,0x1C,0x00}; // ] byte hat[8]= {0x00,0x08,0x14,0x00,0x00,0x00,0x00,0x00}; //hat ^ byte underscore[8]= {0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00}; // _ byte apostrophe[8]= {0x00,0x04,0x02,0x00,0x00,0x00,0x00,0x00}; // ` byte l_curlybrac[8]= {0x00,0x38,0x20,0x40,0x20,0x20,0x38,0x00}; // { byte r_curlybrac[8]= {0x00,0x1C,0x04,0x04,0x02,0x04,0x04,0x1C}; // } byte verticalbar[8]= {0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x00}; // | byte tilde[8]= {0x00,0x00,0x00,0x14,0x28,0x00,0x00,0x00}; // ~ //Symbols byte smile[8]= {0x3C,0x42,0xA5,0x81,0xA5,0x99,0x42,0x3C}; byte neutral[8]= {0x3C,0x42,0xA5,0x81,0xBD,0x81,0x42,0x3C}; byte frown[8]= {0x3C,0x42,0xA5,0x81,0x99,0xA5,0x42,0x3C}; byte love[8]= {0x42,0xE7,0xFF,0xFF,0x7E,0x3C,0x18,0x00}; 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(){ printByte(smile); delay(1000); printByte(space); delay(100); printIloveYou(); printByte(smile); delay(1000); printByte(space); delay(100); lc.clearDisplay(0); delay(1000); } void printIloveYou() { printByte(I); delay(1000); printByte(L); delay(1000); printByte(O); delay(1000); printByte(V); delay(1000); printByte(E); delay(1000); // Love Symbol printByte(love); delay(1000); printByte(Y); delay(1000); printByte(O); delay(1000); printByte(U); delay(1000); // Name of the person printByte(J); delay(1000); printByte(E); delay(1000); printByte(S); delay(1000); printByte(S); delay(1000); printByte(I); delay(1000); printByte(E); delay(1000); } void printByte(byte character []) { int i = 0; for(i=0;i<8;i++) { lc.setRow(0,i,character[i]); } } </pre> <h4>Code Explanation:</h4> Include the library that will be used as shown below <pre>#include <LedControl.h></pre> Declare the pins of the Arduino to which each pin of the LED matrix is connected. <pre>int DIN = 12; int CS = 11; int CLK = 10;</pre> Next, declare the byte arrays which represent characters or graphics which you would like to display. Remember, we already covered how to create graphic’s byte arrays easily above. So create some byte arrays and add them to this. <pre>byte c[8]= {0x7E,0x7E,0x60,0x60,0x60,0x60,0x7E,0x7E}; byte eight[8]= {0x7E,0x7E,0x66,0x7E,0x7E,0x66,0x7E,0x7E}; byte s[8]= {0x7E,0x7C,0x60,0x7C,0x3E,0x06,0x3E,0x7E}; byte dot[8]= {0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18}; byte o[8]= {0x7E,0x7E,0x66,0x66,0x66,0x66,0x7E,0x7E}; </pre> I know you got a doubt that how you can develop this hex number byte array. you can find the detailed explanation below this. Next, Initialize the LED control library by creating an object of the library. In void setup function to prepare the display by taking it off the power saving mode, setting the brightness of the LEDs to the maximum and clearing the Display. <pre>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 } </pre> Next, move to the loop function. since our goal is to display the graphics, that can be done here. The printbyte() function is used to display the character or graphics stored in any of the byte arrays and a delay is kept after it to enable the printed graphics to spend some time on the screen before another one is shown. <pre>void loop(){ printByte(smile); delay(1000);
How to create the graphics???
The 8×8 LED matrix is made up of 64 LEDs to display graphics, text, and symbols by turning certain LEDs on while other LEDs are turned off. Instead of writing the byte array to instruct the code on which LED to turn on or off when a particular text or symbol is to be displayed, we can generate the byte array with the help of a simple software called pixeltomatrix which I found online. It generates byte arrays for LED matrix after the design has been done to show which LED will stay on and Which LED will go off to properly represent the image, symbol, or text.
You can download the software from here:
GUI of pixel to matrix software
The Graphics is drawn by highlighting each of the green boxes in the image above to represent what we wish to display as I did for “O” in the image below.
Creating character ‘A’
Once highlighting has been done, tap on the generate button. It will translate the pixels a byte array ( like the one in the image below) which can be used in our code.
Generating byte array for character ‘A’
Copy the generated text and past into the source code as shown here. Similarly repeat the same process for all characters, symbols, and pictures and create a byte array for all.
I have already created for all the characters and symbols so that you can easily use them.
Results on MAX7219 matrix board:
I capture every letter displayed and uploaded here. buy usually one will overwrite other after one second.
You can watch the exact result in the video given below.
MAX7219 Tutorial & output Video:
:
Thank you.
[…] display, we can observe that each pixel is nothing but a tiny LED. As I have explained in one of my previous Article, We can print anything on this display by glowing the exact pattern of pixels or LEDs and keep the […]