Environmental monitoring refers to determining the environmental quality (or degree of pollution) and its changing trend by measuring the representative values of factors that affect environmental quality. With the continuous advancement of science and technology, especially the continuous development of computer technology and network technology, environmental detection has evolved from classical chemical analysis to a combination of instruments, computers and networks to achieve wireless environmental detection. This paper designs a wireless environmental detection system with the MSP430F5438 microcontroller as the control core. A terminal and two nodes are actually made. The terminal can obtain the ambient temperature and light information of the node from the node, and the node can realize the relay forwarding function. The entire system adopts OOK modulation, and both the transmission and reception use one antenna. When the terminal transmits a signal.
The information to be transmitted is output through the serial port level to control the on/off of the local oscillator to achieve OOK modulation. The subsequent stage uses a Class C power amplifier for transmission. The receiving node amplifies the signal on the antenna, then performs voltage doubling detection, demodulates the data through an adaptive comparator, and finally transmits the environmental information back to the terminal.
1 Overall design
In the design process of the whole system, both the end point and the node need a main control chip for processing. The main chip uses the MSP430F5438 series single-chip microcomputer. In terms of signal modulation, the OOK (On.Off Keying) modulation scheme is adopted. In terms of high-frequency power amplifier, a self-made Class E amplifier with discrete components is used, and the NEC product 2SC3355 is used as the power amplifier tube. Finally, the communication protocol scheme is selected. The design idea is that the detection terminal initiates a step-by-step transmission of information, and all nodes send information in different time slots according to their own numbers, and the relay node searches and judges by itself. Through a series of selections and designs, the structural design of the whole system is shown in Figure 1.
Figure 1 System overall solution block diagram
The system uses MSP430F5438 microcontroller as the main control chip of the terminal and node. Light detection is realized by photoresistors, and the temperature can be obtained by the temperature sensor built into the microcontroller. Serial communication is used for data modulation and reception, and the I/O port is used to control the antenna's transceiver mode.
2 Theoretical analysis and calculation of the system
2.1 Transmitter Circuit Analysis and Design
The local oscillation uses a Pierce oscillator composed of a 10.7 M resonator and 74HC00. At the same time, the gate-level circuit can also increase the driving power of the subsequent amplifier, and the string 121 can also modulate the signal through the NAND gate.
The actual measurement of a 5-turn coil with a diameter of 3.4 um shows that the inductance is 1.553 uH and the Q value is 156 at 10.7 MHz. The loss resistance at 10.7 MHz is:
We get r=0.669, so the equivalent resistance under parallel resonance is:
2.2 Switching state amplifier input and output matching
A high-efficiency switch-state power amplifier is used at the node, and the terminal can also use Class E amplification. Set the output power to 0.1 W. First calculate the output impedance of C3355. Assuming that the output power of C3355 is 0.1 W, according to the optimal load calculation of the power amplifier, our power supply voltage is Vc=3 V, set Vce=0.1V, output power Po=0.1 W, and the optimal output resistance is calculated to be
R=
From the datasheet of C3355, the output of the transistor gets the output capacitance of the collector. So assuming the output capacitance is 15 pF, the impedance can be equivalent to a 42Ω resistor in parallel with a 15 pF capacitor. The inductance of the collector feeding coil is 10 uH and it also serves as the resonant path of the output. At this time, the required resonant capacitance is 22.12 pF, so a (10~22.12) pF capacitor is also required from the collector to the ground. For the convenience of tuning, a 5/35pF adjustable capacitor is used. After this, the transistor output is a pure resistance of 42n, and then it passes through a 42 Ω~16.3 kΩ third-order low-pass filter to achieve impedance transformation and smooth the output waveform (filter out the high-order harmonics of the carrier).
A 100 nF DC blocking capacitor is connected to the output end, which will make the output no longer a pure resistance of 42 Ω. Therefore, after PSPICE simulation and calibration, the final specific parameters are obtained.
Figure 2 E3355 switch state amplifier
2.3 Receiver Demodulation Circuit Analysis
Since this system uses OOK modulation, a highly sensitive voltage doubler detection is used. When the terminal is far away from the node, in order to improve the receiving sensitivity, a two-stage amplification is used so that the signal can be detected normally even at a long distance. Considering the close distance, a limiting circuit is added to the receiving part of the antenna coil. This ensures that a good signal can be received at both close and long distances. However, in fact, since the received signal is still very small when it is very far away, it is necessary to change the reference level of the comparator with the distance. Therefore, an RC integral holding circuit is used to detect the maximum peak value, so that adaptive comparison is achieved, so that the serial port can still correctly identify the signal at a long distance.
In order to realize antenna reuse, a switch circuit is used to switch the transmit and receive modes. This switch circuit uses the microcontroller I/O port to control the conduction and shutdown of the high-speed diode to achieve switching.
2.4 Communication Protocol Analysis and Design
The communication protocol uses the terminal to initiate synchronous transmission. Each node synchronizes its own clock according to the terminal's synchronization information, and then transmits in sequence in the time slot allocated by its own number.
The information is exchanged by frames, each frame consists of 4 bytes, and the structure is shown below. Each transmission or reception is in frames. The lower seven bits of the data represent the temperature from 0 to 100 oC, and the highest bit represents the presence or absence of light, 1 for light and 0 for light.
The entire communication process is shown in the figure below. The terminal continuously initiates synchronous transmission, and each synchronous transmission is divided into two stages: information synchronous transmission and relay synchronous transmission. In the information synchronous transmission stage, the node that receives the terminal synchronization signal sends data in the time slot assigned to it. In the relay synchronization stage, after receiving the information replied to the terminal by the adjacent node, the node that does not receive the terminal synchronization signal sends a relay request in its own time slot in this stage. The destination ID is any one of the monitored nodes. The selected node sends information to the terminal instead of itself in the next information synchronous transmission stage.
Figure 3 Data frame format
In order to overcome the problem of inaccurate timing of each node, a protection interval needs to be added between each frame, which is designed to be the time to send one byte in this protocol.
That is, it takes 5 bytes to send a frame of data. Therefore, the minimum baud rate that meets the requirements can be calculated. According to the worst case calculation, a total of 256×3A "time slots are required, each time slot consists of 5 bytes, and each byte has 10 bits, so the baud rate is greater than:
Here it is set to 9600 bps to leave some margin.
3 Circuit Design and Software Design
3.1 Transmitter Circuit Analysis and Design
In the transmitting circuit (see Figure 4), we use 74HC00, which can work at 3 V. 74HC00 realizes 10.7 MHz carrier generation, signal modulation, and power amplifier drive in one. The rated output power of the power amplifier is 0.1 W.
3.2 Receiving Circuit Design
The receiving circuit is shown in Figure 5. The front end of the receiver uses a limiting circuit, a very small capacitor (22 pF) followed by two diodes in opposite directions to ground. This ensures that when the transmitting and receiving antennas are very close, the received voltage is limited to 0.25 V.
The switch circuit that controls the transmission and reception consists of two 1N4148s connected in reverse series and a 4.7mH inductor connected in series with a 5.6k resistor to the I/O port of the microcontroller.
Figure 4 Transmitter circuit
Figure 5 Receiving circuit
[page]
3.3 Workflow Diagram
The important task of the monitoring terminal software is to send synchronization signals and wait for the data returned by the detection node. And display it on the LCD. The task of the detection node is to collect data regularly, send data when receiving synchronization signals or monitoring other nodes, and provide relay services after receiving relay requests. Figures 6 and 7 are the flow charts of the terminal software and node software.
Figure 6 Terminal software flow
Figure 7 Node software flow
4 Test methods and data
The test conditions are: the terminal is powered by 5 V and the room temperature is 26 qc. The following is a test of the communication distance of the terminal node.
The terminal and the node are placed on the same horizontal plane. While ensuring that the two antennas are aligned, the distance is set to 1 cm and 9 cm respectively. Nodes A and B are placed on both sides of the terminal at a distance of 10 cm. The temperature, light, and encoding preset functions are tested. The test results are shown in Table 1 (both have preset encoding functions, and the detection delay is 3 s).
Table 1 Test records
The following is a relay node forwarding test.
The distance between the terminal and node A is 50 cm, and the two cannot communicate normally. Node B is inserted between the two to test whether the terminal can normally identify the two nodes. Then the two nodes A and B are swapped to test whether they can be recognized normally. The test results are shown in Table 2.
The maximum forwarding distance is tested again. When A is used as a forwarding node, the maximum forwarding distance is 66 cm. When B is used as a forwarding node, the maximum forwarding distance is 80 cm.
The last test is the node power consumption test.
Keep D1+I)2=50 cm. Test the forwarding node test.
It was found from actual measurements that when both nodes act as relays, the maximum current is 3 mA and the average current is 2.4 mA.
5. Test Results Analysis
Temperature and light measurement: Since the temperature sensor is integrated in the chip, the temperature accuracy can be tested with a thermometer. After algorithm compensation, the temperature accuracy is within 2°C in the range of 23-40°C. The maximum communication distance between the terminal and the node is 35 cm. The node realizes the function of r-relay forwarding. The current of the node is very small, within 3 mA.
Previous article:Design and simulation of electronic password lock based on STC89C52
Next article:Design and implementation of online maintenance system for single chip microcomputer system
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
- Those who don't know about RF MEMS, please take a look. This is what the technology is like.
- General Design Considerations for Embedded Systems
- Download the NI white paper "Overcoming the Challenges of Production Test for Complex Devices Under Test" for free and get a chance to win prizes!
- Ten important facts and trends in motor control
- Surge protection for MOSFET DC switches
- #The best content of the "Interview with famous teachers" in the electronic competition#The first issue - Professor Hu Renjie of Southeast University
- BlueNRG-LP uses RNG function in static protocol stack and cannot broadcast
- Power Supply Ripple Measurement Setup (Oscilloscope)
- c8051F060 program download problem
- 1