Friday, 8 February 2019

Dot Matrix Led Display With Arduino


Interface 8*8 Dot Matrix Led Display With Arduino
8*8 Dot Matrix Led Display:
First of all let me tell you about max7219 IC and how it is connected to total 64 led which is there in our 8*8 dot matrix.Usinga 7219 IC you can drive 64 LEDs while you only need 4 wires to interface it to a microcontroller. In addition you can daisy chain multiple(up to 8) 7219 chips for bigger displays. There are 16 output lines from the 7219 driving 64 individual LEDs. This sounds impossible but the driving method makes use of the way our eyes work. Persistence of vision is exploited to make the LEDs appear to be on all the time when in fact they are not. In fact the LEDs are arranged as an 8x8 set of rows and columns. Each column is pulsed for a short time while the row bits for that column are driven. As our eyes remember a flash of light for approximately 20ms, so when you continuously flash a light (or an LED) at a rate at or faster than 20ms, then it appears that the light never goes off. This is how the 7219 works. All the leds are individually turned on for a short time, at rate greater than 20ms.

Max7219 SPI Interface:
The MAX7219 has a four wire SPI interface - clock, data, chip select and ground - making it very simple to connect to a microcontroller.
Data - MOSI - Master Output Serial Input. The 7219 is a slave device.
Chip select - Load (CSn) - active low Chip select.
Clock - SCK
Ground.
Circuit Diagram:



Code of Project:
//We always have to include the library
#include "LedControlMS.h"

/*
 Now we need a LedControl to work with.
 ***** These pin numbers will probably not work with your hardware *****
 pin 12 is connected to the DataIn
 pin 11 is connected to the CLK
 pin 10 is connected to LOAD
 We have only a single MAX72XX.
 */
LedControl lc=LedControl(12,11,10,1);

/* we always wait a bit between updates of the display */
unsigned long delaytime=250;

void setup() {
  /*
   The MAX72XX is in power-saving mode on startup,
   we have to do a wakeup call
   */
  lc.shutdown(0,false);
  /* Set the brightness to a medium values */
  lc.setIntensity(0,8);
  /* and clear the display */
  lc.clearDisplay(0);
}


/*
 This method will display the characters for the
 word "Arduino" one after the other on digit 0.
 */
void writeArduinoOn7Segment() {
  lc.setChar(0,0,'a',false);
  delay(delaytime);
  lc.setRow(0,0,0x05);
  delay(delaytime);
  lc.setChar(0,0,'d',false);
  delay(delaytime);
  lc.setRow(0,0,0x1c);
  delay(delaytime);
  lc.setRow(0,0,B00010000);
  delay(delaytime);
  lc.setRow(0,0,0x15);
  delay(delaytime);
  lc.setRow(0,0,0x1D);
  delay(delaytime);
  lc.clearDisplay(0);
  delay(delaytime);
}

/*
  This method will scroll all the hexa-decimal
 numbers and letters on the display. You will need at least
 four 7-Segment digits. otherwise it won't really look that good.
 */
void scrollDigits() {
  for(int i=0;i<13;i++) {
    lc.setDigit(0,3,i,false);
    lc.setDigit(0,2,i+1,false);
    lc.setDigit(0,1,i+2,false);
    lc.setDigit(0,0,i+3,false);
    delay(delaytime);
  }
  lc.clearDisplay(0);
  delay(delaytime);
}

void loop() {
  writeArduinoOn7Segment();
  scrollDigits();
}

0 comments:

Post a Comment

if you have any doubt please let me know