LED Moving Message Display using AVR ATmega8

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.

Video Demo

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

PD1

9

ROW B

PD0

10

ROW C

PC1

11

ROW D

PD4

12

ROW E

PD5

13

ROW F

PD6

14

ROW G

PD7

Buy this project fully assembled and tested from our online store! Free shipping! Cash on Delivery! Buy Now

Program

The program is written in C language and compiled using the free GNU C compiler for AVR Platform. The Project manager is Atmel Studio 6. 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)

Facing problem with your embedded, electronics or robotics project? We are here to help!
Post a help request.

Avinash

Avinash Gupta is solely focused on free and high quality tutorial to make learning embedded system fun !

More Posts - Website

Follow Me:
FacebookLinkedInGoogle Plus

86 thoughts on “LED Moving Message Display using AVR ATmega8

  • By ABHISHEK - Reply

    Thanks for lot of information. What all changes(in code) i need to do to implement this using Atmega32? Please reply.

  • By calin - Reply

    Very cool, i like the idea! This could be useful in some projects. I like the way how you write the software. Is very organised, with comments and explanations. Keep the good job up!

  • By Suman Biswas - Reply

    Excellent job…

  • By Rupayan - Reply

    project = great<85;

  • By anil - Reply

    hello sir,
    thanks 4 this valuable info but sir when i build the code it shows the error that
    ../MLED.c:8:21: fatal error: font5x7.h: No such file or directory
    plese help me
    thnks

  • By ja - Reply

    Are the LED matrix common cathode or anode?

  • By VASANT PANCHAL - Reply

    sir,
    I am interested in purchase of led moving message display
    project, complet with,display module,controller ,development board .complete to run the project.
    kindly advise the cost including postage/qurrier charges.
    I am in AHMEDABAD At following address.

    VASANTBHAI PANCHAL
    36 , SHREE RANG VILLA ROW HOUSES ,
    NR. L.J.COLLEGE,VASTRAPUR, AHMEDABAD- 380015,
    GUJARAT.
    TEL;079-26761139;
    MOB; 9638178925
    EMAIL – pvasant_2006@yahoo.ca
    Thanks.

  • By Amit - Reply

    Dear sir, when i running this project on proteus, LEDs are scrolling (it seems one is scrolling). Message is not scrolling.

  • By kiranvarma-npeducations - Reply

    Excellent tutorial avinash, i want to buy your PCB board. you didn’t mention any cost of it. where do i get it.

  • By kuldeep - Reply

    sir,
    thank you
    i want to buy this project
    i am living in rajkot(gujarat)
    before giving my further information i want some changes in this project
    1. i want to interface 12 key keyboard with it
    2. i want 20(5*7) led in row and 10(5*7) led in column
    3. i also want micro controller to be mounted separately with connector
    my mob no is +918511588011
    reply me as soon as possible
    thank you

  • By partho - Reply

    nice work 🙂
    but just as a matter of fact, can you please include the font file please

  • By surya - Reply

    i have problem to store input in eeprom pls sugest the code to store

    • By Avinash - Reply

      @Surya codes are NOT suggested ! They are written ! And I thing GOD has given you two hand with 5 fingers on each to do the typing!

      • By abhishek rana -

        it is a nyc reply ……..

  • By surya - Reply

    i have problem to store input in eeprom of atmega8535 micro controller pls sugest the code to store in it

  • By i gusti k - Reply

    hello,,,,,Mr.Avinash
    on this topic, i have make hardware for 15X7 dot matrix display,, i use Atmega8 for main controller and 4017 (decoder) to control the column, ( portd=row, 4017=column).
    i use one 4017 for control the column and i group each of 10 column to 1 blok(group).
    please help me to make a c program( i use codevision AVR).
    please replay as soon as possible.
    my emil; adexsugi@gmail.com

    tanks for suggest

    • By Avinash - Reply

      @I Gusti K,

      Please make the circuit as described above and use the program as provided above!
      And please try to understand the fact that no one in this world has enough free time to write programs for strangers !!!

      • By i gusti k -

        im sorry,,
        i try to to make the project as your description.
        and thank much.

        but i want to ask you.
        may i make a project with more colom, if you permit, please advise how to do.
        please replay.

        best regard

  • By studyembedded - Reply

    Hi this is really a cool project, Mr.Avinash well said…people should understand you are showing them to a start they should not take it granted …keep it up man!

  • By The_Next_Engineer - Reply

    Thank you so much,I think this is very much useful…and keep doin the good work you do.:))

  • By Rupa - Reply

    Great work. Helping students, but why dont you suggest some projects related to DSP contorllers.

    eg:F28069,F28335 etc. or some 55X , c2000,c6000 series contollers.

    Regards,

    Rupa

    • By Avinash - Reply

      Sorry I have no experience working on DSPs

  • By nakul pathak - Reply

    hello sir,
    i’ve been trying to program this circuit using my own code.
    can you please tell me how the uln2003a transfers data from one 8 bit port to another. cause i am not able to decode it from the given program.

  • By Albin - Reply

    hello sir,
    how can the speed of scrolling can be adjusting in the program?

  • By Harwinder Singh - Reply

    Thank you sir very much for this,
    sir there need a modification in code that is
    if(iii>=len)
    iii=0;
    instead of
    if(iii>len)
    iii=0;

  • By Febin - Reply

    @avinash it is display is CA, i think correct me if am wrong

    • By Avinash - Reply

      What do you mean by CA?

      • By Febin -

        Column Anode

  • By Sagar - Reply

    I had purchased the Controller Board and Message Display Board From You. when i tried to build this project in AS6 it gives some error regarding prog_uchar is not valid.

    Error 1 unknown type name ‘prog_uchar’

    Error 2 variable ‘smallFont’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))’

    please guide me with it

    • By Liborio - Reply

      I have the same issue, did you fixed it? How…

  • By Avinash - Reply

    @Sagar,

    Is the controller board and display working properly ?

  • By Sagar - Reply

    Ya it working Properly But only when i Build the hex file using AS5 but not in AS6. and i have to modify IO pin to work it properly.

  • By Sagar - Reply

    I get over all the error.

  • By vinod - Reply

    sir,
    I am interested in purchase of led moving message display
    project, complet with,display module,controller ,development board .complete to run the project.
    kindly advise the cost including postage/qurrier charges

    I am in pune, India.
    PLs send details from mail.

    my email- vinodkore777@gmail.com

  • By shailesh prajapati - Reply

    hello avinash sir ,
    good project but my led message continues flier and scrolling. please help me for this problem

    • By shailesh - Reply

      change 20mhz crystel and solve my problem.

      • By HEMANK -

        Is this internal crystal or external?
        and can i directly connect it to atmega8??

      • By Avinash -

        @HEMANK

        Do you have any problem doing it exactly as described?

      • By HEMANK -

        yes sir, bcoz i dont have kit and 1st I want run it on proteus. and on proteus it doesnt give me desire o/p. It show me some line up nd down.

  • By rajesh - Reply

    hello avinash sir,
    can u tell me which dot matrix u have used,either it is common anode row or common anode column.sir pls reply me fast because it argent its my final year project.

    • By shailesh - Reply

      it is common cathod dotmetrix ,common cathod column and common anode row.

      • By shailesh -

        i am sorry it is common anode dotmetrix , common anode coulumn and common cathod row.

    • By akshay - Reply

      i am making this project too.
      can you please help me out with few problems if you completed this project.
      email id: akshaysoni099@gmail.com

  • By rajesh - Reply

    thanks shailesh ,
    can u tell me how to display a message on this dot matrix message send via GSM MODEM pls help i need

  • By Febin - Reply

    hi avinash
    am planing buy complete kit of moving message before that i want to make sure few things
    i want to implement rtc and LM35 what my concern is while reading adc there will be a delay will come.
    and it may lead to flickering of display ???

  • By Ashok Shah - Reply

    Very nice project Avinash Guptaji. I have bought it and it is working. Congrats. Regards

  • By Ashok Shah - Reply

    The project s working very nicely but how can we change the message, please let me know by writing to my private mail and oblige. Regards

    • By Avinash - Reply

      @Ashok Shah

      See the program care fully, make required changes and recompile project. Get the hex file and burn to the MCU.

    • By Dheeraj Sachdeva - Reply

      sir would you please send me circuit diagram with proper connection with microcontroller and font5x7.h file.
      my email id is dheerajsachdeva3@gmail.com
      thanks in advance sir.

  • By Ashok Shah - Reply

    My 15×7 Smart LED Matrix Board was working perfectly fine but has now developed some problem. The message was moving from right to left and all charcters were perfectly readable, but now the characters are not readable and instead of the scrolling or moving message dots seem to be moving only vertically…please guide as to what can be the problem?
    Regards,
    Ashok Shah
    Ahmedabad

  • By Precieux - Reply

    I am about to build the circuit and I’m using LEDs. I have a question though. Are the row pins anode while the column pins cathode?

  • By sonu baliyan - Reply

    sir,
    i want to display “feroze gandhi institute of eng. and technology,raebareli” .so please tell me the size of the led display and is it possible with atmega8, atmega16 ??? .please tell me the cost of display or cost of the project if possible???

  • By sonu baliyan - Reply

    sir,
    i want to display “feroze gandhi institute of eng. and technology,raebareli” .so please tell me the size of the led display and is it possible with atmega8, atmega16 ??? .please tell me the cost of display or cost of the project if possible???

  • By BHESANIYA BHAVESH R - Reply

    PLEASE GIVE SOME IDEA OF PROGRAM OF THIS PROJECT ,USING GSM

  • By Albin - Reply

    hello avinash sir,
    i’m interested to buy the kit. I want to what are the items include in the kit.
    Regards
    Albin

  • By pranav kashyap - Reply

    hi,sir
    i need a program for irc tech fest at least cost. and a atmega16 kit also.
    plz help me.

  • By micro bank - Reply

    sir i want to display font having pixel size is not same how can i do that ?

    Ex. if i want to display “aiaj” where the width of ‘a’ and ‘i’ and ‘j’ is not same than how can i do that. sir i try alot but i only display “ai” but if width of the font increase after ‘i’ than it’s not work.

  • By jewel - Reply

    sir,
    i have few question.

    1> in my pc where i copy “font5x7.h” file ?
    2> how can i modify for 16*16 display.
    3> if i use 16*128 matrix display what i have to do now ?
    my mail is jrigun@yahoo.com
    bangladesh my facebook id is facebook.com/jewel3g. ihope reply me as soon as possible.

  • By vishal - Reply

    whats the purpose of PD3 is left open and even not used in code?
    plz let me know……….. thanks

  • By mannika garg - Reply

    hey avinash sir,
    sir I want the proper schematic diagram . Its not clearly visible here. can u please mail me

  • By shailesh - Reply

    sir , excellent job, i was test this project 5×7 font, interfacing rtc module and display tine,date and day it will work fine ,now i can change led 5×7 matrix to 8×8 matrix ,what is modification change in code,i was test 8×8 font in same code but it was not work properly ,

  • By avasinc - Reply

    Sir, can i ask something. It’s quite difficult for me to know what are the components. Can you pls. help. I need to know it. This is urgent, thanks.

  • By saket - Reply

    hi sir ,

    i am facing a problem on moving any character in a 5×7 led matrix i use simple.code like

    eg:

    port ob11111111

    so.please tell.me how to move the character

  • By kannupandiyan - Reply

    Good morning .,
    I wish to buy this display board ., can u show me the output sir ,

    — Thank you

  • By HEMANK - Reply

    hello sir,

    Thank u for such a information.
    Can I directly connect it to the atmega8??

  • By Sarabjeet Singh - Reply

    Sir,
    Can you please send me all details about AVR MATRIX or FND BASED clock:
    CIRCUIT DIAGRAM,
    PARTS LIST,
    PCB LAYOUT &
    SOURCE CODE ( c and hex)

    Thanks

    Sarabjeet singh

  • By HEMANK - Reply

    hello Sir,

    Can I have its proteus design file please?

    I hardly needed it.

  • By shailesh prajapati - Reply

    Dear avinash sir
    i was done this project with crystal 20 mhz but led flicker rate to high ,can i modify the software for change scan rate .

    • By Avinash - Reply

      @shailesh prajapati,

      what is your order ID?

  • By Hunnie - Reply

    Hello Sir,

    Please explain how we get data through following command

    data=pgm_read_byte(ptr+((string[chr]-‘ ‘)*5)+m)

    Kindly explain the above command.

  • Pingback: [AVR] Do you have 8x8 matrix and Atmega8A project ?

  • Pingback: [AVR] Please Help Me with LED sign board C Program

  • By Dheeraj Sachdeva - Reply

    sir where i had to connect connector pin ( your circuit diagram) with which pin of atmega8, and sir will you please provide font5x7.h file?

  • By zubi - Reply

    can you please give me the Proteus design file , Please ………………………………….

  • By venkatesh - Reply

    is this task possible with max 6952 using atmega 16

  • By Roger - Reply

    Don’t the LED’s in the matrix need current limiting resistors?

    Regards, Roger

  • By Rabindra Bhatta - Reply

    Sir,
    i am getting unknown characters being displayed…Please help me with that
    i did my project from your source code..Can you tell me the need of SelectRow() function too???

  • By Honey - Reply

    whts the coding for showing some lines on led ..how can i make led running project..can anybody plzz tell me

  • By Magic Pixel - Reply

    See amazing LED project here: http://kck.st/1Oi2sHC
    Simply and affordable…

  • By shalini dwivedi - Reply

    hi I am new in this project,I want to know what software should be installed for this.can anybody help me from c coding, hex file and hex file burning for Micro controller.
    Thanks in advance.
    my mail id is shaliniojha31@gmail.com

  • By V.Ramakrishnan - Reply

    I have purchsed the ATmega 8 based moving message display kit.Owing to pre-occupiedin my work I couldnot try the same. Now for the past 2 days i have been trying to run the kit with PS/2 Keyboard.The messages are only that of “Avinash” appears but nothing gets fed from the key board.What would be the reason.I have gone through the sample program found in the web page; and I think the key board files are not included in the program.Is it because of this the keyed messages are not reflected in the display.Please explain.
    This is the first time I am trying with a MCU that too in programming.
    A Line in this problem from you is hoghly anticipated.
    VRK

  • By Deep Barman - Reply

    hello sir
    nice project ,

    how can change msg with ps2 keyboadr? help me sir thanks

  • By deep - Reply

    Hello sir ,

    When code built some error…. Please solution this errors

    fatal error: font5x7.h: No such file or directory

    • By Avinash - Reply

      Hello Mr. DEEP,

      You should download the whole project in atmel studio 6 format from here. It has all the files and the compilation steps. And i suggest you to clearly read the steps and follow them exactly as told. http://digital-wizard.net/files/AS6_M8_MovingMsg.zip

Leave a Reply

Your email address will not be published. Required fields are marked *


+ six = 14

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>