An interesting project that can be done using Microcontroller is a LED message scroll er. It teaches you a quite lot of things. So I decided to make one. I made the hardware design modular and cascadeble That means the whole display is made up of several 15×7 modules. Each module has everything to drive 15×7 led matrix which includes a ULN2003 row driver IC and two shift register IC to drive the 15 columns. Data is loaded serially into the 15 columns. and multiplexing is done along the row.

The 15×7 Smart LED Board.

15x7 LED Matrix Board

The 15×7 Smart LED Board.

 

LED Scrolling Message Display Schematic

Schematic.

The Controller Board.

Any cheap AVR MCU like a ATmega8 can be used to control this board (also up to 4 such boards which give a total of 60px by 7px display). We are using our low cost development board as the controller to the LED matrix board. This board can be purchased at a price as low as Rs. 249 including the MCU ! So wiring this project is a matter of ten minutes !

28 pin avr devboard

Low Cost AVR Board

 

LED Scrolling Text Project with ATmega8

Whole Setup.

Connecting The Display Module with Devboard.

15x7 LED Display PIN Out

PIN Diagram.

 

PIN No

PIN Name

Devboard PIN

1

GND

GND

2

N/C

 

3

+5V IN

+5V out

4

N/C

 

5

Serial Data In

PB0

6

ST_CP

PB2

7

SH_CP

PB1

8

ROW A

PD0

9

ROW B

PD1

10

ROW C

PD2

11

ROW D

PD4

12

ROW E

PD5

13

ROW F

PD6

14

ROW G

PD7

Program

The program is written in C language and compiled using the free GNU C compiler for AVR Platform. The Project manager is AVR Studio 4. More information on how to install and use these software tool please see the following article.


/******************************************************************************

A Simple 15x7 LED Moving Message Display System.

Hardware
  ATmega8 running at 16Mhz
  LOW FUSE  = 0xFF
  HIGH FUSE = 0xC9

Written By
  Avinash Gupta
  gmail@avinashgupta.com
  Ya thats correct ! My Email ID is reverse in format of others !

Copyright 2012
  eXtreme Electronics, India
  www.eXtremeElectronics.co.in

WARNING !!!

  NO PART OF THIS WORK CAN BE USED IN ANY PRINTED OR ELECTRONIC MEDIA
  WITHOUT A WRITTEN PERMISSION FOR THE ORIGINAL AUTHORS.

  WE STRICTLY PROHIHIT THE USE OF THIS SOURCE CODE IN ANY COMMERCIAL
  APPLICATION.

******************************************************************************/

#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <string.h>

#include "font5x7.h"


volatile PGM_P ptr=smallFont;

volatile uint16_t ii,iii;

//Message to display
volatile char string[]="Welcome ! * Avinash Gupta * ";
volatile uint8_t len;


#define DISP_ROW_CNT 7
#define DISP_COL_CNT 15

/***************************************

Configure Connections

****************************************/

#define HC595_PORT   PORTB 
#define HC595_DDR    DDRB

#define HC595_DS_POS PB0
#define HC595_SH_CP_POS PB1
#define HC595_ST_CP_POS PB2

/***************************************
Configure Connections ***ENDS***
****************************************/

void HC595Init()
{
   HC595_DDR|=((1<<HC595_SH_CP_POS)|(1<<HC595_ST_CP_POS)|(1<<HC595_DS_POS));
}

#define HC595DataHigh() (HC595_PORT|=(1<<HC595_DS_POS))
#define HC595DataLow() (HC595_PORT&=(~(1<<HC595_DS_POS)))

void HC595Pulse()
{
   //Pulse the Shift Clock
   HC595_PORT|=(1<<HC595_SH_CP_POS);//HIGH

   HC595_PORT&=(~(1<<HC595_SH_CP_POS));//LOW
}

void HC595Latch()
{
   //Pulse the Store Clock

   HC595_PORT|=(1<<HC595_ST_CP_POS);//HIGH
   _delay_loop_1(1);

   HC595_PORT&=(~(1<<HC595_ST_CP_POS));//LOW
   _delay_loop_1(1);
}



void SelectRow(uint8_t r)
{
   DDRD|=(0B11110111);
   PORTD&=(0B00001000);

   switch(r)
   {
      case 6:
         PORTD|=(1<<PD0);
         break;
      case 5:
         PORTD|=(1<<PD1);
         break;
      case 4:
         PORTD|=(1<<PD2);
         break;
      case 3:
         PORTD|=(1<<PD4);
         break;
      case 2:
         PORTD|=(1<<PD5);
         break;
      case 1:
         PORTD|=(1<<PD6);
         break;
      case 0:
         PORTD|=(1<<PD7);
         break;
   }
}

void main()
{
   // Prescaler = FCPU/256
   TCCR0|=((1<<CS02));

   //Enable Overflow Interrupt Enable
   TIMSK|=(1<<TOIE0);

   //Initialize Counter
   TCNT0=0;

   //Enable Global Interrupt
   sei();

   //Init Shift Register
   HC595Init();

   //Get Length of message
   len=strlen(string);

   ii=iii=0;


   while(1)
   {
   }

}

ISR(TIMER0_OVF_vect)
{

   /*

   This interrup service routine (ISR)
   Updates the displays

   */

   static uint8_t row;
   static uint16_t cnt=0;

   cnt++;


   //Handle Scrolling
   if(cnt == 29)
   {
      cnt =0;

      ii++;
      if(ii==5)
      {
         ii=0;
         iii++;
         if(iii>len)
            iii=0;
      }

      return;
   }

   //Now Transfer a row of data
   int8_t col;

   int8_t chr = iii;
   int8_t m=ii;

   for(col=0;col<DISP_COL_CNT;col++)
   {
      uint8_t data;

      if(m!=5)
      {
         data=pgm_read_byte( ptr + ((string[chr]-' ')*5)+m);
      }
      else
      {
         data=0x00;
      }

      if((data & (1<<row)))
         HC595DataHigh();
      else
         HC595DataLow();

      HC595Pulse();

      m++;

      if(m==6)
      {
         chr++;
         m=0;

         if(chr >=len)
            chr=0;
      }

   }

   //Acivate a row according to 'row'
   SelectRow(row);
   HC595Latch();

   row++;
   if(row==DISP_ROW_CNT)
   {
      //If on last row then come
      //back to first.
      row=0;
   }

}

Downloads

Author

Avinash Gupta

http://www.AvinashGupta.com (My Facebook Profile)