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.
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]
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.
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:
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.
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.
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.
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.
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.
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
- Popular Resources
- Popular amplifiers
- Investigation of occupancy perception in autonomous driving: An information fusion perspective
- Practical Development of Automotive FlexRay Bus System (Written by Wu Baoxin, Guo Yonghong, Cao Yi, Zhao Dongyang, etc.)
- Deep Learning Computer Vision: Neural Network Architectures Using Python and Keras
- PyTorch Deep Learning
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Seizing the Opportunities in the Chinese Application Market: NI's Challenges and Answers
- Tektronix Launches Breakthrough Power Measurement Tools to Accelerate Innovation as Global Electrification Accelerates
- Not all oscilloscopes are created equal: Why ADCs and low noise floor matter
- Enable TekHSI high-speed interface function to accelerate the remote transmission of waveform data
- How to measure the quality of soft start thyristor
- How to use a multimeter to judge whether a soft starter is good or bad
- What are the advantages and disadvantages of non-contact temperature sensors?
- 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
- Zero Knowledge Open Source Sharing - L298N module uses motor to drive TT motor
- Please help me find out how this formula is calculated, thank you
- Season 1 has passed, are Season 3 and 4 far away?
- Share: Power analyzer directly connected to CAN network
- A collection of fast charging reference designs. See if there is anything you are interested in?
- [RVB2601 Creative Application Development] Yoc creates a task to display the IP address and signal strength
- How does a drone know its position? How accurate is its hovering?
- EEWORLD University Hall -- Animation analysis of the working principles of various motors
- Xunwei-iMX6ULL development board--C program calls shell
- MSP430F5529 Beginner Programming Example - Button Lighting