ZigBee technology is a short-range wireless communication technology based on the IEEE802.15.4 standard protocol. It has the characteristics of low power consumption, low cost, large capacity, high security, and strong anti-interference performance. It is widely used in industrial monitoring, sensor networks, home control, security systems and other fields. How to connect the ZigBee network with Ethernet and WiFi networks to realize real-time monitoring of small areas by portable devices (such as mobile phones, tablets, etc.)? This paper proposes a ZigBee wireless gateway design based on the Android system.
1 System Overview
The purpose of the intelligent monitoring system design is to enable users to remotely control terminal devices or monitor the environment through mobile phones or PCs. The gateway is the core of the system, which is mainly responsible for the management and processing of uplink information of each wireless terminal node, and downlink control of the operation of each wireless terminal node, and has the function of completing protocol conversion between different networks. The design of the gateway in this paper mainly completes the conversion function between ZigBee protocol and TCP/IP protocol, uses WiFi network to connect handheld devices to Ethernet, which is used to control home appliances, lights, etc., and completes the mutual communication between mobile phone and Ethernet information and ZigBee information. The location of the gateway in the intelligent monitoring system is shown in Figure 1.
The gateway design adopts a modular solution, which consists of hardware layer, system layer and application layer, as shown in Figure 2. The hardware layer describes the hardware composition of the gateway; the system layer is the Android operating system transplanted by the gateway with SAM9M10 as the core processor; the application layer includes the gateway application, application protocol layer and application address adaptation layer.
2 System Hardware Design
The system hardware design adopts modular design concept. The main modules include SAM9M10 core processing module, ZigBee module, Ethernet module, LCD module, WiFi module, power module, etc.
The SAM9M10 core processing module includes a 400 MHz microprocessor based on ARM926, supports 133 MHz double data rate DRAM (DDR2), and integrates high-speed (480 Mbps) USB host and device ports, on-chip transceiver, Ethernet MAC, two interfaces for MMC 4.3 and SDIO/SD Card 2.0, as well as CMOS camera, audio interface and LCD controller supporting resistive touch screen. The SAM9M10 core processing module is responsible for ZigBee data transmission and reception, Ethernet data transmission and reception, LCD data output, data storage, etc. The
main chip of the ZigBee module adopts TI's second-generation system-on-chip CC2530. Compared with previous products, CC2530 has more excellent RF performance, programmable 256 KB flash memory, smaller package size and IR generation circuit. The ZigBee module is responsible for network communication with other wireless nodes in the ZigBee network. It uses USART or SPI to communicate with the main controller. This article chooses the SPI method.
The Ethernet module uses the DM9161 chip from DAVICOM. DM9161 is a single-chip fast Ethernet PHY. DM9161 is connected to the MAC layer through a variable voltage MII or RMII standard digital interface. It supports HPAuto-MDIX and is a common physical layer transceiver.
The WiFi module consists of an AP (Access Point) and a wireless network card. Its main features are: fast speed, high reliability, wide coverage in open areas, easy integration with existing wired Ethernet, and lower networking costs.
The touch screen LCD module uses the AT102TN03 module from Taiwan Innolux Corporation. The display size is 10.2 inches, the display ratio is 16:9, the resolution is 800×480, it uses LED backlight, and the operating voltage is 5 V.
The power module is powered by an external 5 V power supply, which is converted to 3.3 V by NS's chip LP38692, 1.0 V by LP2983AIM5-1.0, and 1.8 V by Anisem's chip AS1301EHT-ad. The system hardware structure is shown in Figure 3.
3 System Software Design
The wireless gateway software design is mainly introduced from three aspects: Android operating system transplantation, wireless gateway system protocol model and gateway application program. [page]
3.1 Android porting on SAM9M10
Atmel's SAM9M10ARM9 device based on the 32-bit ARM926 processor provides a complete board support package (BSP) for the SAM9M10-G45-EK board running the Android operating system. Atmel's Android port is based on version 2.1, supports camera interface, hardware video decoding, software decoding, web browsing, and can use Ethernet cable or WiFi SDIO dongle provided by H&D Wireless. Through the BSP of the SAM9M10-G45-EK board, Android can be easily ported to SAM9M10 and booted from Nand Flash.
The porting work mainly consists of two parts: Linux driver and Android system hardware abstraction layer.
The driver in Linux works in kernel space, and the Android system hardware abstraction layer works in user space. With the combination of these two parts, the huge Android system can run on a specific hardware platform. After having a specific hardware system, it is usually necessary to implement its driver in Linux, and these drivers are usually standard Linux drivers. The main implementation is the Hardware Abstract Layer in the Android system. The Hardware Abstract Layer calls the driver in Linux and provides an interface for other parts of the Android system (usually the Android local framework layer) to call. The main work of the transplant is shown in Figure 4.
3.2 Wireless Gateway System Protocol Model
3.2.1 ZigBee Protocol Stack
The ZigBee protocol stack uses TI's ZStack, with the specific version number ZStaek-CC2530-2.5.0. It supports ZigBee 2007 (including ZigBee and ZigBee PRO) protocols. In this gateway software design, the ZigBee PRO protocol is used. ZigBee PRO inherits all the advantages of ZigBee technology and enhances the scalability, ease of use and security of wireless networks. The ZigBee protocol stack architecture is shown in Figure 5.
3.2.2 TCP/IP protocol stack
From the perspective of the protocol layering model, TCP/IP consists of four layers: link layer, network layer, transport layer, and application layer. Each layer calls the network provided by the layer below it to meet its own needs. In fact, the TCP/IP protocol can be connected to any network through the link layer, such as the IEEE S02 local area network. The TCP/IP protocol stack framework is shown in Figure 6.
[page]
3.2.3 Gateway System Protocol Model
An application address adaptation layer and an application protocol layer are added on top of the ZigBee protocol stack and TCP/IP protocol stack of the gateway system layer. The role of the application address adaptation layer is to map the ZigBee address (MAC value or short address), Ethernet address (IP address) and application layer address, that is, to adapt different types of network addresses to the application address, so that the nodes belong to the same network at the application layer; the application protocol layer is based on the application address adaptation layer, by formulating a unified application protocol, standardizing the format of data exchange between nodes, thereby realizing the digital information exchange function between the ZigBee network and the IP network, that is, realizing the function of the ZigBee gateway.
The ZigBee node in the wireless network receives the instruction to package the data, and then sends it to the local ARP after simple encapsulation. The network MAC address of the node is resolved through ARP to determine the Ethernet address to be sent; then it is sent to the gateway application, and after analysis, it is sent to the corresponding Ethernet UDP or TCP for processing, and then sent to the Ethernet port MAC address. In this way, the data conversion process from the ZigBee network to the Ethernet protocol is completed. The gateway system protocol model is shown in Figure 7.
3.3 Gateway Application
Gateway application mainly refers to the information data transmitted based on the specification of the gateway application protocol layer, which is organized and run in the form of Android tasks. In the data communication between Ethernet and ZigBee network, information is sent and received in the form of data packets. The data packet sending process is shown in Figure 8.
In the wireless WiFi network, the PC connected to the wireless AP through Ethernet is the server, and the wireless gateway, as the Android client, establishes a network connection with the PC server through the TCP/IP protocol. Through Socket communication, data forwarding, transmission and reception can be completed on the basis of realizing the network connection between the server and the client.
Therefore, the wireless gateway application should realize the following functions:
① Establish the Socket and network connection between the client (wireless gateway) and the server (PC) to provide the necessary conditions for data exchange between them.
② Read the data received from the ZigBee network by the wireless ZigBee module into the buffer, and then write it into the USB wireless network card. The USB wireless network card will package the data into the WiFi protocol format and send it to the wireless WiFi network.
The implementation process of the Android client application is shown in Figure 9.
4 Implementation of lighting control function
ZigBee divides applications into different domains, each with its own Profile. ZigBee Profile provides standard interfaces and device definitions for this application domain, so that ZigBee devices produced by different manufacturers for the same application field can communicate with each other. The Profile used by ZigBee in smart homes and home automation is the ZigBee Home Automation Public Application Profile. Through the introduction of this Profile and ZCL (ZigBee Cluster Library), the control of ZigBee lighting appliances is realized. For example, the gateway only needs to call the zelGeneral-SenclOnOff_CmdToggle() function to control the on/off of the lights. The hierarchical block diagram of the interface between the application, Profile, ZCL and other layers is shown in Figure 10.
Conclusion
This paper studies the wireless gateway based on Android system and ZigBee technology. The gateway is small in size and low in power consumption. It integrates ZigBee network, Ethernet and WiFi network into one, and builds a bridge between ZigBee short-range wireless communication and Ethernet remote control. It realizes the digital information interaction between wireless sensor network and wireless Internet, which can be widely used in
the Internet .
Previous article:Development of automatic tobacco leaf baking experimental system
Next article:Design of DDS Signal Source in Quartz Crystal Test System
Recommended ReadingLatest update time:2024-11-16 22:27
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Design of voice-controlled robot based on Android program
- Detailed explanation and engineering practice of unmanned monitoring technology (Xie Jianbin, Li Peiqin, Yan Wei, Liu Tong, Lin Chenglong, Hong Quanyi, Zhou Hongfei, Cui Yibing)
- Introduction to Wireless Sensor Networks (Edited by Ma Sasa et al.)
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
- Online ESP32 simulator is awesome! It takes more than ten minutes to help netizens light a lamp
- STLINK power supply has problems
- ANT Visualization
- pwm
- Power supply - Does the P tube of this TL431 voltage regulator circuit need to consider the problem of power supply short circuit to ground when it is turned on?
- Online door lock system consultation
- KEILC51 embedded assembly method
- Micron's New Year's Lucky JD E-Card is waiting for you to draw
- Isolated Buck Converter PCB Layout Tips
- How GaN helps cable providers find the balance