Design of distributed energy-saving measurement and control network based on CC1101

Publisher:心满愿望Latest update time:2011-06-16 Keywords:CC1101 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Introduction
CC1101 is a single-chip, low-cost UHF band wireless transceiver produced by TI. It is developed based on the IEEE 802.15.4 standard and its main application area is low-power wireless measurement and control. The chip has functions such as radio wake-up (WOR), packet processing, data buffering, burst data transmission, clear channel assessment, link quality indication, etc. The internal parameter registers and data transmission FIFO can be controlled through the SPI interface. Few peripheral devices are required and it is easy to use. Limited by the transmission power and antenna structure, the line-of-sight transmission distance of CC1101 is generally within the range of 400 to 800 m. Beyond this distance range, the wireless signal must be amplified and forwarded by the relay device. A distributed wireless measurement and control system designed in this paper interconnects the relay devices through a local area network, which greatly reduces the complexity of the system's wireless communication protocol. At the same time, it meets the low-power design requirements associated with the use of wireless communication and has strong practical engineering application value.

1 Overall design scheme
The measurement and control network adopts a three-level structure, and the network topology is shown in Figure 1.

a.JPG b.JPG


The bottom-level measurement and control base station is responsible for data collection and control command execution at the work site. The measurement and control base station is equipped with a wireless transceiver chip CC1101 and an antenna, and communicates with the relay node through an aerial wireless channel. The measurement and control base station is powered by a battery.
The relay node in the middle layer is responsible for receiving control instructions from the central computer and forwarding them to the bottom-level measurement and control base station, or receiving measurement data from the bottom-level measurement and control base station and forwarding them to the central computer. The relay node is equipped with a wireless transceiver chip CC1101 and an antenna, and communicates with the bottom-level measurement and control base station through an aerial wireless channel; at the same time, the relay node also has the function of accessing the local area network, and can communicate with the central computer through an external local area network. The relay node is powered by the DC voltage converted by the AC-DC module from the mains.
The central computer is responsible for collecting the measurement data of all measurement and control base stations, managing the data, and can also issue control instructions to the measurement and control base stations. The central computer is connected to the external local area network through a network interface and communicates with the relay node. The central computer is powered by AC mains.

2 Overall design of communication protocol
The relay node communicates with the central computer through a wired LAN. There are relatively mature solutions in similar protocol engineering, which will not be described in detail in this article.
The wireless link layer protocol between the relay node and the measurement and control base station involves issues such as anti-collision and energy saving, which is directly related to the final realization of system reliability and availability indicators, and is the focus of the system communication protocol design.
The data transmitted through the wireless channel in the system can be summarized into four types, which are briefly described as follows:
① Command frame. It is sent when the relay node transmits a control instruction to the measurement and control base station.
② Base station response frame. When the measurement and control base station receives the control instruction transmitted by the relay node, it needs to return a base station response frame to the relay node to inform the execution of the instruction.
③ Relay response frame. When the measurement and control base station uploads status information to the relay node, the relay node needs to return a relay response frame to the measurement and control base station to inform that the status information has been received.
④ Measurement frame. When the work site data measured by the measurement and control base station changes, a measurement frame must be sent to the relay node to notify the relay node to declare to the central computer to update the record information of the corresponding measurement and control base station.
In order to simplify the processing flow, all data transmitted in the system adopts a fixed-length 12-byte frame format as shown below. [page]

b.JPG


Since CC1101 uses data packets as the minimum processing unit during communication, the packet length of CC1101 can also be set to 12 bytes. With the help of CC1101's processing power, the communication protocol processing below the link layer level can be shielded. The definitions of each data field in the data frame are briefly described as follows: ① Synchronization header. Marks the beginning of a frame of data. CC1101 must start the internal circuit to receive a data packet only after receiving data equal to the internally set synchronization header value. The synchronization header value is different for different data frame types. ② Address. Each measurement and control base station is assigned a unique 2-byte identification address by the system. The measurement and control base station only responds to command frames or relay response frames with addresses equal to the local identification address. ③ Frame type. Used to distinguish which of the four types the data in this frame belongs to. ④ Data. The valid data to be transmitted in this frame can be the command transmitted from the relay node to the measurement and control base station, or the status transmitted from the measurement and control base station to the relay node. ⑤ CRC. Calculate a 2-byte check data for the first 10 bytes of the data frame. When the receiving end finds a CRC check error, the data in this frame will be discarded.





3 Measurement and control base station design
The measurement and control base station is battery-powered and works in an unattended environment. In the design scheme, energy-saving requirements must be considered to the greatest extent, especially the low-power design of the wireless transceiver chip CC1101, which is mainly achieved by carefully designing the wireless communication link protocol between the measurement and control base station and the relay node.
The measurement and control base station uses TI's CC1101 RF transceiver module as the wireless communication interface. The module has integrated CC1101, peripheral RF circuits, antennas and other hardware. It only needs to directly send instructions and data to it through SPI. The module uses a 26 MHz clock, the communication frequency band is 433MHz, the modulation mode is GFSK, and the communication rate is 250 kbps.
3.1 Energy-saving design of receiving protocol
CC1101 has a WOR function, which can make CC1101 automatically switch between the sleep state and the receiving state, as shown in Figure 2, where Time0 is the WOR cycle and Time1 is the receiving time. Since the receiving power consumption current of CC1101 is only 9.8μA in sleep state and 16.5mA in receiving state, from the perspective of energy saving, when using the WOR function, the duty cycle of the working time in sleep state should be as large as possible.

c.JPG


However, when CC1101 is in sleep mode, the wireless receiving circuit does not work, and data transmitted from the wireless channel cannot be received during this time interval, affecting the correctness of communication. Therefore, in order to ensure reliable data reception, it is necessary to ensure that CC1101 can receive at least one complete frame of data during the receiving state within a WOR cycle.
The control command frame length received by the measurement and control base station from the relay node is 12 bytes. When the CC1101 communication rate is 250 kbps, the time required for the transmission of a complete command frame is: 12×8/250=0.384 (ms).
When the receiving state duty cycle of the selected WOR mode is 0.781%, assuming that a receiving time window of 5 complete command frames needs to be reserved in the receiving state to ensure stable and reliable reception of a complete command frame, then the WOR period can be calculated as: 5×0.384/0.781%≈246 (ms).
From the application manual of CC1101, it can be seen that the WOR cycle and the value of the relevant register inside CC1101 have the following relationship:
d.JPG
In formula (1), fosc is the working clock frequency of CC1101, which is 26 MHz, EVENT0 is the event 0 counter value, and WOR_RES is the counter resolution, which can generally be set to 0. In this way, it can be calculated that when the WOR cycle is 246 ms, the EVENT0 value is 0x2150.
When the receiving duty cycle of the WOR mode is 0.781%, the total power consumption current of CC1101 can be calculated based on the power consumption current of the receiving state and the sleep state respectively: 9.8×10-3×99.219%+16.5×0.781%=0.13(mA).
If the measurement and control base station is powered by two ordinary No. 5 dry batteries with a capacity of 2000 mAh, it can be calculated that the continuous working time of the equipment when only CC1101 is working is: 2×2000/0.13≈30 770 (hours)=3.5 (years).
3.2 Receiving protocol processing flow
When CC1101 receives data, the synchronization header content is set to 0xEB90, which can ensure that it only responds to data frames with a synchronization header of 0xEB90. Other types of data frames will not mistakenly trigger CC1101, simplifying the protocol processing flow of the measurement and control base station software.
When it is necessary to receive a command frame, the measurement and control base station workflow is shown in Figure 3. The measurement and control base station is in the waiting receiving state by default, and CC1101 works in WOR mode at this time; after receiving a complete command frame, CC1101 exits the WOR working mode and enters the sending working mode. At the same time, the measurement and control base station control software must determine whether the command frame is sent to this device through the frame address field. If the command frame is sent to this device, it is necessary to execute the command and return a response to the relay node, and then set CC1101 to re-enter the WOR working mode. If the command frame is not sent to this device, just set CC1101 to enter the WOR working mode.

e.JPG


It should be noted that since the wireless channel is susceptible to interference, the measurement and control base station must send a response frame back to the relay node after receiving the command frame from the relay node to confirm the execution of the command frame. In order to prevent the response frame from causing false triggering of other measurement and control base stations, the response frame synchronization header is different from the command frame synchronization header, which is 0x146F. [page]

3.3 Sending protocol processing flow
When the measurement and control base station needs to feedback the execution of control commands or actively upload measurement data, it must send data outward through CC1101 . In order to reduce the occupation of the wireless channel by the measurement and control base station, the measurement and control base station will actively send a data frame to the relay node to notify the device of the state change only when the device status changes, and the relay node needs to register the change with the central computer. In order to prevent conflicts when multiple measurement and control base stations share the wireless channel at the same time, the sending protocol must be designed to prevent conflicts, which is achieved through the carrier sense function of CC1101. Before each data needs to be sent, CC1101 detects the carrier power level value in the wireless channel and reflects the level value in the RSSI register. When the measurement and control base station finds that the RSSI level is higher than a certain threshold, it believes that the wireless channel is occupied and will wait until the RSSI value is lower than the threshold before using the wireless channel to send data.

f.JPG


Using the carrier sense function, the process flow when the measurement and control base station uploads measurement data to the relay node is shown in Figure 4. Since the time required to upload measurement data accounts for a small proportion of the total working time, CC1101 does not need to work in WOR mode to save power. To prevent the measurement frame from triggering other measurement and control base stations in the receiving command state, the measurement frame synchronization header is set to 0x1ACF.

4 Relay Node Design
The relay node uses Microchip's PIC18FF66J60 microcontroller to process the LAN protocol and forward the upper center computer protocol, and uses CC1101 to communicate with the lower measurement and control base station.
The PIC18F66J60 chip has an embedded Ethernet controller module and is a complete Ethernet connection solution. To fully realize the functions of the media access control and physical layer transceiver modules, only two pulse transformers and some passive components are needed to directly connect the microcontroller to the Ethernet. The TCP/IP protocol stack has been embedded in the microcontroller. After power-on, the protocol stack runs automatically, and the microcontroller software only needs to call the corresponding TCP/IP processing function.
The hardware circuit of the relay node is shown in Figure 5. At the end of communication with the LAN, the four Ethernet-specific pins TPOUT+, TPOUT-, TPIN+, and TPIN- of the PIC18F66J60 microcontroller are directly connected to the network transformer; at the end of communication with the wireless channel, the microcontroller is directly connected to CC1101 through the SPI pin.

g.JPG


The relay node uses 220 V mains power after AC-DC conversion. There is no requirement for energy saving. CC1101 does not need to use WOR working mode and is in a normally open state to maximize the availability of the communication link. In the default state, the relay node is in a passive position during the communication with the measurement and control base station, and is ready to receive the measurement data frame uploaded by the measurement and control base station at any time. [page]

The working process of the relay node is shown in Figure 6. It continuously monitors the status of the wireless base stations in the area, and only forwards data to the central computer when it finds that the measurement data of the measurement and control base station has changed; at the same time, it responds to the control instructions sent by the central computer and forwards them to the wireless base stations in the area.

h.JPG


The software processing steps for the relay node to communicate with the central computer using the PIC18F66J60 single-chip computer TCP/IP protocol stack are briefly described as follows.
① The PIC18F66J60 single-chip computer broadcasts an address resolution (ARP) packet to the local area network according to the central computer IP address. The central computer works in TCPSERVER mode, responds to the ARP resolution request sent by the relay node, and sends the MAC address back to the relay node. The relevant function call is: voidARPResolve(IP ADDR*IPAddr), which sends an address resolution packet. IPAddr is the IP address of the module. BOOL ARPIsResolved(IP_ADDR*IPAddr, MAC ADDR*MACAddr); IPAddr and MACAddr are the IP address and MAC address of the central computer.
② Establish a connection between the relay node and the central computer, and check whether the connection is established or disconnected. The relevant function call is: TCP_SOCKETTCPConnect(NODE_INFO*remote, TCP_PORT port), which establishes a connection. BOOL TCPIsConnected(TCP_SOCKEThTCP), check whether the connection is established. void TCPDisconnect(TCP_SOCKET hTCP), disconnect.
③PIC18F66J60 MCU checks whether there is data received in the network port buffer. If there is data, combine the data into a command frame. The function call is: BOOL TCPIsGetReady(TCP SOCKET socket), detect whether the network port has received data. BOOL TCPGet(TCP_SOCKET, socket, BYTE*byte), read a byte of data from the network port buffer.
④When the PIC18F66J60 MCU needs to send data to the central computer, check whether the network port is ready to send data. If it is ready, write data directly to the network port buffer. The function call is: BOOL TCPIsPutReady(TCP SOCKET socket), check whether the network port is ready to send data. BOOL TCPPut(TCP_SOCKET hTCP, BYTEbyte), write a byte of injection molding machine parameters to the buffer. voidTCPFIush(TCP SOCKET hTCP), sends out all the data in the network port buffer.

5. Central computer design
The central computer consists of application software and database, and is responsible for managing the measurement and control information management of the entire measurement and control network system. The data center has the following functions:
① Modification of network topology, which can add or delete relay nodes or measurement and control base stations in the network;
② Communicate with relay nodes or measurement and control base stations, query the operating status, issue action instructions, and complete operation and maintenance management;
③ Communicate with relay nodes or measurement and control base stations, read the measurement data of measurement and control base stations, and manage measurement information;
④ Various statistics and inquiries;
⑤ Data maintenance.

Conclusion
The distributed measurement and control network system developed according to the above design scheme has been successfully applied in the intelligent building project. The measurement and control network system uses the network interface widely available in the building, sets up a central main control computer in the main control room, and sets up a relay node on each floor. They are interconnected through network cables, without the need for rewiring, which greatly saves engineering costs. In addition, a measurement and control base station is installed in each room on each floor. The measurement and control base station on each floor only communicates with the relay node on the same floor, realizing the intelligent management of each room. The communication rate between the measurement and control terminal and the relay node is 250 kbps, and the transmission bandwidth meets the communication requirements of most daily measurement and control information; the measurement and control terminal is powered by 2 ordinary No. 5 dry batteries, which is enough for one year of use and has extremely low maintenance costs.
With a slight modification to the technical scheme of the measurement and control network system, such as using GPRS wireless communication between the relay node and the central computer, the measurement and control network system can be applied to unmanned field measurement and control systems, or electricity billing and management systems. The wireless measurement and control network system has the advantages of low construction cost, easy maintenance, and high communication performance, and has good application prospects in the field of distributed measurement and control.

Keywords:CC1101 Reference address:Design of distributed energy-saving measurement and control network based on CC1101

Previous article:Practical Testing Methods for Wireless Microphones
Next article:Design of ARM7 Acceleration Data Acquisition System

Recommended ReadingLatest update time:2024-11-16 22:20

Wireless transceiver program based on CC1101 and STC89C52 (transmitter program)
It seems that there are not many friends who use CC1101, so I will also post the CC1101 transceiver program here! This will save everyone a lot of time to debug. Without further ado, I will directly post the program: #include reg52.h #include intrins.h #define IOCFG2     0x00 #define IOCFG1    0x01 #define IOC
[Microcontroller]
Wireless transceiver program (receiver program) based on CC1101 and STC89C52
CC1101 and STC89C52 wireless communication receiving program: #include reg52.h #include intrins.h #define IOCFG2     0x00 #define IOCFG1    0x01 #define IOCFG0    0x02 #define FIFOTHR    0x03 // rx and tx FIFO thresholds #define SYNC1    0x04 // Sync word, high byte #define SYNC0    0x05 // Sync word, low b
[Microcontroller]
Latest Test Measurement Articles
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号