ZigBee technology has the advantages of low complexity, low power consumption and low cost, and has broad application prospects in the field of monitoring and control. The advantages of ZigBee network are analyzed. The design of wireless serial port based on ZigBee protocol is proposed to further expand the application range of serial port. It has been verified by practice that the design method is reliable, the operation is simple and convenient, the power consumption is small, the cost is low, and multi-machine communication can be realized at the same time, which is suitable for low-rate data transmission and has broad application prospects.
0 Preface
With the popularization of computer applications, communication applications between computers and computers, computers and data terminals are becoming more and more widespread. Because electrical standards are relatively mature and perfect, serial communication is widely used in them. However, in the case where the communication device is relatively far away or the cable cable is inconveniently laid, the implementation of the wireless serial communication will help to expand the application range of the serial port and effectively save resources. The current implementation of wireless serial communication mainly relies on Bluetooth, infrared, WIFI and other technologies, but the promotion of Bluetooth and infrared is limited by distance and power consumption. Infrared is suitable for direct communication of single-to-one, and the distance is limited to 1 ~ 2 m; Bluetooth The distance is only about 10 m, and the construction and use cost of WIFI and Bluetooth systems are much higher than those of Zig2Bee system, and ZigBee has the advantages of low power consumption and high communication distance, which has obvious advantages in the realization of wireless serial port. . The system uses the ZigBee protocol-based RF chip CC2430 module to implement the wireless serial port technology, and utilizes the CC2430's own UART mode, which is backward compatible with the RS 232 protocol, and has strong application and promotion. Utilizing the ZigBee network architecture, the wireless serial port has a large number of devices and a relatively complex topology. When communicating with each other, it is required to pass through obstacles such as walls, and has the advantages of long communication distance, low power consumption, and safety and reliability.
1 ZigBee technology
ZigBee is a short-range, low-rate wireless network technology based on the IEEE802. 15. 4 standard. The wireless connection technology mainly solves the low-cost, low-power, low-complexity, low-transmission, close-range device networking applications, and is mainly used for measurement and control of wireless sensor networks.
The CC2430 chip is a system-on-chip implemented by Chipcon for embedded ZigBee applications. It supports 2. 4G IEEE802. 15. 4/ ZigBee protocol. According to the different capacities of the built-in flash memory of the chip, three versions are provided to the user, namely CC24302F32/64/128, and the on-chip FLASH is 32 KB, 64 KB and 128 KB, respectively. The CC2430 integrates an 8-bit 8051 microcontroller, analog-to-digital converter, timer, watchdog, ASE coprocessor, FLASH controller, DMA controller, reset circuit, serial communication interface, and 21 programmable pins on-chip. Wait.
The CC2430 has two on-chip serial communication interfaces (USART), USART 0 and USART 1. They have the same functionality and have their own pins that can operate in asynchronous UART mode or synchronous SPI mode.
When using the UART mode as an asynchronous serial interface, there are two line configurations to choose from. One is a two-wire configuration consisting of only RXT and TXD; the other is a 4-wire configuration that includes both RT S and CTS than a two-wire configuration.
The UART mode has the following features:
Has 8 or 9 data bits; odd parity, even parity or no parity; configurable start and stop bit levels; configurable low significant bit priority transfer or high significant bit priority transfer; independent acceptance and Transmit interrupt; Independent accept and transmit DMA trigger; Parity and frame check error status; Provide full-duplex asynchronous transfer, bit synchronization in the receiver does not affect the transmit function.
2 system composition
The ZigBee standard is based on the 802. 15. 4 protocol stack. The ZigBee network supports three kinds of topologies: star, cluster tr ee and mesh. It has high reliability and simple networking. Flexible, large network capacity, self-organizing and self-healing capabilities, and reliable communication. As shown in Figure 1, when the number of devices is distributed, the distribution range is wide, and the topology is complex, the wireless serial port installed on the ZigBee network can overcome the shortcomings of common serial communication distance and troubles in wiring, and expand the application range of the serial port.
Figure 1 Wireless serial port application
When transmitting data, the data enters the DATA memory area of ​​the CC2430 through the serial port USART. In order to improve the transmission speed, the data in the memory area is sent to the TXFIFO of the radio frequency module by using the DMA transmission method. After the data enters the radio frequency module, after a series of hardware processing, the wireless signal is finally transmitted through the antenna. Receiving data is the inverse of sending data. The RF module receives the wireless signal from the antenna, converts the signal into data through a series of hardware processing, stores it in the RXFIFO, and then sends it into the DATA memory area through DMA. Finally, the received data is sent out through the USART serial port. The transmission path of the data in the wireless module is shown in Figure 2.
It is not difficult to see that the entire data transfer process is mostly done inside the CC2430. Thanks to the high level of integration, the CC2430 is a system-on-a-chip that provides high system stability and reliability.
Figure 2 Data transmission path in the wireless module
The data frame received by the ZigBee module is used as the load of the network layer and sent to the target node through the ZigBee network. The network layer frame format is as follows:
The first character of the frame indicates the frame type (frame. type): 0x00 is the command frame; 0x01 is the data frame; 0x02 is the acknowledgement frame; 0x03 is the error frame; 0x04~ 0xFF is reserved. The second character indicates the package serial number ( se2quernce number ). The third character indicates the destination address of the data transfer. The fourth character represents the source address of the data. The fifth character indicates the length of the data (datalength). The subsequent is the data payload and the length is datalength. The last character is the check sum, whose value is calculated according to the following formula.
The length of the entire data frame is data length + 6, as the MAC layer load, it must be less than 104 B. After receiving the data frame, the wireless module network layer checks whether the target address of the data frame is the same as the node address. If they are different, the data is sent to the remote node, and the wireless module will forward the data to the target node through the ZigBee network; if they are the same, the checksum is recalculated based on the received data; if the obtained checksum is transmitted The same, the reply frame is returned, and the data is output at the same time; otherwise, the sender is notified that the transmission fails.
3 hardware design
The system as a whole and the software design are introduced. The following provides a design scheme of the system hardware. The wireless module circuit diagram is shown in Figure 3.
Figure 3 wireless module circuit diagram
The circuit system mainly consists of a power supply, a reset circuit, a serial port connection circuit and a wireless transceiver circuit. It can realize wireless transmission and reception of serial data. When transmitting data, the computer converts the standard level of RS 485 to T TL level through MAX485, and then transmits it wirelessly through CC2430. Receiving data, CC2430 receives the data signal first, then converts the TT L level to the standard level of RS 485 via MAX 485, and then inputs the data to the upper computer through RS2485. Due to the low power consumption of the CC2430, two dry cells are used to power the module. In addition, the AH805 boost regulator is used to boost the 3 V voltage to 5 V, so the power supply can supply 3 V or 5 V. Among them, the 3 V voltage supplies power to the CC2430; the 5 V voltage supplies power to the MAX485 and reset circuits. If the system is used for communication between PCs, the RS 232 standard level to RS 485 standard level can be converted by introducing the RS 2322485 converter to be compatible with the PC RS 232 serial port.
4 Experimental results
In the final system test, the system's influence on the data transmission rate and the communication distance on the data transmission error rate and the traditional wired communication are mainly tested and compared. The test results are shown in Table 1.
5 Conclusion
Here, the latest ZigBee technology is used in the CC2430 to realize wireless communication for the RF transceiver. Combining it with the computer serial port can replace the traditional wired serial communication, and demonstrates the ZigBee based on field test and theoretical analysis. Compared with the advantages of traditional wired communication, the wireless communication technology has proposed a new serial communication solution, which has broad practical prospects.
Telecom T Series Lead Acid Battery
Custom Lead Acid Battery,Telecom T Series Lead Acid Battery,2V 300Ah Battery,Valve Regulated Sealed Battery
Wolong Electric Group Zhejiang Dengta Power Source Co.,Ltd , https://www.wldtbattery.com