Abstract: This paper introduces the design scheme and implementation method of an ultra-low power wireless digital transmission module with PIC16F73 single-chip chip and CC1000 modem chip as the core, and gives the application of this module in wireless smart IC card water meter. The module has a communication rate of up to 38.4kbps and an average operating current of 10μA in the query mode. Compared with similar designs, the module has the advantages of low power consumption, convenient use, and reliable communication.
In industrial, scientific research and medical equipment, there are a large number of devices that need to communicate at present. These devices have a short communication distance, a small amount of data, and are not suitable for wiring. For example, automatic meter reading system, hotel a la carte system, and on-site data collection system, etc., many of which are mobile, and what kind of small requirements are easy to carry. Therefore, its passing equipment is required to have the characteristics of small size, low power consumption, low cost, and convenient use. Based on these requirements, this article gives a device and implementation method of ultra-low power wireless digital transmission module.
The module uses Chipcon's ultra-low power FSK modem chip CC1000 and Microchip's low-power single-chip PIC16F73, thus ensuring the system's ultra-low power consumption. At the same time, in order to adapt to the application of battery-powered systems, the module supports wireless communication in the query mode, which can make the average operating current of the system as low as 10μA. The module has 8 groups of channels, can achieve point-to-point, point-to-multipoint half-duplex communication, and provides a standard serial data interface, supports TTL, RS232 and RS485 communication interfaces, can be easily connected with other controllers or computers.
figure 1
1 Module hardware design
The block diagram of the module structure is shown in Figure 1.
As the bottom communication device working in the physical layer and the data link layer, the system completes the functions of data modulation and demodulation, false data filtering, data combination, decoded data frame, and data verification. In the receiving process, the data is converted from electrical signals to bit streams, from bit stream data to bytes, and from bytes to data frames. In the sending process, the received reverse process is completed. The data flow changes during data transmission are shown in Figure 2.
The modulation and demodulation is done by CC1000. The system uses frequency shift keying modulation (FSK), the carrier frequency is 434MHz, the bandwidth is 64kHz, the data is sent using differential Manchester encoding, the data rate for air transmission can be set according to need, and the maximum FSK data rate is 76.8kpbs. CC1000 uses a three-wire command interface and a two-wire data interface, programmable configuration of carrier frequency and data rate. For details of CC1000, see the reference.
The module controller receives data and commands from the user interface when sending, converts the user data into data frames and transmits them to the CC1000, and controls the CC1000 to send data. During reception, the controller receives the data transmitted from the CC1000, analyzes the data, filters the noise, converts the data from the bit stream to bytes, verifies and transmits the user data to the user through the serial port, so that the user can realize all Send what you receive.
The module is designed for low-power systems. In addition to having a SLP pin that can directly sleep the module, there are some specially designed commands to support communication using query mode. The PCMD, RX, TX three-wire constitutes the three-wire interface of the module, and the PCMD must be high when configuring commands. The working sequence of configuration commands is shown in Figure 3.
When sending data, PCMD should be set to low level, and the data can be sent through the serial port. The module uses time intervals to distinguish data frames. If there is no data received within half a byte of transmission, it is regarded as a frame of data received before. The system will encode the frame data and modulate and send it through CC1000. Therefore, if the user data is sent in the format of a data frame, the user should send the data continuously to avoid the module dividing one frame of data into two frames of data for transmission, thereby reducing the transmission efficiency. The module can only perform half-duplex communication. When there is no data transmission, the module is in the receiving state; when there is a sleep signal, the module enters the sleep state. At this time, the module cannot receive and send data. Only after waking up the module, can the data be sent and received. The READY signal is a signal indicating the working status of the module. When READY is in the low level state for a long time, you can use RST to reset the module and reset the working state of the module to avoid the module from being in the wrong working state.
2 Software design
The system software is optimized specifically for PIC single-chip microcomputers, which can produce high-quality and efficient codes for PIC series single-chip microcomputers. The software design of the system controller is the core content of the system. Since the controller has to complete the communication and data encapsulation with both the user and the CC1000, the system software borrows the message loop mechanism design of the Windows system and adopts the message loop architecture. This structure makes the program structure clear, extensible, and portable. After a long period of junior high school, this structure is proved to be very suitable for the development of single-chip system software.
Figure 4 is a block diagram of the program initialization and main function part. The system program bus structure uses a message-driven mechanism. After the initialization of the internal registers and variables of the system, you can enter the message loop program to query the system messages. System messages are generally events that are external or internal to the CPU to stimulate the CPU to run through the CPU interrupt system. In order to enable the system to generate and respond to messages, the CPU's interrupt system must be started, so the CPU timed interrupt, serial communication interrupt, and external trigger interrupt are started before entering the message loop. The program initialization part is executed only once after the CPU is powered on or reset. When the CPU is working normally, it will eventually repeatedly check whether the message exists in the message loop, and do different operations according to the type of message, and finally clear the corresponding message flag, and then Perform a loop detection message. There are three kinds of messages in this system, which are program beat control signal, communication signal with CC1000 and communication signal with user. The program beat control signal controls the running process of the program, including time signal, external interrupt signal (sleep, wake up) and other timing action signals; the signals communicated with CC1000 include CC1000 state transition signal, reception completion signal, transmission start signal and transmission completion signal Etc., responsible for managing the communication and control work with CC1000; signals for communicating with users include receiving user data completion signal, user data sending completion signal, and sending data start signal to users, etc., responsible for communication management with users. The message loop structure of the program is shown in Figure 5.
3 Module performance
3.1 Module function
As a wireless digital transmission module specially designed for low-power systems, this module has the characteristics of low-level power supply and low power consumption. The power supply voltage ranges from 3V to 12V. When the power supply voltage is 3V, in the receiving state, the module current is 9.6mA; in the sending state, the module current is 25.6mA; in the sleep state, the module current is 2μA. When the communication system works in the query mode, the calculation formula of the working current being received is as follows, that is, if the sleep time is dsl and the detection signal time is tdt, then the average working current is (unit: μA
):
Ip = (tsl & TImes; 2 + tdt & TImes; 9600) / (tsl + tdt)
Therefore, if the sleep time of a system is 8s, the detection time is 13μA. In this way, the lithium current of 5400mAh can be used for 47 years! Of course, in actual use, the current when the module is in the receiving state should be calculated. At this time, the power consumption of the module depends on the working condition of the module and the amount of data transmitted. important.
3.2 Communication reliability
The communication error rate can be calculated using the following approximate formula:
Pe≈Ne / N
In the formula, N is the transmitted binary symbol bus; Ne is the number of symbols that are transmitted wrong, in theory, there should be N → ∞.
In actual use, when N is large enough, Pe can be approximated to the bit error rate. After testing the module, when the data rate is 2400 bps and the communication distance is 100 m (plain conditions), the communication error rate is 10-3 to 10-5. As the data rate increases, the communication error rate will increase, but the communication module can use multiple techniques to improve communication reliability. At the physical layer, the module uses differential Manchester encoding technology to send data to ensure synchronization problems in the communication; at the data link layer, CRC (Cyclic Redundancy Coding) is used for data frame check to ensure that the data reaches the user application layer Future reliability. Of course, users can also adopt multiple communication protocols at the application layer to further improve the reliability of communication.
3.3 Communication distance
In wireless communication, the communication distance is directly related to the strength of the signal sent by the transmitter and the receiving sensitivity of the receiver. The transmission power of this module is 10dBm, and under the conditions of data rate of 2400bps, bandwidth of 64kHz, and communication binary error rate of 10-3, the receiving sensitivity of the module is -110dBm. Under the visual condition that the antenna is 3m above the ground, the communication distance (bit error rate is less than 10-3) is greater than 300m. In the urban environment, the reliable communication distance is about 10m.
Figure 5
4 Module application
The wireless intelligent IC card water meter is composed of the upper computer responsible for displaying and reading and writing the IC card and the lower computer responsible for valve control. The communication between the upper computer and the lower computer is completed using a wireless digital transmission module, and the system structure is shown in FIG. 6. The upper computer is responsible for the man-machine interface, including displaying the status of the lower computer, displaying the remaining water volume, reading the IC card, and communicating with the lower computer. The lower computer completes the water pulse counting and receives the instructions of the upper computer to control the valve switching status. Since this system uses battery power, the power consumption of the system must be very low. Both the upper computer and the lower computer of the water meter adopt Microchip's low-power single-chip PIC16F73, and the lower computer works in the query state.
The communication method of the wireless smart IC card water meter is as follows: the communication is initiated by the host computer. When communication is required (when the button is pressed or the IC card is inserted), the host computer first sends a synchronization header of 10s, then sends the address, and then waits for the lower computer Answer. The lower computer communicates with the upper computer by means of inquiring, that is, the lower computer wakes up the wireless communication every 9s to detect whether there is synchronization header information, and the detection time is 10ms. If there is no header information, and decrypt and address judgment. If the received local ten is the local address, analyze the command and respond, otherwise go to sleep. Because the time for the upper computer to send the synchronization header is longer than the time for the lower computer to sleep, the reliability of communication is ensured. Although this communication method is slow, it greatly reduces the power consumption of the lower computer and extends the battery life of the lower computer. In this system, due to the small amount of data, communication speed is not a critical issue, and low power consumption is the most important issue of the system.
The low-power wireless digital communication module based on CC1000 has completed the design goal, and has reached the communication requirements of low power consumption and high reliability, and the communication speed can reach 38.4kbps, so it can meet most of the requirements of short-range wireless digital communication. Of course, because the power consumption of the system is relatively low, the transmission power is small, and the communication distance is relatively close. Therefore, when the communication distance is higher, the transmission power can be increased appropriately to increase the propagation distance. At present, this module has been used in wireless smart IC card water meters, and its work is stable.
300 - 1000 Puffs (included)
Shenzhen Zpal Technology Co.,Ltd , https://www.zpalvapes.com