Design of wireless LED display screen control system based on SIM300

Publisher:古宝奇缘Latest update time:2011-11-28 Source: 广州大学华软软件学院 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Abstract: In view of the widespread application of LED dot matrix display screens and the advantage of GPRS network nationwide coverage, a wireless LED display screen control system solution based on GPRS technology is proposed. The system structure, software and hardware design process and communication protocol formulation of the control system are introduced in detail. This design has obvious advantages when multiple LED display screens are networked and controlled, and the LED screens are distributed over a wide range. It can broaden the application field of LED display screens and has certain application value.

0 Introduction

With the development and improvement of LED technology, large-scale LED display screens have been widely used in various public places to display multimedia information such as text, graphics, video images, etc. In the construction of urban information modernization, LED display screens have become one of the important media for modern information dissemination. With the rapid increase in the number of outdoor LED screens and the expansion of their scope of use, new requirements have been put forward for the management and control of LED display screens.

1 System Working Principle

This system is mainly composed of a host computer and a slave computer. The host computer is a device that is installed with LED screen management software and can connect to the Internet or GPRS network, such as a PC, mobile device, etc. The slave computer is a LED screen wireless controller based on an AVR microcontroller control module. The system topology is shown in Figure 1.

The system mainly uses the GPRS module as a wireless modem to realize the dial-up Internet access of the LED display wireless controller (as the client), and conducts TCP wireless communication with the host computer on the Internet (as the server) to realize data transmission and complete the wireless data update of the LED screen.

2 Lower Computer Hardware Design

As shown in Figure 2, the LED screen wireless controller is mainly composed of four parts: power module, GPRS module, AVR microcontroller control module, and LED display screen.

2.1 AVR MCU Control Module

In order to ensure the real-time and efficiency of communication data and drive the LED display at the same time, the MCU used in this module is ATMEL's ATmega162 with dual serial ports. It is an 8-bit low-power CMOS microcontroller based on AVRRISC. It has very high stability and reliability, can adapt to various environments, and is suitable for various wireless LED display environments.

This module mainly processes the information received by the GPRS module, and transmits the received screen information to the LED screen. At the same time, it sends AT commands through the serial port to monitor whether the GPRS module has new messages. Once there is, it immediately enters the serial port interrupt and processes the data. Under the TCP/IP protocol, the data is transmitted in hexadecimal format, and there is no need to decode Chinese characters, which greatly simplifies the design of the system's peripheral circuits.

2.2 GPRS module circuit

The GPRS module uses SIM300 from SIMCOM. This module is compact and has outstanding performance. It can be widely used in wireless voice transmission, vehicle-mounted systems, remote meter reading, security monitoring, remote control and telemetry, handheld devices and other fields.

The SIM300 module has a fully functional system interface, with an internally integrated TCP/IP protocol stack and expanded TCP/IP AT commands, and can interactively operate the AT commands provided by the serial port. This can reduce the difficulty of development, facilitate data transmission, and has low costs and good system scalability.

SIM300 needs an external SIM card holder, whose serial port is connected to the serial port of the microcontroller, to transmit the information received by the GPRS module to the microcontroller for data processing. The AVR microcontroller controls the switch of the SIM300 module. The connection diagram of the AVR microcontroller and the SIM300 module is shown in Figure 3.

2.3 LED screen drive circuit

The LED strip screen of this system uses the classic 74HC595 as the column driver of the dot matrix output and ULN2803 as the row driver. The drive circuit design of this solution is simple in software and hardware design, and has low power consumption, strong driving ability, and fewer occupied I/O port lines. It is a low-cost and flexible design solution.

3 Communication Protocol Design

Since this system uses the GPRS network communication mode, the host computer sets up an LED controller management platform to manage all LED controllers. This LED controller management platform (i.e., "host computer software") communicates with the LED screen wireless controller through the TCP/IP protocol, and can control multiple units at the same time. The host computer software and the LED screen wireless controller are connected using GPRS, and the connection relationship between them is shown in Figure 4.

The LED screen wireless controller is the client, and its data transmission and reception is controlled by the host computer software. When the LED screen controller is powered on, it will actively establish a connection with the host computer software and shake hands. After successful login, the host computer software and the LED controller can transmit data.

The communication protocol between the host computer software and each LED screen wireless controller is based on the TCP protocol, and a custom STCP protocol layer is used to encapsulate the PDU (data unit) data layer protocol. The STCP protocol layer only provides a safe and reliable transmission process for the PDU's carrying framework. The communication network layer structure diagram is shown in Figure 5.

Figure 5 Communication network layer structure diagram

In the custom STCP communication protocol, a series of communication instructions for managing the wireless LED display controller are formulated, mainly to provide specific communication structure and specifications for the programming of the host computer software. The communication packet format is shown in Table 1:

Table 1 Communication packet format

Note:

Complete data length: Integer byte (4 bytes in length), the length of the entire communication packet;

Command word: According to the wireless LED display controller communication instruction table, see Table 2;

Explicit control word: 0-none; 1-up; 2-down; 3-left; 4-right; 5-still; 6-flash; 7-delete;

Data content: information content that needs to be displayed;

Checksum: Cumulative checksum of all data;

According to the actual application needs of the wireless LED display screen controller, the send, delete, display, connect, and disconnect instructions are formulated. The codes and main functions of these instructions are shown in Table 2.

Table 2 Communication command table

After the host computer software sends data to the wireless LED display controller through the Internet, the LED display controller needs to process the received data. According to different instructions, the display content and display mode of the LED display can be controlled (such as up, down, left, right, still, flashing, delete, etc.).

4 Software Design

The software design of this system consists of two parts: the host computer software and the control program of the AVR microcontroller. The host computer software completes the communication with the GPRS module and controls the data information displayed on the LED display screen; the control software of the AVR microcontroller mainly completes the system initialization, GPRS network connection, receives the information sent by the host computer, analyzes the content of the received information, completes the instructions, and converts the published information into dot matrix information as needed, and sends it to the LED display screen for display.

4.1 AVR MCU control program

The control program of AVR microcontroller mainly completes the following functions: connecting to GPRS network, data transmission, and controlling LED screen display.

(1) Initialize the system and SIM300 module and connect to the GPRS network; (2) According to the communication protocol between the display controller and the host computer, communicate and shake hands with the host computer, receive instructions, parse instructions, and store and process information such as display data; (3) Drive the LED screen through the serial port to display information, etc.

The following is a brief introduction to the TCP/IP wireless communication process between the SIM300 module and the host computer.

AT+CGDCONT=1,"IP","CMNET" --Register China Mobile network

OK

AT+CGCLASS? --Display the type of GPRS information mobile

+CGCLASS: "B"

OK

AT+CGATT? --GPRS service attachment/detachment

+CGATT: 1

OK

AT+CGACT=1,1 --Environment activation

OK

AT +CIPSTART = "TCP","202.196.87.7","2020" -- Start

TCP connection (host computer IP address and port number)

OK

CONNECT OK --Connection successful

AT+CIPSEND --Send data via TCP

> HELLO

SEND OK -- sent successfully

4.2 Host computer software

The host computer software of this system mainly uses VC to design a communication interface to realize communication with the LED remote controller. The user interface part is implemented based on Dialog using the MFC framework. When using Visual C++ to develop data transmission through the TCP/IP protocol network, the IOCP framework is used to implement the completion port model of Windows Socket.

IOCP, or I/O Completion Port, is an asynchronous I/O API that can efficiently notify applications of I/O events. After a socket is created, it is associated with a completion port. When an event occurs, the completion port will be added to a queue by the operating system, and then the application can query the core layer to obtain the completion port. Once an I/O operation is completed, a worker thread that can process the result of the operation will receive a notification. Create a certain number of worker threads in this application to handle notifications of overlapping I/O requests.

The startup process of the IOCP framework is shown in Figure 6.

The implementation steps of the IOCP framework are as follows:

(1) Initialize the Winsock working environment, create a completion port, create a completion port thread, establish a listening socket, and associate the socket with the completion port;

(2) The listening socket starts working. When the listening socket receives a connection request from the client TCP, IOCP obtains and processes the message, creates a corresponding Socket object for receiving and processing, and completes the connection work;

(3) After the client completes the TCP connection, data communication can begin. The I/O thread is responsible for distributing I/O requests and allocating the logical processing environment through the thread pool.

(4) After receiving the data, an I/O data structure (WSAOVERLAPPED) provided by Microsoft is expanded to complete protocol parsing and data processing.

In addition, the thread pool here is just a management queue, which is used to manage thread resources and complete the processing of maximum business logic with the least number of threads. The actual executed thread function does not complete the detailed business processing, but only completes the re-call of I/O requests, and the re-processing of I/O requests is realized by virtual functions.

In order to improve the friendliness of the software, the framework uses the Windows message mechanism to interact with the UI and pass the relevant information of the framework to the UI window through window messages. Therefore, a pointer member is reserved in the framework, and when necessary, the message response function is called through the pointer to send a message to the window, and the UI reflects the running information of the framework according to the message.

5 Conclusion

According to the development trend of GSM/GPRS data communication technology in recent years, this paper proposes a design scheme of wireless LED screen controller based on GPRS network and using low-cost SIM300 module. The system uses TCP/IP protocol to realize the transmission of wireless data based on GPRS network. The host computer transmits text or picture information data to the remote LED screen terminal through GPRS network, and can also receive data sent by the client, and then complete various commands according to the content of the data to control the LED screen to display the corresponding information. The system design has achieved good results after testing.

Reference address:Design of wireless LED display screen control system based on SIM300

Previous article:SD storage technology and its application based on S3C2410
Next article:Research on solar photovoltaic power generation system based on network technology

Latest Security Electronics Articles
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号