1. Introduction
A barometer is a device that uses a pressure-sensitive element to directly convert the measured air pressure into a current or voltage signal that is easy to detect and transmit, and then processes it through subsequent circuits and displays it in real time. The core component is the air pressure sensor, which plays an important role in monitoring pressure, controlling pressure changes, and measuring physical parameters. The air pressure sensors used in barometers basically rely on the changes in air pressure at different altitudes to obtain air pressure values.
Meteorological research shows that in the vertical direction, air pressure decreases as altitude increases. For example, in the lower layers, the air pressure decreases by 10 hPa for every 100 m rise; at an altitude of 5 to 6 km, the air pressure decreases by 7 hPa for every 100 m increase in altitude; and when the altitude increases further, that is, after reaching an altitude of 9 to 10 km, the air pressure decreases by 5 hPa for every 100 m increase in altitude; similarly, if there is a downdraft in the air, the air pressure will increase; if there is an updraft in the air, the air pressure acting on the bottom of the air column will decrease. The weight of the air column acting on a unit area is generally called atmospheric pressure.
2 The structure of a barometer
The structure of the barometer studied in this paper is shown in Figure 1. The pressure sensor is used to convert the measured air pressure into a voltage signal; the V/F converter can convert the voltage signal output by the pressure sensor into a pulse signal with a certain frequency; so that the pulse signal can be received by the single-chip microcomputer, and the corresponding air pressure value can be calculated according to the linear relationship between voltage and frequency based on the number of pulses obtained per unit time, and finally displayed by the LED under the control of the single-chip microcomputer.
This barometer can accurately measure the corresponding air pressure value within the linear range of the air pressure sensor. It should be noted that its measured value is the absolute air pressure value. The technical indicators of the barometer studied in this article are as follows:
●Measurement range: 300hPa~1050hPa;
●Measurement accuracy: 0.1% FS (20℃);
●Display accuracy: 0.1%, achieved by 4 8-segment LED displays;
●Working temperature range: 0~85℃;
●Power supply voltage: 9V.
3 System implementation
In the process of system construction, factors such as stability, complexity, cost, and ease of debugging need to be considered. Each part in the block diagram shown in Figure 1 is a unit circuit that can complete its own function. There is no complex signal transmission between modules, and there is little interference, so the overall system is relatively stable.
3.1 Air pressure sensor
The pressure sensor occupies a core position in the barometer. When designing, the pressure sensor can be selected based on several performance indicators such as measurement accuracy, measurement range, temperature compensation, and measurement of absolute pressure value.
Since the barometer displays the absolute pressure value, it is necessary to select a pressure sensor that measures the absolute pressure value. At the same time, in order to simplify the circuit and improve stability and anti-interference ability, the pressure sensor is required to have temperature compensation.
For this purpose, the author selected Motorola's MAX4100A pressure sensor to measure the absolute pressure value. The temperature compensation range of this sensor is -40~+125℃; the pressure range is 20kPa~1050kPa; the output voltage signal (Vs=5.0V) range is 0.3~4.65V; the measurement accuracy is 0.1%VFSS, and it has good linearity at 20kPa~1050kPa. The specific output relationship is as follows:
Vout=Vs(0.01059 P-0.1528)±Error
Where Vs is the operating voltage, P is the atmospheric pressure, and Vout is the output voltage.
3.2 V/F conversion
The function of V/F device is to convert the amplitude of input voltage into a pulse train whose frequency is proportional to the amplitude of input voltage. Although V/F itself cannot be regarded as a quantizer, it can also realize A/D conversion after adding timer and counter. Its outstanding feature is that it converts analog voltage into a pulse train with strong anti-interference ability, which can be transmitted over long distances and directly input into the computer, thereby realizing A/D conversion function by measuring the output frequency of V/F.
Considering the difficulty of peripheral circuit implementation and the corresponding performance indicators, the author selected the LM331 voltage/frequency conversion chip. The device uses a temperature-compensated bandgap reference circuit, so it has excellent temperature stability, with a maximum temperature drift of 50ppm/℃. At the same time, the pulse output of the device is compatible with any logic form; LM331 can be powered by single or dual power supplies, with a voltage range of 5~40V; full-scale range of 1Hz~100kHz; maximum nonlinear error of 0.01%. Figure 2 shows the peripheral circuit of LM331 in this system. In this circuit, the voltage-frequency conversion relationship based on LM331 is:
fo=KVi
Where, K = Rs/(2.09 Rt Ct RL)?, Rs = Rs1 + Rs2
In fact, Rs in the circuit is mainly used to adjust the conversion gain of the circuit. The typical values of Rt, Ct, and RL are 6.8kΩ, 0.01pF, and 100kΩ, respectively, and the K value can be determined by the designer. In this design, K=2000, Rs=28.424kΩ, mainly considering that the single-chip microcomputer part uses the frequency measurement method to measure fo to ensure the measurement accuracy of the frequency signal. Since Rs, RL, Rt and capacitor Ct will directly affect the conversion result of fo. Therefore, there are certain requirements for the parameters of these components, and they should be appropriately selected according to the conversion accuracy during design. Although capacitor CL has no direct effect on the conversion result, a capacitor with small leakage current should be selected. Using resistor R1 and capacitor C1 to form a low-pass filter can reduce interference pulses in the input voltage and improve conversion accuracy. [page]
3.3 Microcontroller
This barometer implementation requires the use of the microcontroller's P1 port and part of the P3 port, as well as an interrupt source, a timer and a counter. Therefore, the author selected ATMEL's AT89C2051 microcontroller, which is compatible with the 89C51, has 2kB of reprogrammable flash memory, a 2.7V to 6V operating voltage range, 128Byte internal RAM, two I/O ports (P1, P3), two 16-bit counters/timers and six interrupt sources, and can directly drive LED outputs, and has a programmable serial communication port. In addition, the microcontroller is also small in size and low in price.
3.4 LED Display
A single LED is a display unit composed of 7 segments of light-emitting diodes. There are 10 pins, corresponding to 7 segments, a decimal point and two common terminals. In the display circuit, these light-emitting diodes have two ways of connection: common anode connection and common cathode connection. In this design, 4 LEDs are needed to form a display unit, and a dynamic display method is adopted. Since the connection of 4 single LEDs for display is relatively complicated, and the port driving capability of the single-chip microcomputer is difficult to guarantee, a special driver chip needs to be added. Therefore, the author uses a common anode LED with 4 LEDs connected together and the corresponding segments are connected inside. It has 12 pins, including 7 segments and 4 common terminals. In order to increase the brightness of the digital tube, a transistor drive circuit can be added to the bit selection line.
The display circuit controlled by AT89C2051 is shown in Figure 3. The display circuit needs to select appropriate resistors R and Ra to ensure the brightness of the LED. Too large or too small will not allow the LED to display normally. It is ideal to take R as 4.7kΩ and Ra as 510Ω during design. If the convenience of printed circuit board wiring is considered, chip resistors and resistor arrays can be used to save space. In addition, 74LS244 and 74LS06 can also be used to form a driving display circuit, but current limiting resistors must also be added. Because 74LS06 is an open-drain device, a pull-up resistor needs to be added at the output.
4 Software Implementation
Through the above design, the size of P can be calculated by fo to obtain the real-time air pressure value. After the hardware circuit design is completed, it can be simulated using the simulation environment of the AEDK5196PH simulator, and the processing program can be written in C51 language. The basic program flow is shown in Figure 4.
Program setting: T0 is a timer, and the basic timing time base is 50ms. T1 is a counter. Using internal interrupt 0 can ensure that the value of the counter is read after T0 is set to 500ms to calculate the pressure value. If T1 and T0 are both working in mode 1, and the font code is sent at port P1, and P3.0~P3.3 can be used as bit selection lines, then the corresponding function is as follows:
(1) Timer T0 interrupt function:
void timer0(void) interrupt 1 using 1
{ in t x, y;
uint count_ pluse;
ET0=0; //Disable T/C0 interrupt
Tcount++; //interrupt times
if?Tcount == 10){
TR1=0; //Stop the counter counting
Tcount=0;
x=TH1;
y=TL1;
count_pulse=(x*256+y)*2;
ph=(uint)(10 * ((float)(count pressure+1520)/105.9? ?? //Calculate the air pressure
TH1=0x00; //Reset the initial value
TL1=0x00;
}
TH0 = -50000/256; //Reset to 50ms initial value
TL0 = -50000%256;
if(TL0!= 0) TH0--;
ET0=1;
TR1=1;
return;
}
[page]
This interrupt function is mainly used to complete the reading of pulses and the calculation of air pressure values. ph is a global variable that can be used to save air pressure values.
(2) In the display function, the air pressure value is first separated by bit and saved in an array, and then the segment code and the corresponding bit selection are sent to display the corresponding air pressure value. The specific procedure is as follows:
void display(uint ph_in)
{ uchar i=0;
uchar j=0;
uchar select_bit=0; //bit selection
do {
cur_buf[i]=ph_in%10;
i++;
j=i;
} while (ph_in = ph_in / 10);? //When the high bit is zero?End the loop
i=0;
select_bit=0xfe;
do
{ P1=tab[*p];
P3=select_bit;
dl_ms();?
select_bit=(select bit<<1)+1;
//Start displaying from the rightmost digit, circularly shift left
p++;
i++;
}while(i<j);
p = cur_buf; // pointer reset
return;}
In this way, in the main program, you only need to initialize it when the program runs for the first time, and then call the display function in a loop to achieve the real-time display function.
5. Conclusion
The author has designed a barometer using pure hardware circuits. Practice shows that due to the influence of temperature and the limitation of hardware parameters, the stability of real-time display is poor and the accuracy is not high. However, the use of V/F conversion signal and programming method to achieve the measurement completely overcomes the above shortcomings. The results show that this method has the advantages of high accuracy, good stability, and easy function expansion, which can provide a new idea for the design of instruments and electronic products.
Previous article:Design of interface between 51 single chip microcomputer and ARINC429 aviation bus
Next article:Design of measuring light curtain for object classification equipment using C51 single chip microcomputer
- 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!
- 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
- Testing solutions for redundant link networks
- Key wireless technologies for 5G systems
- [NXP Rapid IoT Review] + Rapid IoT App Running Error
- How to Design an RF Power Amplifier: The Basics
- What is jitter and phase noise?
- [Shanghai Hangxin ACM32F070 development board + touch function evaluation board evaluation] + OLED screen display driver
- Tailing Micro B91 Development Kit Burning Pitfalls Record
- Antai Testing - Sharing of Maintenance Experience of Tektronix AFG3021 Arbitrary Signal Generator
- Interrupt vectors for ARM (Cortex-M3)
- July 28 live broadcast review: TI DLP technology innovation and new applications in automobiles (including video and text Q&A)