A/D converters are widely used in analog signal conversion for single-chip microcomputer controlled data acquisition. However, for long-distance data transmission and high-precision applications, the use of general A/D converters has many disadvantages. V/F converters can be used instead of A/D converters. The interface between the V/F converter and the single-chip microcomputer only requires one I/O port to input the frequency signal, and the interface is simple and occupies less hardware resources. The data acquisition system with the single-chip microcomputer and V/F converter as the core can measure the pressure detected by the sensor in real time and meet the system measurement accuracy requirements.
2 Basic principle structure of the system
The pressure sensor converts the measured pressure into a voltage signal, and the voltage signal output by the sensor is converted into a corresponding frequency signal through the V/F converter. The frequency signal is transmitted to the single-chip microcomputer using an optocoupler, and the signal frequency is measured using the timer/counter inside the single-chip microcomputer. The pressure value is calculated based on the linear relationship between voltage and frequency using the strong computing function of the single-chip microcomputer. Figure 1 is a system structure diagram.
3 System Hardware Design
3.1 Pressure Sensor MPXV50014G Module
In addition to the sensing unit, the integrated silicon pressure sensor MPXV5004G also contains a signal conditioner, a temperature compensator and a pressure correction circuit, which is particularly suitable for detection systems composed of single-chip machines. The MPXV5004G pressure sensor uses a rated 5 V power supply voltage, a maximum measured pressure difference of 3.92 kPa, a maximum withstand pressure of 16 kPa, and a temperature compensation range of -30℃ to 100℃. When the operating temperature is 10℃~60℃ and the pressure range is 0~4 kPa, the pressure sensor has good linearity, and the output relationship is:
Where: VOUT is the output voltage, VS is the operating voltage, P is the pressure value, and the error is 0.045 V.
When using this sensor, add a decoupling capacitor between the power supply and the ground to filter out the high-frequency signal interference generated by the device itself and contained in the power supply; add a decoupling capacitor between the signal output and the ground to filter out the noise component of the output signal. Figure 2 shows the decoupling capacitor configuration.
In applications, considering the zero drift of the pressure sensor due to temperature changes or device aging, it is necessary to correct the zero point and correct the output value so that the output value can maintain sufficient correctness and accuracy over a long working time.
3.2 V/F converter LM331 module
LM331 is a general-purpose V/F converter with a frequency range of 1 to 100 kHz, a maximum nonlinear error of 0.01%, a maximum temperature drift of 50 ppm/℃, a power supply range of 4 to 40 V, and an input voltage range of -2.0V~VS. When 4.5 V≤VS≤10 V, the power supply voltage has an effect of 0.1%V on the gain; when 10 V≤VS≤40 V, the power supply voltage has an effect of 0.06%V on the gain. The external circuit of LM331's V/F conversion is shown in Figure 3.
In Figure 3, the output frequency fout=KVIN, where K=Rs/(2.09RtCtRL). The typical values Rt=6.8 kΩ, RL=100 kΩ, and Ct=0.01μF are selected. In the system, K=1000, so Rs=14.212 kΩ. In the circuit, Rs is composed of a 12 kΩ fixed resistor and a 5 kΩ adjustable resistor in series, which is used to adjust the gain deviation of LM33l and the deviation caused by RL, Rt, and Ct. CIN is a filter capacitor, which is generally taken in the range of 0.01~0.1μF. In the case of better filtering effect, CIN uses a 1μF capacitor. In order to improve accuracy and stability, the above resistors and capacitors use low temperature coefficient devices, preferably metal film resistors and polystyrene or polypropylene capacitors.
3.3 Interface between V/F converter and microcontroller (photocoupler 6N137)
In the detection or control system with more than two grounding points, in order to suppress the interference caused by the ground potential difference, it is very effective to use isolation technology to cut off the loop current. In principle, isolation technology can be divided into electromagnetic isolation and photoelectric isolation. Photoelectric isolation is to add a photocoupler between two circuits. The linear range of the photocoupler is limited and it is used for digital signal transmission. At the same time, the photocoupler is small in size and fast in conversion speed, so it is widely used in detection or control systems composed of microcomputers. The photocoupler is used to isolate the V/F converter from the microcontroller to enhance the system's anti-interference ability, prevent the microcontroller from freezing or the program running away due to the harsh external environment, and also play an electrical protection role for the microcontroller. Here, TOSHIBA's 6N137 photocoupler is selected. Figure 4 is a typical application circuit of 6N137.
Pin 2 of 6N137 is the signal input terminal. When the input signal is high, the light-emitting diode emits light, and the reverse-biased photosensitive tube is turned on after being illuminated. After current-to-voltage conversion, it is sent to the AND gate. The other input terminal of the AND gate (pin 7) is the enable terminal. When the enable terminal is high, the signal output terminal (pin 6) outputs a low level. When the input signal is low, the output is high. A 0.1μF capacitor with good high-frequency characteristics must be connected between Vcc (pin 8) and ground (pin 5), and it should be placed as close to pin 8 and pin 5 as possible. The forward voltage drop of the light-emitting diode is 1.2~1.7 V, and the forward current is 6.5~15 mA, so a 470Ω current limiting resistor must be added between pin 3 and ground.
3.4 MCU AT89C51 module
This system design requires an interrupt of the MCU. A timer. A counter. Here, AT89C51 is selected, which contains 2 16-bit timers/counters and 5 interrupts. When the internal timer/counter of MCS-51 is selected as the timing mode, the counting input signal is the internal clock pulse, and each machine cycle generates a pulse to increase the counter by 1; one machine cycle is 1/12 of the external clock oscillation frequency, and a 12 MHz crystal oscillator is used, and the machine cycle is 1μs. When the internal timer/counter is selected as the counting mode, the counting pulse comes from the external input pin P3.4 (T0) or P3.5 (T1). When the input signal generates a negative jump from 1 to 0, the counter increases by 1. Since a negative jump takes two machine cycles, when a 12MHz crystal oscillator is selected, in order to ensure that the level is sampled once before the change, the external counting input signal cannot exceed 500 kHz. The maximum count value of the 16-bit timer/counter is 65,535, which meets the design requirements here. The system sets T0 of AT89C51 as a timer and T1 as a counter. When the microcontroller receives an interrupt signal, timing and counting start at the same time, and when timing ends, counting also ends. Then, by using the calculation function of the single-chip computer to divide the count value by the timing value, the frequency of the measured signal can be obtained. Through the linear relationship between frequency and voltage, and voltage and measured pressure, the corresponding pressure value can be obtained.
4 System software design
The system software design is written in Keil C51 language and applies modular design, mainly including measurement function, interrupt subroutine, and control function. The main program flow chart is shown in Figure 5.
Set TO as the timer, the basic timing time is 50 ms, and Tl as the counter. IE=Ox8a, TMOD=Ox51. When the P3.2 port is at a low level, the status flag becomes 0, and the measurement starts. By using the interrupt, every time the timing reaches 500 ms, the counter stops counting and the measurement is completed. The status flag becomes 1, and the count value is read to calculate the frequency, and the pressure is obtained through the frequency. When the P3.2 port is at a high level, the control stage of the sensor monitoring object is entered according to the measured pressure value. The program code of the measurement function and the T0 interrupt subroutine are given below:
5 Conclusion
This measurement system is widely used in automotive electronic control, industrial production monitoring, safety protection, and household appliances. It has a simple structure, high accuracy, and stable performance. It is suitable for those occasions that require accurate measurement accuracy and have a certain anti-interference ability.
Previous article:Application of automotive FPGA in racing car engine control unit
Next article:Application of CPCI single board computer in in-flight entertainment system
Recommended ReadingLatest update time:2024-11-17 04:42
- Popular Resources
- Popular amplifiers
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!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- 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
- Flying probe test to detect the electrical performance of PCB boards
- Correct timing
- How to use the crystal oscillator and capacitor in the TaunchPad G2 kit?
- How to set the PCB wiring to 100 Ω uniform routing?
- Hello everyone, I made a microphone, and I need to use a preamplifier, I use MC2830D, the effect is average
- GD32L233C-START Review——05.SPI Test——Driving TFT Screen
- Keithley SourceMeter - One Test Instrument Compares to Five
- Safety symbols of countries around the world
- Tomorrow's live broadcast: The development and latest applications of sensors in industrial motors. Make an appointment now to get 2 chances to win a prize draw.
- Differential mode, common mode signal, differential amplifier circuit