Bus LED screen designed based on 51 microcontroller

Publisher:声慢慢Latest update time:2023-06-20 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Project introduction

In order to improve the real-time and accuracy of bus stop information, it is convenient for passengers to know the bus arrival information in time, thereby improving the convenience and comfort of bus travel. Traditional bus arrival information is achieved through manual announcements or static stop signs. This method has problems such as untimely, inaccurate, and inconvenient information. The current design is based on the STC89C52 microcontroller and the MAX7219 dot matrix LED driver module. The bus LED screen uses SYN6288 to broadcast the arrival information via voice, which can display the arrival information more accurately and improve the efficiency and convenience of bus travel.


The MAX7219 dot matrix LED driver module is controlled by the STC89C52 microcontroller to convert the information to be displayed into a dot matrix image, and then the MAX7219 dot matrix LED driver module controls the 2*8 LED display to be displayed. At the same time, through the SYN6288 voice module, the arrival information is converted into voice announcements for the convenience of passengers. In this way, passengers can not only see the arrival information, but also hear the voice announcement, which improves the real-time and accuracy of the information and facilitates passengers to understand the bus arrival information in a timely manner.

image-20230607204643238

image-20230607210238652

image-20230607210428095

2. Design ideas

2.1 Hardware design

This design uses STC89C52 microcontroller as the main control chip, the MAX7219 dot matrix LED driver module controls the 2*8 LED display, and the SYN6288 voice module performs voice broadcasting.

Specific hardware design:

(1) STC89C52 microcontroller

STC89C52 microcontroller is a high-performance, low-power 8-bit microcontroller with rich peripheral resources, supports ISP download and online simulation debugging, and is suitable for various applications.

(2) MAX7219 dot matrix LED driver module

MAX7219 is an integrated circuit that can drive an 8×8 dot matrix LED display. It has the characteristics of serial input and parallel output, and can easily control multiple LED displays. This design uses the MAX7219 dot matrix LED driver module to control a 2*8 LED display to display bus stop information.

(3) SYN6288 voice module

SYN6288 is a speech synthesis chip that can convert text into speech output. This design uses the SYN6288 voice module for voice broadcasting to realize voice prompts for bus arrival information.


2.2 Software design

This design uses the Keil C51 compiler for software development. The specific software design is as follows:

(1)LED display control program

The LED display control program mainly implements the MAX7219 dot matrix LED driver module to control a 2*8 LED display to display bus stop information.

Specific implementation process:

① Initialize the MAX7219 dot matrix LED driver module and set parameters such as display mode, scan limit, and brightness.

② Convert the information to be displayed into dot matrix data and store it in the array.

③ Send the dot matrix data to the MAX7219 dot matrix LED driver module through the SPI bus to realize the display of the LED display.

(2) Voice broadcast program

The voice broadcast program mainly implements the SYN6288 voice module for voice broadcast and realizes the voice prompt of bus arrival information.

Specific implementation process:

① Initialize the SYN6288 voice module and set parameters such as baud rate, voice speed, and volume.

② Convert the information to be broadcast into voice data and store it in the array.

③ Send the voice data to the SYN6288 voice module through the serial port to realize voice broadcast.


2.3 Design implementation

This design uses STC89C52 microcontroller as the main control chip, the MAX7219 dot matrix LED driver module controls the 2*8 LED display, and the SYN6288 voice module performs voice broadcasting.

Code design ideas:

(1)LED display control program

① Initialize the MAX7219 dot matrix LED driver module

void Init_MAX7219(void)

 {

     Send_Max7219(0x09, 0x00); //Decoding method: BCD code

     Send_Max7219(0x0a, 0x03); //Brightness

     Send_Max7219(0x0b, 0x07); //Scan limit: 8 digital tubes

     Send_Max7219(0x0c, 0x01); // Turn off display test

     Send_Max7219(0x0f, 0x00); //Normal working mode

 }

② Convert the information to be displayed into dot matrix data and store it in the array


unsigned char code LED_Data[16][8] = {

     {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // empty

     {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // empty

     {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // empty

     {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // empty

     {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // empty

     {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // empty

     {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // empty

     {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // empty

     {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, // All on

     {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // empty

     {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // empty

     {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // empty

     {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // empty

     {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // empty

     {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // empty

     {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // empty

 };

③ Send the dot matrix data to the MAX7219 dot matrix LED driver module through the SPI bus to realize the display of the LED display


void Display_LED(unsigned char *LED_Data)

 {

     unsigned char i;

     for(i=1; i<=8; i++)

     {

         Send_Max7219(i, LED_Data[i-1]);

     }

 }

(2) Voice broadcast program


① Initialize SYN6288 voice module


void Init_SYN6288(void)

 {

     SCON = 0x50; // Serial port working mode 1

     TMOD &= 0x0f; // Timer 1 working mode 0

     TMOD |= 0x20;

     TH1 = 0xfd; // Baud rate: 9600

     TL1 = 0xfd;

     TR1 = 1; // Start timer 1

     P1 = 0xff; // Turn off the SYN6288 voice module

 }

② Convert the information to be broadcast into voice data and store it in the array


unsigned char code Voice_Data[10][10] = {

     "Please note that the bus is about to arrive at the station, please be ready to get on the bus",

     "Passengers please pay attention to safety and ride in a civilized manner. Thank you for your cooperation.",

     "Passengers are requested not to smoke on the bus and keep the air in the carriage fresh",

     "Please do not make loud noises on the bus and keep the carriage quiet",

     "Passengers are requested not to litter on the bus and keep the carriage clean",

     "Please do not occupy seats on the bus and give up your seat to those who need it",

     "Passengers please do not talk on the phone on the bus and respect others",

     "Passengers are requested not to eat on the bus and keep the carriage clean and tidy",

     "Passengers are requested not to crowd the bus and keep the compartments clear",

     "Passengers please do not take photos on the bus and respect other people's privacy."

 };

③ Send the voice data to the SYN6288 voice module through the serial port to realize voice broadcasting


void Play_Voice(unsigned char *Voice_Data)

 {

     unsigned char i;

     P1 = 0xfe; //Open SYN6288 voice module

     for(i=0; i< strlen(Voice_Data); i++)

     {

         SBUF = Voice_Data[i];

         while(!TI); // Wait for sending to complete

         TI = 0;

     }

     P1 = 0xff; // Turn off the SYN6288 voice module

 }

3. Code design

3.1 Max7219 control code

#include

 #include

 #define uchar unsigned char

 #define uint unsigned int

 //Define Max7219 port

 sbit Max7219_pinCLK = P2^2;

 sbit Max7219_pinCS = P2^1;

 sbit Max7219_pinDIN = P2^0;

 uchar code disp1[38][8]={

 {0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C},//0

 {0x10,0x18,0x14,0x10,0x10,0x10,0x10,0x10},//1

 {0x7E,0x2,0x2,0x7E,0x40,0x40,0x40,0x7E},//2

 {0x3E,0x2,0x2,0x3E,0x2,0x2,0x3E,0x0},//3

 {0x8,0x18,0x28,0x48,0xFE,0x8,0x8,0x8},//4

 {0x3C,0x20,0x20,0x3C,0x4,0x4,0x3C,0x0},//5

 {0x3C,0x20,0x20,0x3C,0x24,0x24,0x3C,0x0},//6

 {0x3E,0x22,0x4,0x8,0x8,0x8,0x8,0x8},//7

 {0x0,0x3E,0x22,0x22,0x3E,0x22,0x22,0x3E},//8

 {0x3E,0x22,0x22,0x3E,0x2,0x2,0x2,0x3E},//9

 {0x8,0x14,0x22,0x3E,0x22,0x22,0x22,0x22},//A

 {0x3C,0x22,0x22,0x3E,0x22,0x22,0x3C,0x0},//B

 {0x3C,0x40,0x40,0x40,0x40,0x40,0x3C,0x0},//C

 {0x7C,0x42,0x42,0x42,0x42,0x42,0x7C,0x0},//D

 {0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x7C},//E

 {0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x40},//F

 {0x3C,0x40,0x40,0x40,0x40,0x44,0x44,0x3C},//G

 {0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44},//H

 {0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x7C},//I

 {0x3C,0x8,0x8,0x8,0x8,0x8,0x48,0x30},//J

 {0x0,0x24,0x28,0x30,0x20,0x30,0x28,0x24},//K

 {0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C},//L

 {0x81,0xC3,0xA5,0x99,0x81,0x81,0x81,0x81},//M

 {0x0,0x42,0x62,0x52,0x4A,0x46,0x42,0x0},//N

 {0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C},//O

 {0x3C,0x22,0x22,0x22,0x3C,0x20,0x20,0x20},//P

 {0x1C,0x22,0x22,0x22,0x22,0x26,0x22,0x1D},//Q

 {0x3C,0x22,0x22,0x22,0x3C,0x24,0x22,0x21},//R

 {0x0,0x1E,0x20,0x20,0x3E,0x2,0x2,0x3C},//S

 {0x0,0x3E,0x8,0x8,0x8,0x8,0x8,0x8},//T

 {0x42,0x42,0x42,0x42,0x42,0x42,0x22,0x1C},//U

 {0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18},//V

 {0x0,0x49,0x49,0x49,0x49,0x2A,0x1C,0x0},//W

 {0x0,0x41,0x22,0x14,0x8,0x14,0x22,0x41},//X

 {0x41,0x22,0x14,0x8,0x8,0x8,0x8,0x8},//Y

 {0x0,0x7F,0x2,0x4,0x8,0x10,0x20,0x7F},//Z

 {0x8,0x7F,0x49,0x49,0x7F,0x8,0x8,0x8},//中

 {0xFE,0xBA,0x92,0xBA,0x92,0x9A,0xBA,0xFE},//Country

 };

 void Delay_xms(uint x)

 {

  uint i,j;

  for(i=0;i< x;i++)

   for(j=0;j< 112;j++);

 }

 //---------------------------------------------

 //Function: Write bytes to MAX7219(U3)

 //Entry parameters: DATA 

 //Export parameters: none

 //illustrate:

 void Wri_Max7219_bytete(uchar DATA)         

 {

         uchar i;    

         Max7219_pinCS=0;        

         for(i=8;i >=1;i--)

           {       

             Max7219_pinCLK=0;

             Max7219_pinDIN=DATA&0x80;

             DATA=DATA< < 1;

             Max7219_pinCLK=1;

            }                                 

 }

 //------------------------------------------------

 //Function: Write data to MAX7219

 //Entry parameters: dress, datad

 //Export parameters: none

 //illustrate:

[1] [2]
Reference address:Bus LED screen designed based on 51 microcontroller

Previous article:Design of frequency measurement module circuit using microcontroller as core
Next article:Design of intelligent clothes drying rack based on STC89C52 microcontroller

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号