In order to solve the above problems, this paper designs and implements a remote control module for central air conditioning terminal air valve based on the mobile phone SIM card GSM network. In addition to voice services, GSM also has short message data transmission services [4-8]. This module can not only complete the indoor temperature information to the user in the form of short messages through the GSM network, but also the user can send the desired indoor temperature setting to the terminal controller through this module to complete remote control.
This paper uses Samsung's S3C2410 chip as the processor and Linux2.6 as the embedded operating system. Based on the PID control strategy, this paper remotely controls the central air-conditioning terminal device through mobile phone text messages, realizes the setting and monitoring of indoor temperature, and achieves good practical results.
1 Terminal controller system design
1.1 Controller system hardware design
This paper is based on the ARM9 platform, uses the Linux embedded operating system, and uses the S3C2410 processor as the core. The system hardware mainly consists of the following modules:
(1) GSM/GPRS radio frequency module. The radio frequency module used to communicate with the GPRS network. This paper uses the industrial-grade GSM/GPRS dual-band modem module SIM300 launched by Simcom. It has a complete modem signal and can exist as a modem during network communication. The module uses a serial interface communication and mainly provides a wireless interface for voice transmission, short messages and data services, with GPRS function [9]. The peripheral circuit of the SIM300 chip uses the typical connection of the chip, and uses resistor-capacitor charging and Schmitt trigger shaping to obtain a low-level delay of about 1.5 s after power-on to start.
(2) 16C550 serial interface. 16C550 is a high-speed UART chip used to convert parallel port data into serial port data. It has a built-in 16-bit FIFO cache channel and a selectable baud rate. On the one hand, it can obtain complete modem control, and on the other hand, it is also to obtain accurate UART baud rate. This article uses the 16C550 chip when the SIM300 RF module and the control unit composed of the processor communicate serially. The virtual address of the 16C550 chip is 0xdb000000, and it works in FIFO mode with interrupts; its baud rate is set to 115200, transmission without check, 8 data bits, 1 stop bit, ignoring input BREAK, frame errors and parity errors, and using standard mode transmission.
(3) CPU central processing unit. It uses the 32/16-bit high-performance RISC microprocessor S3C2410 based on the ARM920T core produced by Samsung, which has the characteristics of low power consumption, built-in 8-channel 10-bit ADC and DAC, and support for NAND Flash and SDRAM memory. This unit includes the minimum system of the S3C2410 microcontroller, the clock circuit, the reset circuit and other parts.
(4) Input and output unit: The temperature sensor signal in the simulated room is input to the A/D converter of the processor; the output obtained by the processor through the PID algorithm is output by the D/A converter to control the opening of the air supply actuator valve, adjust the air supply volume in the room and achieve the purpose of regulating the indoor temperature.
Figure 1 is the system hardware block diagram.
1.2 Controller system software design
The operating system uses the real-time Linux2.6 kernel, and the compiler uses gcc 4.0.2 version to complete the interface functions of each functional module. When developing the kernel of an embedded system, if the cross-compilation tool (especially gcc) version is low, it is impossible to compile a higher version kernel, and a higher version is also not acceptable. Therefore, this article customizes the cross-compilation environment to develop the terminal controller in conjunction with the Linux2.6.18 kernel to be used. The details are as follows: crosstool-0.43, binutils-2.16.1.tar.bz2, gcc-4.0.2, glibc-2.3.5, glibc-linuxthreads-2.3.5, linux-libc-headers-2.6.12.0, gdb-6.5, and the generated cross-compilation tool is arm-9tdmi-linux-gcc. The initialization and main loop of the short message communication thread are divided into the following 4 steps:
(1) Complete the serial port initialization. After the system is started and initialized, it begins to repeatedly read the serial port data sent by the 16C550 chip. When the GSM module receives a new text message, it sends a string to the processor through the serial port. The format, length and content of the string are fixed, and it starts with +CMTI, which is used as a basis for judging whether a new text message has arrived.
(2) Send an AT command to read the short message to the SIM300 module to determine the content of the short message. First, use the mobile phone number to determine whether the short message is sent by the user. If the short message is sent by the user, then determine the command sent by the user, otherwise delete it directly.
(3) If the content sent by the user is "Set temperature XX" (XX represents a two-digit temperature value), then "XX" is decoded into ASCII characters through a decoding function, and then the temperature that the user expects to set is obtained through conversion and sent to the temperature control module, and finally the information is deleted. If the content sent by the user is "Query status", the current temperature value and indoor status are sent to the user's mobile phone in the form of a short message, and finally the information is also deleted.
(4) The processor continues to read serial port data.
The short message communication program flow is shown in Figure 2.
The processor communicates with the GSM module through the serial port. The basic parameters of serial communication include: baud rate, data bit, stop bit and check mode. The serial port driver implements the read and write operations of the serial port and provides the application with an interface for sending and receiving data. Before the serial port works normally, it is necessary to initialize and select the serial port working mode, set the baud rate, data format and interrupt, and establish a data queue and semaphore. The application can implement the corresponding function by calling the corresponding function.
Taking the serial port sending a string as an example, the sending program is introduced, where buf represents the string to be sent and nbytes represents the number of characters:
int tty_write(char*buf, int nbytes)
{
int i;
for(i=0;i
usleep(100);
}
return tcdrain(tty_fd);
}
The reception and transmission of short messages are completed by the processor and the SIM300 module through the serial communication of the 16C550 chip. The processor sends AT commands to the SIM300 module to read or send short messages. When sending Chinese short messages, the UCS2 code of Chinese characters is sent, so when initializing the SIM300 module, the command "AT+CMGF=0" must be sent to set the module's short message working mode to PDU mode and send short messages in UCS2 encoding. Similarly, the short messages received by the SIM300 module are also in PDU encoding. To read the Chinese commands sent by the user, the message content must be decoded into ASCII characters. According to the actual application (the number of Chinese characters to be sent is small and fixed), from the perspective of saving system resources, the UCS2 encoding table of Chinese characters is directly searched, the UCS2 code of the Chinese characters to be sent is found and sent.
To send a short message, the hexadecimal number of the entire short message code digit must be sent to the SIM300 module first, followed by the short message header code "001100D", the code "9168" of the Chinese area code "+86" and the destination mobile phone number. The destination mobile phone number here must be obtained by swapping every two digits. Since the mobile phone number is 11 digits, the last digit is padded with "N", and the content of the short message is written in UCS2 code, so the encoding code "0008A7" is sent continuously, and finally the UCS2 code of the short message body.
When a new message arrives, the received data packet encapsulates the message sending time, the mobile phone number from which it comes, and the message body. If the mobile phone number from which it comes is inconsistent with the pre-set user number, the short message is directly deleted; if they are consistent, the short message body is continued to be judged. Since the received short message is also Chinese processed by UCS2 encoding, the message body content is compared with the pre-agreed "set temperature" and "current status" two UCS2 codes and then transferred to the corresponding processing function respectively. If it is inconsistent with both agreed codes, it is regarded as an error message deletion.
All program codes in this article are written in C language. The short message sending code is as follows:
void gprs_msg(char*number, char*msgr) //SMS sending function
{
char ctl[]={26,0};
char head[]=″0011000D9168″; //SMS header code and China area code
char headmsg[]=″0008A7″; //SMS encoding method code
unsigned int count;
char sum[2];
tty_writecmd(″at″, strlen(″at″));
tty_writecmd(″at″, strlen(″at″));
tty_write(″at+cmgs=″, strlen(″at+cmgs=″));
count=strlen(msgr)/2+14; //Calculate the length of the SMS
sum[0]=(char)(count/10+48);
sum[1]=(char)(count%10+48); //decode the SMS length
//into hexadecimal
tty_writecmd(sum,2);
tty_write(head,strlen(head));
tty_write(number,strlen(number));
tty_write(headmsg,strlen(headmsg)); //send SMS header
tty_write(msgr,strlen(msgr)); //send SMS body
tty_write(ctl, 1);
tty_write(″r″, strlen(″r″)); //Send SMS end code
usleep(300000); //Process sleep
printf(″Message sent.n″);
}
The above function encapsulates the header information and text character length of the short message sent in PDU mode. The parameters are only the PDU code of the destination mobile phone number and the UCS2 code of the short message body. This avoids a lot of repeated code and improves the running efficiency of the program.
1.3 Incremental PID control strategy
PID is a linear controller that forms a control deviation based on the given value r(t) and the actual output y(t):
Where: KP
is
the proportional coefficient; TI
is
the integral time constant; TD
is
the differential time constant.
Since the computer processes digital quantities and the controller drives the air valve actuator, the control strategy used in the control system is the digital incremental PID.
u(k)=Ae(k)-Be(k-1)+Ce(k-2)
The following is the implementation function of the incremental PID control strategy:
double PID(double feedback)
{
double Err, pErr, dErr, dU;
Err=Command-feedback; //Current error
pErr=Err-ppreErr; //Proportional incremental error
dErr=Err-2*preErr+pre2Err; //Derivative incremental error
dU=Proportion*pErr+pDerivative*dErr+ Integral*Err;
//Control quantity increment
pre2Err=preErr;
preErr=Err;
return dU;
}
2 Experiment
The experimental object takes the physical model of a 1.3-ton central air-conditioning system as an example. The system can simulate multiple operating modes of the central air-conditioning, and can adjust the specific opening of the air valve by inputting analog signals to the execution air valve, so as to adjust the air supply volume sent to the room and achieve the purpose of controlling the cooling capacity of the simulated room. The experimental object has two simulated rooms, in which the driving valve of the terminal device is TANG TECH TM04~24, and the temperature and humidity sensor is VECTOR ADS-H1T1. The 0~4.096 V signal output by the D/A of the embedded controller is amplified to 0~10 V and directly drives the air valve driver. The output range of the temperature and humidity sensor of the simulated room is 1~5 V, which is directly input into the AIN[0] pin of the A/D inside the processor.
The system provides two types of user short message content recognition, namely "Set temperature XX" and "Query status". If the user sends "Query status" and the current indoor status is 23℃, the system automatically returns a short message to the user "Temperature: 23; Status: Normal". If the indoor temperature is abnormal, the system sends a short message to automatically alarm "Temperature 60; Status warning". If the user sends "Set temperature 23", the system changes the current indoor set temperature to 23℃ and replies "The temperature has been set to 23". At this time, the local controller uses PID to control the temperature.
In order to allow users to conveniently turn off the indoor controller without adding other short message content, this article sets a maximum temperature limit of 50°C. When the user sends a "set temperature" greater than 49°C, the system considers that the user requires the controller to be turned off, and then changes the temperature set point to OFF, the air valve is completely closed, and returns a short message "Closed". This method ensures that the system has the function of closing the air valve without adding new short message commands. After the controller is turned off, if the user sends a short message again to set the indoor temperature to a temperature within the normal range, the controller will be turned back on.
See Table 1 for details of the short message command.
In order to test the actual energy-saving effect of the system, the terminal controllers of two simulated rooms are turned on under the condition of outdoor temperature of 9℃, and the expected indoor temperature is set to 23℃. Assuming that there are people in the two rooms, simulated room 1 at 8:00 and simulated room 2 at 9:00; calculations show that turning on the indoor controller of simulated room 2 at 9:00 saves about 7% of the energy consumed throughout the day compared to turning on the indoor controllers of the two simulated rooms at 8:00.
This paper implements the GSM remote control method, which controls the terminal device of the central air-conditioning system and monitors and manages the indoor temperature in real time through mobile phone text messages. The experimental results show that the system can adjust the room temperature conveniently, flexibly, quickly and on demand to achieve energy saving. In addition, the system is highly scalable, and more functions such as terminal energy metering can be realized after software upgrade.
Previous article:Design of a new spherical robot controller based on DSP
Next article:Design of Asynchronous General Timer in VxWorks
- Popular Resources
- Popular amplifiers
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [ESK32-360 Review] 6. Hello! Hello! Hello! Hello!
- [NXP Rapid IoT Review] NXP Rapid IOT Experience
- Is there any teacher who can help me write a program for Mitsubishi FX3U to output pulses?
- RTL8762, an excellent domestic BLE low-power solution
- Bear Pie Huawei IoT operating system LiteOS bare metal driver transplantation 01-Explain driver transplantation using LED as an example
- 【GD32450I-EVAL】Simple oscilloscope demonstration
- Shenzhen becomes the "world's first 5G city": challenges and business opportunities for the PCB industry
- 【Ended】 R&S Live 【PCI Express Gen 3 Conformance Test】
- Live broadcast at 10 am today [Renesas Electronics Secure IoT Suite provides you with secure cloud connection solutions
- Xun developed Qt for Android for i.MX6ULL Terminator QT application