Abstract : This paper describes an intelligent in-vehicle environment remote monitoring system consisting of a GSM module, a Freescale microcontroller control unit, and a wireless transceiver module. The hardware circuit design and software design process are analyzed. In this system, the GSM module uses a TC35 chip for data communication with the Freescale microcontroller; the wireless transceiver module uses a Bluetooth chip BC417143 for short-range wireless communication between the main control unit and the controlled unit. This system utilizes the SMS function of a GSM mobile phone to achieve remote control and remote alarm of the in-vehicle environment. The solution is simple, feasible, and has significant advantages.
Keywords : MC9S12DG128, GSM, SMS, remote control
1 Introduction
With the development and improvement of GSM wireless remote communication technology, the use of GSM SMS service to achieve intelligent and user-friendly in-vehicle environments has gradually gained acceptance. SMS is a communication mechanism that uses mobile phones to send and receive short text messages via mobile networks, and it is the simplest and most convenient data communication method in the GSM system. SMS adopts a store-and-forward mode, completing the sending and receiving of short messages through the Short Message Center (SMC), thus achieving secure and timely point-to-point communication. Remotely monitoring and controlling in-vehicle equipment using mobile phone SMS has become a simple and easy method. Users can achieve intelligent control of the car's in-vehicle environment by sending a single SMS, breaking through the limitations of on-site operation. The intelligent in-vehicle environment control system introduced in this paper uses a GSM module for SMS sending and receiving, and a 16-bit Freescale microprocessor replaces the 8-bit microcontroller as the main control unit, realizing functions such as remote control and remote alarm.
2 System Design
The system consists of a GSM module, an MCU control module (including peripheral circuits such as a clock module, power module, keyboard module, and display module), a wireless transceiver module, an interface driver circuit, and a detection module. Its system design block diagram is shown in Figure 1.
Figure 1 System hardware circuit diagram
This system primarily implements two functions: remote control and remote alarm. Remote control commands: Users send control signals via SMS to the GSM module through the GSM network. The GSM module transmits the SMS content to the main MCU using AT (Automatic Transmission) mode. The main MCU analyzes the received commands and then transmits them to the slave MCU via a wireless transceiver module. The slave MCU then controls the on/off of corresponding lighting or electrical equipment, thus achieving remote intelligent control of the vehicle's interior environment. Remote alarm: The slave MCU periodically monitors various indicators inside the vehicle, such as smoke and temperature, through a monitoring module. If the interior temperature is too high or too low, or if there is a fire hazard, the system will immediately cut off the relevant power supply, activate the alarm, and send an alarm SMS to a designated mobile phone. This achieves remote monitoring of the vehicle's interior environment.
3 Hardware Circuit Design
The MCU used is the MC9S12DG128, a 16-bit microcontroller with a 16-bit central processing unit as its core. It features 128KB of Flash EEPROM memory, 8KB of RAM, 2KB of EEPROM, and two 8-channel analog-to-digital converters (ADCs). The temperature sensor is internally connected to the AN00 input channel, enabling A/D conversion to digital values. Two asynchronous serial communication interfaces are provided; communication with the GSM module is achieved via UART. The hardware circuit of the control module using the MC9S12DG128 as the main control chip is shown in the figure.
Figure 2 System board schematic diagram
The MC9S12DG128 and TC35 use serial communication for their data interface, configured with 8 data bits, 1 stop bit, and no parity bit. The TC35 data interface operates at CMOS levels, while the MC9S12DG128 operates at TTL levels. Therefore, a level conversion chip, MAX232, is added between the MC9S12DG128 and TC35 to ensure serial communication. Here, pins PS1 and PS0 are directly used as the Tx and Rx pins of the UART.
Figure 3 Serial port conversion circuit
The wireless transceiver module uses the CSR Bluetooth chip BC417143. This chip is suitable for short-range wireless communication, has a wireless RF module and a self-contained antenna, features a variable baud rate, and is controlled using AT commands. This module is responsible for establishing the connection between the master MCU and the slave MCU and for communication between them.
The detection module includes a smoke detector, a CO sensor, and a temperature sensor. The smoke detector uses an NIS-09C sensor, connected to pin AN01, and can effectively detect the occurrence of ignition fires, with its own independent alarm. In the early stages of a fire, when the smoke concentration inside the vehicle exceeds a set threshold, the indicator light on the ionization smoke detector base will illuminate, and an alarm voltage signal will be sent out. In the input circuit, the interface circuit within the ionization smoke detector is crucial. Through the detector interface circuit, the detector alarm voltage signal can be converted into electrical signals of different frequencies and transmitted to the controller. The controller then processes and determines the location of the fire alarm, providing early fire warning functionality.
Figure 4 Signal processing circuit
The CO sensor uses an MGS1100, connected to pin AN03, for ambient CO concentration alarm, and a signal is set to trigger the alarm upon reaching a certain threshold. Due to the inherent characteristics of the component, its resistance will drift significantly with changes in ambient temperature, causing zero-point drift in the measurement circuit output. Excessive drift can lead to insensitivity or oversensitivity in the measurement, reducing the overall reliability of the device. Therefore, based on the component's characteristic curve, we added a compensation circuit for temperature compensation. Here, RT is the thermistor, and RS is the sensor resistance.
Figure 5 Basic Measurement Circuit Diagram
Figure 6 Temperature compensation circuit
The temperature sensor selected is the DS18B20, which obtains the digital signal of the sensor's detected temperature through the PB4 port. The DS18B20's characteristics include: 1) Single-wire interface: Only one I/O line is needed to connect to the MCU, requiring no external components; power is provided by the bus. 2) Temperature measurement range: 55℃~125℃, accuracy: 0.5℃, nine-bit temperature reading, A/D conversion time: 200ms, user-defined temperature alarm upper and lower limits, and non-volatile values. The DS18B20's temperature measurement principle: An internal counter counts pulses from a temperature-sensitive oscillator. At low temperatures, the oscillator's pulses can pass through the gate circuit, while at a certain set high temperature, the oscillator's pulses cannot pass through the gate circuit. The counter is set to the value at -55℃. If the gate circuit is not closed before the counter reaches 0, the temperature register value will increase, indicating that the current temperature is higher than -55℃. Simultaneously, the counter resets to the current temperature value, the circuit compensates for the oscillator's temperature coefficient, and the counter restarts counting until it returns to zero.
Figure 6 DS18B20 interface circuit
4 System Software Design
4.1 SMS mobile text messaging service and AT commands
SMS messages typically operate in two modes: Text mode and PDU mode. Both Text and PDU modes use AT commands to send segmented messages. While Text mode is simpler to operate, it cannot send or receive Chinese characters. PDU mode, on the other hand, can send English letters, symbols, Chinese characters, and other character sets. Furthermore, PDU mode can directly manipulate Protocol User Unit (PMU) data and is the default mode for most mobile phones. To ensure broad system applicability, this paper adopts PDU mode for sending and receiving SMS messages. PDU mode can be structurally divided into a header and a body. The header includes information such as the message center number, message type, called address, and character set selection. PDU mode supports different encoding formats, facilitating easy data collection for large-scale applications: 7-bit, 8-bit, and UCS2 encoding. 7-bit encoding is used to send ordinary ASCII characters; 8-bit encoding is used to send data information; and UCS2 encoding is used to send Unicode characters.
AT commands refer to a set of commands used by GSM modules and external MCUs to communicate with each other via a serial port protocol. The MCU can directly send AT commands to the GSM module through the serial interface to perform functions such as dialing, SMS messaging, setting various parameters and functions, and implementing command control and data transmission. The GSM AT commands related to SMS messaging are as follows:
AT+CMGC: Command to send a short message
AT+CMGD: Delete SMS messages from SIM card memory
AT+CMGF: Select SMS message format: 0 - PDU; 1 - Text
AT+CMGR: Read SMS messages
AT+CMGS: Send SMS
AT+CMGW: Writes short messages to be sent into the SIM memory.
AT+CMSS: Send SMS messages from SIM memory
AT+CSCA: Set the SMS service center address
AT+CNMI: Display newly received SMS messages
4.2 Software Flow Design
After the control device is powered on, it first initializes the system, including the serial port, the GSM (T35) module, and the Bluetooth module. Then, the main MCU checks if the GSM module has received a new SMS message. When a new message arrives, the system transmits the message content to the main MCU via AT commands. After confirming that the received message is a control command, the main MCU converts it into a control signal and sends it out via the Bluetooth master module. The corresponding Bluetooth slave module receives the signal and transmits it to the slave MCU to control the corresponding circuit or lighting equipment. After the operation is complete, the system returns the operation information to the user via the GSM module. The software flowchart for remote control is as follows.
Remote alarms are implemented via an interrupt service routine. After the system powers on, the MCU continuously monitors the I/O ports connected to the sensors. When the interior temperature is too high or too low, or the CO content is too high, the corresponding sensor transmits the sampled signal to the I/O port. Upon receiving this signal, the software initiates an interrupt response and enters the interrupt service routine for relevant processing, while simultaneously sending an alarm message to the designated mobile phone.
5. Conclusion
SMS, as a value-added service of GSM, has developed rapidly with the continuous expansion of GSM network coverage. It features high transmission speed, low cost, and does not occupy voice communication channels, thus finding widespread application in remote intelligent control systems. This article introduces an intelligent in-vehicle environment detection system, using the MC9S12DG128 as its control core. Through the GSM network, it utilizes the SMS function of a mobile phone to achieve intelligent control and remote alarm of the in-vehicle environment. This system achieves two-way wireless communication between the source and destination, has a wide range of applications, and possesses broad market prospects.
References:
[1] Song Shaojian, Fang Peng, Huang Rudie, et al. A Smart Furniture Remote Monitoring System Based on SMS [J], Automation Technology and Application
[2] Luo Haibing. Research on Intelligent Furniture System Based on GSM Short Message Service [D]. Changchun: Changchun University of Technology
[3] Wang Wentao, Li Jie, Li He, et al. Design of a security system for furniture based on GSM [J], China Science and Technology Expo