0. Introduction
In recent years, with the rapid development of network communication technology, electronic technology, and computer technology, people have put forward higher requirements for the quality of life, and the modern home environment has also attracted people's attention. At present, the domestic smart home system mainly focuses on the control of the decentralized subsystems of a single residence. These subsystems are relatively simple in function, and it is difficult to achieve information sharing and inconvenient for centralized management. In view of the limitations of the current domestic smart home system, this paper proposes a smart home system based on GPRS wireless technology, which can not only monitor the security status of multiple residences in the community in real time, but also realize the remote copy of the "three meters" (i.e. water meter, electricity meter, and gas meter).
1. Introduction to GPRS Technology
GPRS (General Packet Radio Service) is a wireless packet switching technology based on the GSM system, which provides users with mobile packet IP or X.25 connections. Compared with GSM circuit switching data, GPRS has very obvious advantages in carrying and supporting data services: resource sharing, high frequency band utilization, and users occupy system resources only when transmitting data; high data transmission rate, GPRS uses packet switching technology, each user can occupy multiple wireless channels at the same time, and the same wireless channel can be shared by multiple users. In theory, the maximum transmission rate of GPRS can reach 171.2kbit/s; it supports X.25 protocol and IP protocol, and can be interconnected with existing data networks; users are always online and charged according to traffic and time, and the communication cost is low. It can be seen that applying GPRS technology to data transmission in smart home systems is the most ideal choice.
2. System function and overall structure design
2.1 Functions implemented by the system
The system is mainly designed for home users in ordinary residential areas. It can centrally monitor and manage the security status of users' homes in the community, and also realize access control and meter reading functions. Users can set the monitoring status and monitoring parameters according to their needs. The system realizes the following functions:
(1) Home security monitoring: When a thief breaks into a house or a fire, gas leak or other emergency occurs, the monitoring terminal can detect the danger in real time and send an alarm message to the monitoring center, which then notifies the homeowner via GSM text message.
(2) Remote real-time monitoring and inquiry of home safety status: When the owner is away from home, he can inquire about the safety status of his home by sending text messages.
(3) On-site image capture function: In the armed state, when the infrared sensor or door magnet triggers an alarm, the system will start the image capture device to take pictures of the scene. The captured images are sent to the host of the monitoring center via the GPRS network for backup. Users can also start the image capture function by sending a text message.
(4) "Three meters" remote automatic copy and access control function: It can read the water meter, electricity meter, and gas meter of the user's home at a scheduled or active time, and calculate the fee based on the corresponding price. When there is a card swiping event to open the door, entry is allowed if the card is judged to be legitimate.
2.2 System overall structure
The smart home system consists of three parts: monitoring terminal, GSM SMS transceiver module, and monitoring host. The monitoring terminal hardware uses the ARM7 platform, and the software uses the embedded real-time operating system VxWorks. The monitoring host is a PC running monitoring management software, generally placed in the property management center of the community. Figure 1 is the entire system architecture diagram.
Figure 1 System architecture
When the system is working, the monitoring terminal cyclically detects the door magnet, infrared, smoke, gas monitoring and other sensors installed indoors. When an abnormal situation is detected, the terminal controls the siren to sound an alarm to remind the owner and property management personnel that there is a dangerous situation and take preventive measures. In addition, the monitoring terminal also sends alarm information to the monitoring center through the GPRS network. When the terminal detects a door magnet or infrared alarm, it will start the image capture device to take continuous photos of the user's indoor scene. The terminal will cache the captured images first, and then send them to the monitoring host through the GPRS network. The monitoring host will back up the images in the form of files.
The monitoring terminal also cyclically receives the data request commands sent by the monitoring host, and the terminal parses these commands. If the state of the sensor and door magnet is to be queried, the monitoring terminal detects the state of the corresponding sensor and returns the state information of the sensor to the monitoring host; if the command is to query the usage of the water meter, electricity meter or gas meter, the monitoring terminal constructs a query frame command according to the RS-485 protocol of the "three meters", sends the corresponding query command, packages the data returned by the "three meters" according to the communication protocol of the system, and sends it to the monitoring host through the built-in GPRS module on the terminal. After the monitoring host receives the data sent by the terminal, it first parses the data frame. If it is an alarm message, the monitoring host will play the corresponding alarm prompt tone according to different alarms to remind the administrator to take action. When an alarm occurs, the monitoring host outputs AT instructions through the RS232 interface to control the external GMS module to send an alarm SMS to the mobile phone number of the residential owner pre-set by the system to notify the owner that an alarm has occurred at home. At the same time, the monitoring host will also record the alarm event in the form of a log so that the alarm information can be queried later; when the received data frame is the data returned by the meter reading command, the host will write the data into the system database. At the same time, a new window will pop up on the display interface, showing the household owner information, query time, meter usage, corresponding fees and other information.
3. System hardware design
The schematic diagram of the monitoring terminal is shown in Figure 2.
Figure 2 Terminal schematic diagram
The terminal hardware adopts an embedded hardware platform. The CPU uses Samsung's S3C440X microprocessor based on the ARM7TDMI core. This processor is a cost-effective and high-performance solution provided by Samsung for PDA and general application development. After comprehensive consideration of performance and cost, the GPRS module uses BenQ's M22 module. This module can operate at three frequencies: 900/1800/1900MHz. It supports voice communication and has three data modes: GPRS, USSD and CSD, as well as SMS and FAX functions; it has an embedded TCP/IP protocol, and the software supports standard AT commands and complies with 3GPP 27.07/27.05 specifications.
The D port of the IO port of S3C44B0 has three extended buttons, which are the arming button, the door opening button, and the alarm cancellation button. When the arming button is pressed, the CPU detects that the IO port is at a low level, and the system enters the monitoring state. In this state, the system will detect the door magnet and all installed sensors. Since the output level of the selected sensor is 0V or 12V, and the peripheral interface level of S3C44B0 is 0V~3.3V, the output of the sensor needs to be connected to the IO pin of the CPU after being isolated by an optical coupler. Optical coupler isolation has another function: in thunderstorm weather, lightning is easily introduced into the sensor output wire, and there will be instantaneous high-voltage pulses on the wire. After the output of the sensor is isolated from the IO port of the CPU by an optical coupler, it plays a role in protecting the CPU. When the door opening button is detected to be pressed, the electric control lock is closed, and the door will open. At this time, it is a legal door opening state and no alarm will be generated. If the door is forcibly opened in the monitoring state, the door magnetic output changes from low level to high level, the CPU detects that the door magnetic sensor outputs high level, generates an alarm, and the CPU controls the GPD3 port to output low level, triggering the alarm bell to generate an alarm sound. When an alarm occurs, the CPU sends AT instructions through UART0 to control the GPRS module, and sends the alarm information to the system monitoring host via the GPRS network, and the monitoring host analyzes and processes the alarm information. The M22 module communicates with the CPU at a baud rate of 115200bps. The interface between them is relatively simple, and only the receiving and sending pins need to be connected. Considering that a large number of event logs need to be saved during the operation of this system, such as the data queried by the "three tables", the alarm event log, and the 50 images captured by the alarm, the system has expanded the large-capacity external memory HY57V641620 (8MB SDRAM) and SST39VF1601 (2MB FLASH). The SDRAM is mainly responsible for program execution and intermediate data storage, while the 2MB FLASH is mainly responsible for source program storage and some historical data that needs to be saved in the event of power failure, such as event logs and image data.
The main function of the image capture device is to capture the scene when a theft occurs. There are many products of this type in the domestic market. We chose the Caiyan HRM600GJ image capture device from Shenzhen Anxin Sunshine Technology Co., Ltd. HRM600GJ has its own Ethernet interface. After receiving the photo command package sent by S3C44B0, HRM600GJ takes continuous photos. The captured images are static JPEG format images with a resolution of 320×240. The images are sent to the ARM processor through the network port for processing. Since the S3C44B0 chip does not have an Ethernet interface, an Ethernet interface chip must be expanded to realize the interconnection between Caiyan and the ARM processor. Here we choose the more common and relatively cost-effective RTL8019AS as the Ethernet interface chip.
SN75LBC184 is an RS485 driver chip. We expand the second serial port (UART1) of S3C44B0 to the RS485 bus interface of the system. This interface is the communication interface between the CPU and the "three meters" and card readers and other devices. The CPU communicates with the "three meters" in master-slave mode. The CPU is defined as the master device and the "three meters" are slave devices. Both the master and slave devices have unique device addresses. During communication, the master device sends a query command to the slave device with the specified address, and the slave device returns the current data to the master device.
4. System software design
4.1 Terminal Software
Traditional single-chip microcomputer programming basically adopts sequential structure, which has low real-time performance and low CPU resource utilization. Here, we use the embedded real-time operating system VxWorks, which is an embedded real-time operating system (RTOS) designed and developed by Wind River in 1983. Terminal software design includes two parts: porting the operating system for the system hardware platform and designing the application on the VxWorks platform. The focus and difficulty of operating system porting is the design of BSP (Board Support Package). VxWorks itself provides BSP for many processors, but does not provide BSP for S3C44B0. When designing the system BSP, we first carefully studied one of the BSP code examples, understood and mastered the structure of BSP, and then designed the BSP of this system based on the BSP template provided by Wind River to users for ARM processors. Due to space limitations, this article will not elaborate on the porting of the operating system.
The application of the monitoring terminal adopts a modular design concept. Since VxWorks supports multi-tasking, we implement each functional module as a task. From the perspective of time, each task is in a state of parallel operation, which greatly improves the speed of the system's response to events and effectively improves the CPU's utilization of resources. The terminal application contains five tasks, namely: message processing task, sensor detection task, GPRS communication task, RS485 bus device communication task, key detection and processing task. Except for the message processing task, the other five tasks have the same priority. In VxWorks, the task priority ranges from 0 to 255, 0 is the highest priority and 255 is the lowest priority. We set the message processing task priority to 90 and the other four tasks priorities to 100. This allows the message processing task to process messages sent by other tasks as quickly as possible, thereby improving the system's response speed to external events. The following is a brief introduction to the functions implemented by each task.
(1) Message processing tasks
This task loops to check its own message queue. When there is a message sent by other tasks, it reads the message, parses the message, determines the event type, and then calls the corresponding event processing function to process it. This system defines a variety of event types, mainly the following events: sensor alarm event, terminal parameter setting event, sensor status request event, card swiping event, water meter data query event, electricity meter data query event, gas meter data query event, and key setting event.
(2) Sensor detection task
During the task execution time slice, the current state of the system is first determined. If the system is in the armed state, the CPU will perform a cyclic detection on all installed sensors in the room. If the system is in the disarmed state, only the smoke and gas sensors will be detected. When the task detects that the output of a sensor reaches the alarm threshold set by the system, a sensor alarm message will be sent to the message queue of the message processing task, and the message will contain the sensor channel number.
(3) GPRS communication tasks
This task completes the initialization of the GPRS module, the establishment of a connection between the terminal and the monitoring center, and the data communication function.
(4) RS485 bus device communication tasks
The task completes the reading of data from the "three tables" and the user card swiping detection function.
(5) Key detection and processing tasks
This task completes the scanning of the three function keys on the terminal. When one of the keys is pressed, the CPU detects the key value and sends a message to the message processing task, which calls the corresponding processing function for processing.
4.3 Monitoring Center Software
The monitoring center software is developed using Borland C++ Builder 6.0. It uses WinSock controls to receive and send data. The center software adopts a modular design concept to implement system parameter settings, operator authority management, user management, alarm event processing, database maintenance, data printing, system help and other functions.
5. Conclusion
This system realizes the centralized monitoring and management of the indoor safety status of multiple users in the residential area, and also realizes the remote wireless copy of the water meter, electricity meter and gas meter in the user's home. The system has achieved relatively satisfactory results in terms of practicality, reliability and cost. At present, the system has completed the final debugging and is about to enter the on-site trial operation. Since the system fully considers different application occasions in hardware design and leaves a large expansion space, it is believed that the system will have a relatively broad application prospect.
Previous article:Design and implementation of fingerprint collection device based on ARM
Next article:Design and implementation of teaching robot control system based on ARM+μc/os Ⅱ
Recommended ReadingLatest update time:2024-11-16 17:33
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- 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
- [RVB2601 Creative Application Development] Create an Any MP3 Player on the Internet
- Raspberry Pi Windows IoT Development (Part 1)
- Can anyone crack it? I have a network speed of tens of G and tens of kilobytes. Even if I climb over the firewall, it won't work.
- [HC32F460 Development Board Review] 03. Implementing SHELL transplantation and control based on UART function
- Detailed explanation of ADC in STM32
- The working principle of the automobile gateway system and the location of the gateway for some models
- MSP430 FRAM Microcontrollers Enable Energy Harvesting
- [RVB2601 Creative Application Development] Experience Sharing 2: Lighting in Multiple Ways, Component Learning
- Desktop robot dog
- CC2640R2: A brief analysis of BLE pairing mechanism and implementation of custom pairing password