For traditional flow detection systems, most of them use electromagnetic sensors, which are easily affected by external magnetic fields and lead to incorrect flow measurement. MSP430 microcontroller, as an ultra-low power 16-bit mixed signal processor, has been increasingly widely used in flow detection. Therefore, this paper focuses on the design of flow detector based on MSP430 microcontroller.
1. Analysis of the working principle of the flow detector based on MSP430 microcontroller
Taking into account the low power consumption and other characteristics of the flow meter, the controller selected is MSP430F149. Specifically, the working principle of this flow meter is as follows: when the liquid passes through the flow meter, the rotating disk inside the detector rotates, so the magnet set on the rotating disk will trigger the sensor and cause it to send out an extremely weak electrical signal. After amplifying and filtering the signal step by step, the signal enters the CPU of the detector through the output, and the CPU counter inputs it. Then the system periodically reads the number of pulses, and calculates the flow rate with the help of corresponding software. After processing, it forms the so-called differential signal, which is transmitted to the display in the form of pulses for display, so that its parameters and flow information can be input/output through the I/O interface of MSP430F149.
2. Design and analysis of flow detector based on MSP430 microcontroller
2.1 Circuit Design
The controller of the flow detector uses the MSP430149 single-chip microcomputer produced by TI. By designing several main functional modules of the flow detector, the specific structure of the system is shown in Figure 1.
1) Temperature detection module, this module mainly includes temperature sensor and differential amplifier. This module transmits the signal to the differential amplifier through the temperature sensor. After amplification, the signal is input into MSP430F149, and the information and data are processed and saved through the A/D conversion port of the microcontroller. The temperature sensor used in this system has a thermal resistor of PT100.
2) Flow detection module, this module includes flow sensor and shaping circuit. When a certain amount of liquid passes through the sensor, the sensor will generate pulses. In this way, the flow rate can be calculated by the number of pulses obtained. The flow sensor used in the system is the WG series Wiegand sensor. Its principle is as follows: the alloy material in the sensor has a magnetic bistable function. When excited by an external magnetic field, its magnetization direction will instantly flip and generate an electrical signal in the detection coil, thereby realizing the conversion between magnetism and electricity.
3) Communication module, this module mainly includes NRF-401 wireless communication circuit and RS485 communication interface. For RS485 interface, the chip used is SN75LBC184 produced by TI, which uses a single power supply VCC, can work normally within the voltage range of 3-5.5V, and can effectively realize the conversion between TTL and 485.
For the wireless serial interface circuit, it uses the NRF401 wireless communication chip and applies FSK modulation and demodulation technology, so the maximum rate during operation can reach 20kb/s. In addition, the transmission power can also be adjusted, and the maximum power during transmission is +10dBm.[page]
4) For the LCD display module, its main function is to display the current liquid flow rate.
2.2 Software Design
2.2.1 Module design
For the flow meter, the execution of some programs in its design process needs to be scheduled by actual time. To realize this mechanism, it is necessary to use TIMER-A and TIMER-B in the MSP430 microcontroller. According to the design of this system, the timer needs to interrupt once per second under the condition of 32768Hz, so the following settings need to be made for TIMER-B:
Define the clock source as ACLK; TBCTL=TBSSEL0+TBCLR
Enable interrupt timer; TBCCTL0=CCIE
Set the timer to 1s; TBCCR0=0X7FFF
The timer works in the up-counting mode;
TBCTL1=MC0
In this way, the interrupt service program of the timer 1s can be realized, and the corresponding timer is designed in this program to perform timing related operations. The system uses thermal resistor PT100. Since the MSP430 microcontroller has an ADC12 module, the collected temperature can be converted through A/D. In order to process the temperature and other analog quantities in real time, the system adopts the serial channel multiple conversion mode. After the conversion is completed, the result will be stored in ADC12MEM.
As for the system software, it includes two parts of software, the upper layer and the lower layer module. After receiving the command from the center, the upper layer can send commands to the lower layer by means of radio frequency wireless communication and perform timing. If there is no data returned from the lower layer, the upper layer will resend the command once the timeout expires. If there is still no data returned for more than 3 times, it will be considered that the lower layer is abnormal and submit an abnormal signal to the center. Since the MSP430 microcontroller has only one serial port, the upper and lower modules require 2 serial ports, and the second serial port needs to be realized with the help of the capture/compare function of timer A.
2.2.2 Wireless Communication Protocol
The communication protocol of the system includes three layers: the first is the physical layer, which is mainly implemented by the NRF401 module; the second is the data link layer, which is mainly responsible for providing wireless data transmission; the third is the application layer. When sending data, the longer data frames transmitted by this layer need to be split, and the packet header and checksum are performed, and then repackaged and sent.
Since NRF401 is extremely sensitive, if there is no data transmission, there will be noise output on its data output pin, and such noise will be received and processed by the MCU serial port. Four bytes of 0×CC plus one byte of 0×F0 can ensure the synchronization of communication between the two parties before the data frame arrives. The system protocol uses a two-byte frame header, that is, two 0×55s. After adding the start and stop bits, the actual data sent in the process will be 0101010101, so it can effectively ensure that the data is confirmed. In addition, since the checksum is after ten bytes of data, the use of 16-bit crc check can ensure the accuracy of the data transmission process. At this time, the receiver will compare the crc and checksum. If they are different, it means that an error occurred in the transmission process. At this time, the receiver will record the error frame number. After all data is sent, the error number can be returned and resending is required.
If all data is received normally, it will be confirmed that it was sent correctly.
3. Conclusion
The MSP430 microcontroller is widely used in flow detection due to its ultra-low power consumption and other characteristics.
Through the design of the flow meter based on the MSP430 microcontroller, the accuracy problem in the traditional flow detection process and the shortened life of the detector due to the influence of liquid have been fundamentally solved. Therefore, it has a very good development prospect in flow detection.
Previous article:Design of portable weather instrument based on MSP430 microcontroller
Next article:Design of serial port communication between MSP430 microcontroller and PC based on VB6.0
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Samsung Suzhou factory announced major layoffs!
- Gaoyun FPGA reports the error "suitable range is from 400MHz to 1200MHz"
- Simple summary of Android Bluetooth pairing communication, app layer implementation of Bluetooth silent pairing, ClsUtils class
- The problem of self-reduction
- Power supply decoupling capacitors
- How to use DFT App for hardware accelerated simulation design
- GD32E23X Standard Library and GD32E230 Standard Library Manual
- CC3200 Kit OURS-SDK-WFB_Explore - by tinnu
- RISC-V IDE MRS Usage Notes (IV): Link-time Optimization
- Xunwei 3399 development board-PCIE 4G module test-compiler