Implementation of Smart Home System Based on ARM and GPRS

Publisher:nu23Latest update time:2011-06-29 Keywords:ARM  GPRS Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Keywords:ARM  GPRS Reference address:Implementation of Smart Home System Based on ARM and GPRS

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

Ampere's next-generation processors will abandon Arm and use customized cores
Last week, Microsoft announced the general availability of Azure virtual machines powered by Ampere Altra processors in 10 Azure regions around the world. This marks another major win for Ampere, which is winning over many vendors in the cloud space, including Google, Cloudflare, Tencent, and Oracle, among others.
[Network Communication]
ARM transplants ssh to realize remote root login and sftp login
Host: ubuntu16.04 64bit Target board: mini2440 Cross-compilation tools: 4.4.3 1. Download the required source code: mkdir -p ~/arm/fs ;mkdir -p ~/arm/source Download zlib-1.2.3: wget -c http://www.zlib.net/fossils/zlib-1.2.3.tar.gz Download openssl-0.9.8d: wget -c http://www.openssl.org/source/openssl-0.9.8d.tar.g
[Microcontroller]
ARM transplants ssh to realize remote root login and sftp login
Car recorder solution based on AT91SAM926
A car driving recorder (car black box) is a digital electronic recording device used in cars. It can store the car's speed, time, mileage, braking and other status information and export the data through USB or serial port. Car recorders play an important role in preventing bad driving behaviors of drivers, analyzin
[Microcontroller]
Car recorder solution based on AT91SAM926
ARM instruction condition codes
When the processor is working in ARM state, almost all instructions are conditionally executed according to the state of the condition code in CPSR and the condition field of the instruction. When the execution condition of the instruction is met, the instruction is executed, otherwise the instruction is ignored. Each
[Microcontroller]
Detailed explanation of ARM9's CPSR register
I'm learning embedded low-level system development recently. When writing startup code, I need to set the SP of each mode and adjust the working mode of the CPU. Some of the code is as follows:   view plain   copy     print ? pre name="code" class="plain" .equ DISABLE_IRQ, 0x80   .equ DISABLE_FIQ, 0x40
[Microcontroller]
Detailed explanation of ARM9's CPSR register
Build jz2440v3 (arm s3c2440) development and gdb debugging environment under win10
I originally planned to develop it entirely under Ubuntu, but my level was limited and I couldn't find a suitable tool to read large codes under Ubuntu, so I had to build a development environment on Windows. 1. Main contents: 1. Build arm (s3c2440) development environment under windows10 Use vmware workstation12 pr
[Microcontroller]
Booting process of ARM-based LPC1768 microcontroller
Basic concepts (CMSIS): Cortex Micro-controller Software Interface Standard, microcontroller software interface standard. 2. CMSIS standard file structure: a) core_cm.c (stdint.h) b) system_.c (core_cm, system_) c) startup_.s Among them, core_cm.c and core_cm are the kernel access layer, which defines the periphe
[Microcontroller]
Learn ARM development (2)
It was Sunday, and I was just resting at home. It was a good time to learn ARM. I got up very early in the morning because I was always anxious about how to set up the ARM development environment. I couldn't sleep well. I immediately turned on the computer. In order to speed up, I turned on both computers at hom
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号