Design of wireless environment detection system based on MSP430F5438 microcontroller

Publisher:科技火箭Latest update time:2011-08-22 Keywords:MSP430F5438 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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:

[page]

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.

e3355 switch state amplifier

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.

Data frame format

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.

Transmitter circuit

Figure 4 Transmitter circuit

Receiving 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.

Terminal software process

Figure 6 Terminal software flow

Node software process

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.

Keywords:MSP430F5438 Reference address:Design of wireless environment detection system based on MSP430F5438 microcontroller

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

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号