0 Introduction
For urban street light management departments, anti-theft and energy saving have always been a very troublesome matter. It requires a lot of manpower, material and financial resources to be invested. Because of the large number of street lights and their scattered geographical locations, it brings great trouble to the staff. difficulty. GPRS stands for General Packet Radio Service [1], and its full English name is General Packet Radio Service. This wireless service is a new type of packet data transmission service opened on the existing GSM network. GPRS uses packet switching technology, which allows multiple users to share certain fixed channel resources. GPRS is particularly suitable for intermittent, sudden or frequent, small-volume data transmission, and is also suitable for occasional large-volume data transmission. It has the advantages of real-time online, pay-per-volume billing, quick login, high-speed transmission, and free switching. Therefore, the wireless communication system established using GPRS is a system with low cost, easy maintenance and promotion, no restrictions, high reliability, good stability, certain advanced nature, standardization and easy expansion. It can be said that applying GPRS to data transmission in street light monitoring systems is currently the most ideal choice.
This system designs a terminal based on the ARM7 processor and a street light monitoring communication system using GPRS technology to realize remote wireless transmission of various field data. Combined with the host computer software, various data are transmitted to the centralized monitoring center in real time to achieve unified monitoring and distributed management of street light operation. The system structure model diagram is shown in Figure 1.
1 Introduction to main chips
1.1 LPC2106 chip [2] The
LPC2106 processor is Philips' ARM7TDMI-S processor. The chip has an ARM7TDMI-SCPU that supports real-time simulation and tracking, and is embedded with 128KB of high-speed Flash memory. Featuring ISP and IAP capabilities, a 128-bit memory interface and a special acceleration system that allows execution of 32-bit code at the highest clock cycle, optional 16-bit Thumb mode at minimal cost in programs where code length is critical It can reduce the code by more than 30%, and the CPU operating frequency can reach 60MHz; LPC2106 is small in size and has two low-power consumption modes: idle and power-down, which ensures that the system is used at low power consumption and is very power-saving. It is an ideal choice for street light monitoring systems. Its internal RAM reaches 64K in size and provides interfaces such as I2C serial and SPI serial interfaces, allowing LPC2106 to carry out various expansions in the GPRS system; its two timers each have 4 capture/compare channels, suitable for street light control Multi-channel data processing, watchdog timer ensures system security, and dual power supply technology ensures system reliability.
1.2 P87LPC760 chip [3]
P87LPC760 is a 14-pin packaged microcontroller. It is suitable for many occasions that require high integration and low cost, and can meet various performance requirements. It is a member of Philips' small package series. P87LPC760 provides high-speed and low-speed crystal oscillator and RC oscillation modes, programmable selection with a wide operating voltage range, programmable I/O line output mode selection, and optional Schmitt Special trigger input LED driver, output with internal watchdog timer, P87LPC760 adopts accelerated 80C51 processor structure, the instruction execution speed is twice that of the standard 80C51 MCU. As a slave processor in the street light monitoring communication terminal.
2 Hardware system structure
2.1 GPRS communication terminal hardware structure
GPRS street light monitoring system terminal is installed at each data collection point of the street light. It is connected to the GPRS transparent data transmission terminal through the RS232 port and RS485 port. The data is encapsulated by the protocol and sent to the GPRS data of China Mobile. Network, transmit data to the street light monitoring center through the GPRS data network, realizing real-time online connection between the street light terminal and the street light monitoring center system. The hardware structure of the GPRS communication terminal adopts the design method of master-slave CPU, which improves the reliability and operating speed of the system. The main processor adopts Philip's ARM7TDMI-S processor LPC2106, which is mainly responsible for the encapsulation of the protocol and the realization of communication with GPRS; from The processor uses Philips' P87LPC760, which is mainly responsible for controlling the ARM7 chip and GPRS module. The implementation structure diagram of the GPRS monitoring communication terminal is shown in Figure 2.
2.2 Implementation of monitoring communication hardware
In the street light monitoring communication terminal, the main processor is the LPC2106 processor based on the AMR7 core. It is the hardware core of the entire system. The connection structure diagram is shown in Figure 3. The main function is to realize communication under GPRS. For protocol encapsulation and data transmission, AT commands suitable for GPRS are also used, the TCP/IP protocol is used to package the data into IP packets, and the wireless GPRS network is accessed through the GPRS interface, and the Winsock control is used to receive data and exchange data.
2.3 Implementation of monitoring communication control
The slave processor uses P87LPC760, and its main function is to control the data transmission communication between the LPC2106 processor and the GPRS module;
2.4 Implementation of monitoring communication interface
Since the monitoring communication terminal is a 3.3V system, and the UART1 of the core processor LPC2106 has a complete modem interface and uses TTL level, the 8-channel RS232 conversion chip SP3238 is used for RS232 level conversion and For serial communication, the SP3238 chip is a +3.0V and +5.5V RS232 converter. Features include low power consumption, high data rate, enhanced ESD protection, etc. MAX3485 is an RS485 level converter, and these port lines can be reserved for users to use for other functions.
2.5 Implementation of GPRS module
ZTE ZTE815 is mainly used to implement GPRS module, using SIM card for implementation. Pins 1 and 4 of the SIM card are connected to the power supply, pin 2 is connected to ground, pin 3 is reset, connected to pin 41 of ZTE815; pin 5 is the clock, connected to pin 45 of ZTE815; pin 6 is the communication read and write I/O pin. Connect to pin 43 of ZTE815.
3 Design of GPRS communication software The
design of the software is the core of this monitoring communication terminal. The communication module design is the main part of the entire terminal software design. The software design uses the ADS integrated development environment of ARM Company and uses C language for programming, mainly for LPC2106 The processor controls and implements protocol encapsulation and communication with the GPRS system. From the initialization of the serial communication module design to the communication process design with the GPRS terminal with a SIM card, each functional module of the software needs to be taken into account, including parameter settings and automatic reception. Data, request data and signal judgment, etc.
3.1 Communication command processing
Communication data processing is mainly related to the data that needs to be sent and the information received. By establishing AT instructions in the ARM7 module, data can be sent and received, and the analysis and control of AT instructions can be realized. The AT commands used in this system are: establishing TCP/socket connection command "AT+ISTCP:"; sending data command "AT+ISSND%:"; querying data command "AT+ISRCV:"; querying data link command "AT +ISST: "; Module exits transmission mode command "AT+IMCM"; Query module signal value command "AT+CSQ"; Module returns data transmission mode command "ATO"; DTU returns control command mode command "AT+I"; Close SOCKET command "AT+ISCLS: ".
3.2 Introduction to the main functions of the system
Communication control is a relatively complex process. The main functions of this system are: (1) Comparison function between the received string and the target pSrc string unsigned char Recive_GpCmp (const unsigned char *pSrc, unsigned char unNum), use For the detection of received instructions; (2) Extract the signal strength function unsigned char Achieve_IMFSrong(void), the signal strength is 0~30; (3) Compare the connection return value function unsigned char Achieve_Socket(void); (4) Establish the SOCKET connection function void Connect_Socket(unsigned char *pIp), this function is responsible for sending the IP address and port number. The waiting time is one minute. In the data return value, I/000 indicates that the connection is successful, the handle number is 000, and I/ERROR indicates that the connection has timed out. or unsuccessful; (5) Query signal strength function void Check_IMFSrong(void), equal to 1 means query signal strength status, equal to 0 means idle state, when checking signal strength, the maximum time is 3.2 seconds, the time interval is 6 minutes, and in The main loop calls this function; (6) Query the online status, call the function void Check_Gprs(void) at second interval, set the online query interval to 3 minutes, and confirm the disconnection after judging offline twice.
3.3 Implementation of data sending and receiving functions
Due to space limitations, each function cannot be described in detail. The following mainly implements the data sending and receiving functions.
3.3.1 Implementation of receiving data function
void Recive_Data_Socket(void)
{
unsigned char buf[20],i;
Check_IMFSrong();
if(ucGPRSMode&&ucGprsLink)
{
for(i=0;i
buf=pGPRSCMD[2];
buf[i++] =0x0d;
ucGPRSMode="1"; //Receive data
UART1_SendStr(buf,i);
}
}
3.3.2 Implementation of send data function
Void Send_Data_Socket( )
{
unsigned char i,j,tmp,buf[20];
unsigned short usYn,usTmp,usLen;
if(Len==0)return ;
for (i =0;i
{
buf = pGPRSCMD[1];
}
i--;
buf[i++] = ':';
for (j=0; j<3;j++)
buf[i++]=szGprsHandle[j]; //Data handle number
buf[i++] = ',';
usTmp =10000;
usYn="0";
usLen="Len";
for(j= 0;j<5;j++) //Send length
{
tmp="usLen/usTmp";
usLen="usLen"%usTmp;
if(usYn)
{
buf[i++]=tmp+'0';
}
else
{
if(tmp )
{
usYn="1";
buf[i++]=tmp+'0';
}
}
usTmp/=10;
}
buf[i++] = ':';
UART1_SendStr(buf,i); //Send data header
UART1_SendStr(Data ,Len); //Send data
}
Previous article:Serial communication solution based on ARM7 and virtual instruments
Next article:Hardware design of automatic switching measurement and control unit for LP2132 chip
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Detailed explanation of intelligent car body perception system
- How to solve the problem that the servo drive is not enabled
- Why does the servo drive not power on?
- What point should I connect to when the servo is turned on?
- How to turn on the internal enable of Panasonic servo drive?
- What is the rigidity setting of Panasonic servo drive?
- How to change the inertia ratio of Panasonic servo drive
- What is the inertia ratio of the servo motor?
- Is it better for the motor to have a large or small moment of inertia?
- What is the difference between low inertia and high inertia of servo motors?
- Adjustable speed fan cooling system with temperature measurement feedback
- Wi-Fi Solutions for IoT Wireless Designs
- [TI recommended course] #TI? Application of interface chips in automotive products#
- 【GD32E231_DIY】-01: Schematic diagram & PCB
- Live broadcast at 10 am today [ST three-phase motor control solution for home appliances]
- Apply for free evaluation! ——ESP32-S2-Kaluga-1 new multimedia development board, flexible disassembly and assembly to meet various needs
- What is the difference between a multivibrator and a bistable trigger? Their circuits are similar. What are the categories of triggers?
- Dengge's open source FOC motor driver data based on esp32 (less than 100 yuan, you can DIY it yourself)
- Key points of RF circuit design
- New book recommendation: MicroPython Projects