With the development of modern measurement technology, higher and higher requirements are put forward for the measurement system. In the automatic distillation measurement and control system, the accurate and timely detection of the first drop of liquid distilled from the condenser during the distillation process is the prerequisite for obtaining the initial distillation point; the real-time and accurate measurement of the change in the volume of the recovered liquid in the measuring cylinder is the basis for controlling the different distillation speeds at different times during the distillation process. However, there are many unsatisfactory aspects in the completion of the tasks of detecting, recovering, measuring, and measuring the speed of the droplets distilled from the condenser, and a more complete and reasonable droplet and liquid level detection tracking control system is needed.
From the perspective of the liquid level measurement method, it can be divided into two categories according to whether the detector is in contact with the liquid: one is contact measurement, and the other is non-contact measurement. When it is necessary to determine the volume change by measuring the liquid level change, the non-contact measurement method is generally used. However, in most non-contact measurements, the liquid level sensor has a large test range and an absolute resolution greater than 0.5ml. Therefore, when the volume change range is 0-100ml and the liquid level change range is 0-200mm, it is difficult for ordinary sensors to achieve a resolution of 0.1ml. For this reason, it is necessary to develop a high-precision liquid level detection system that measures the real-time change of liquid volume in an ordinary 100ml glass measuring cylinder.
In view of the above problems, this paper introduces a liquid level detection system with AT89C52 single chip microcomputer as the core, which realizes the purpose of high-precision volume measurement of changing liquid level.
1. Principle of area measurement
Due to the volume of the measuring cylinder
is certain and made evenly, then the height corresponding to a certain volume of liquid in the measuring cylinder is also certain. The sensor and the screw are coupled to each other, and the top of the screw is directly connected to the middle axis of the stepper motor. Every time the stepper motor takes a step, the screw turns a small angle. Therefore, when the motor step and the screw pitch are constant, the unit height of the measuring cylinder is proportional to the number of motor steps. Therefore, the volume of the liquid in the measuring cylinder can be directly converted into the number of motor steps, that is, how many milliliters of liquid is represented by each step of the motor.
The schematic diagram of volume measurement is shown in Figure 1. In order to determine the conversion relationship between the number of steps of the motor and the volume of the liquid in the measuring cylinder in milliliters, we need to calibrate the system. The specific calibration method is:
1. Measure the number of motor steps for a liquid volume of 10 ml and set its value to L1;
2. Measure the number of motor steps for a volume of 100 ml of liquid and set its value to L2;
According to the data recorded in the above steps, calculate the volume in milliliters represented by each step of the motor, and set its value as T, then the following calculation formula is obtained: T=90/(L2-L1). In this way, the volume of liquid tracked by the tracker can be easily calculated.
2. Hardware circuit composition and principle
The basic components of this system are: infrared photoelectric sensor, input circuit, clock circuit, reset circuit, display circuit, stepper motor and drive circuit, single-chip real-time processing and control circuit, etc.
Its basic working principle is: the various signals detected by the infrared photoelectric sensor are converted into electrical signals after passing through the signal processing circuit, and the electrical signals are sent to the single-chip microcomputer for judgment and calculation processing, and then control instructions are issued to control the stepper motor to complete the detection and tracking of the changing liquid level.
The hardware circuit block diagram is shown in Figure 2:
1. Infrared photoelectric sensor
The infrared photoelectric sensor is composed of an infrared emitting diode and a sensitive transistor. The wavelength of the infrared light emitted by the infrared emitting diode is the same or similar to the wavelength of the light received by the sensitive transistor. When there is no obstacle between the emitting tube and the receiving tube, the sensitive transistor is turned on due to receiving the infrared light signal, and the circuit output level is low; when there is an obstacle between the emitting tube and the receiving tube, the sensitive transistor is turned off due to not receiving the infrared light signal, and the circuit output level is high.
In this system, the detection of the liquid surface in the measuring cylinder is basically based on the scattering principle. The liquid on the surface of the liquid in the glass measuring cylinder will undergo epitaxy or adsorption to form a ring-shaped surface, which is just for our detection. It is composed of a pair of infrared photoelectric tubes. The liquid on the surface of the liquid in the glass measuring cylinder will undergo epitaxy or adsorption to form a ring-shaped surface. Due to the scattering effect, the receiving tube cannot receive the infrared light signal of the transmitting tube and is cut off, and the circuit output level is high. Therefore, the level of the liquid surface can be detected by the level of its output, and its output signal is then output to the single-chip interface circuit and the display drive circuit through the cable for processing. In order to meet the special requirements of this system, we install the infrared transmitting and receiving tubes on both sides of the U-shaped plate, and the distance between the two tubes is greater than the diameter of the glass measuring cylinder. In order to reduce the interference of external natural light, a certain depth of light guide hole groove is installed on the transmitting and receiving heads of the two tubes. On the one hand, it reduces the interference of external light, and on the other hand, it can limit the beam diameter to improve the detection resolution.
2. Stepper motor and drive circuit
When the stepper motor is working, its power supply mostly adopts unipolar 直流电\'); companyAdEvent.show(this,\'companyAdDiv\',[5,18])"> direct current . By energizing each phase winding of the stepper motor in an appropriate timing manner, it can be made to perform step rotation. The motor used in this system is a four-phase motor. When the two-phase winding is energized, the corresponding two magnetic poles form NS poles respectively, generate a magnetic field, and form a magnetic circuit with the rotor. Under the action of the magnetic field, the rotor will rotate a certain angle so that the rotor teeth are aligned with the stator teeth, so that the stepper motor "walks" forward one step. Therefore, the control of the motor rotation is mainly based on the requirements of the motor rotation direction, and the corresponding control signal can be output sequentially by the single-chip microcomputer.
The following takes forward rotation as an example. When rotating forward, it is required to output positive pulses with a width of 8ms in the order of ABCDA, and there is a small delay between the two pulses. Therefore, a series of signals such as 1000, 0100, 0010, 0001, 1000 can be output to the PC0~PC3 ports of 8255 in sequence. Each high level is maintained for 8ms, and the output time interval is 1ms, which can meet the control needs. Similarly, the motor can also be controlled to reverse, but the order of the output signal is reversed. Therefore, the initial control word in the register can be set to 00010001B (i.e. 11H). For each step of the motor, the content of this register is shifted to the left (forward) or right (reverse) by one position, and then the content of this register is taken out and output, and the control of the motor can be completed. [page]
3. Single chip microcomputer real-time processing and control
For this topic, the hardware circuit should be as simple as possible, and some circuits that can be realized by software should not be hardware circuits as much as possible, so as to achieve the purpose of miniaturization, low price and reliable performance of the product. When choosing a single-chip microcomputer, its convenience and practicality should also be fully considered. The biggest disadvantage of the 8031 single-chip microcomputer is that it needs an external EPROM, the circuit is complicated, and the EPROM is erased by ultraviolet light, which is very inconvenient to use. After extensive comparison, it was determined to use the AT89C52 FLASH single-chip microcomputer of ATMEL. It not only has all the functions of the 8031 single-chip microcomputer, but also has many functions that the 8031 does not have. It has an 8KB internal FLASH program memory that can be erased multiple times, which can be erased electrically, which is very convenient.
The AT89C52 microcontroller has the following main features:
(1) Compatible with MCS-51 products;
(2) It has 8KB rewritable FLASH internal program memory and can perform 1000 erase/write operations;
(
3) Full static operation: 0Hz to 24MHz;
(4) Three-level program memory encryption;
(5) 256 bytes of internal RAM;
(6) 32 programmable I/O lines;
(7) Three 16-bit timers/counters;
(8), 8 interrupt sources;
(9) Programmable serial port;
(10) Low power idle and power-down modes.
The main function of the single-chip real-time processing and control part is to receive the converted electrical signal from the infrared photoelectric sensor and receive the status information sent by the input circuit. After judgment and calculation, on the one hand, it issues control instructions to control the operation of the motor and detect and track the liquid level; on the other hand, it sends the required data to display the data and indicate the status. Therefore, this part is the key part of this system, and its performance is directly related to the performance of the entire system. The specific hardware circuit is based on the AT89C52 single-chip microcomputer and is realized by expanding the parallel port 8255. The circuit is shown in Figure 3.
As can be seen from Figure 3, the input circuit is connected to the P1 port of AT89C52, receives the input status information and sends it to the single-chip microcomputer. The liquid level signal is directly sent to the P3.0 port. During automatic tracking, the single-chip microcomputer continuously queries the P3.0 port and makes judgments and processes once there is a signal. The droplet signal is connected to the P3.2 port (i.e., the INT0 interrupt pin). Since the droplet detection is at any time, it needs to be controlled by interrupts. When the droplet signal comes, the interrupt responds and records the number of droplets. The upper and lower limit signals are connected to the P3.4 and P3.5 ports respectively. During operation, once the upper and lower limit signals appear, it means that the predetermined operating range has been exceeded. After receiving the signal, the single-chip microcomputer issues a control instruction to stop the rotation of the motor. Other control signals such as display and motor drive are sent to 8255 by the bus in time-sharing to complete the predetermined tasks.
The chip select signal /CS and the port address select lines A0 and A1 of 8255 are provided by P2.7 and P0.0, P0.1 of AT89C52 respectively after address latching, so the addresses of port A, port B, port C and control port of 8255 are 7FFCH, 7FFDH, 7FFEH and 7FFFH respectively. D0~D7 of 8255 are connected to P0.0~P0.7 of AT89C52 respectively, and its /RD, /WR are connected to /RD, /WR of AT89C52 one by one.
3. Software Design
System software is an important part of the whole system. Only under its command and control can the hardware circuit work and complete the corresponding functions. Moreover, the defects of some hardware circuits can be compensated by software programming. According to the functional requirements of the system, the software is in MCS-96 assembly language, with a modular structure, consisting of a main program, automatic detection and tracking subroutine, calibration subroutine, display subroutine, etc. In this system, the realization of high-precision measurement is largely guaranteed by software.
The main program includes system parameter initialization and cyclic working process, and is the core of the software part of this system. Its main tasks are: first, to initialize the system of single-chip microcomputer state parameters and program-defined state parameters; second, to manage and control each subroutine, arrange corresponding instructions, and provide subroutine entry data to achieve the purpose of completing system functions.
The function of the liquid level automatic detection and tracking subroutine is to control the liquid level tracker to take the bottom liquid level as the starting position, continuously track the change of the liquid level, and convert the actual liquid volume value to display it in real time. Its execution steps are: first, the infrared photoelectric sensor automatically detects the liquid level, and sets this liquid level as the bottom liquid level to be tracked, and displays it as "0". Then, it enters the real-time tracking state. As long as the liquid level changes (rises), the detector will automatically track and display the volume of the liquid in real time until the liquid level no longer changes.
The calibration subroutine is performed every time the measuring cylinder is replaced. The purpose is to find the corresponding relationship between the volume of the liquid in the measuring cylinder and the number of steps of the motor, and then send it to the microcontroller. When performing volume calculations, there will be a new standard to improve measurement accuracy.
IV. Conclusion
The liquid level detection system implemented by AT89C52 single chip microcomputer can achieve a resolution of 0.1ml in a standard 100ml glass measuring cylinder when the liquid level changes in the range of 0-200mm. Practice has proved that this liquid level detection system has high performance-price ratio and reliable control method. Its design ideas and methods can be used as reference for automatic distillation measurement and control systems, and have broad application prospects.
Previous article:Design of ultrasonic ranging and anti-collision alarm system based on AT89C52
Next article:Realization of RS-485 multi-machine communication based on single chip microcomputer
Recommended ReadingLatest update time:2024-11-16 16:47
- Popular Resources
- Popular amplifiers
- 西门子S7-12001500 PLC SCL语言编程从入门到精通 (北岛李工)
- Siemens Motion Control Technology and Engineering Applications (Tongxue, edited by Wu Xiaojun)
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
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
- Design of screen self-checking program based on FPGA
- Live FAQ|Fujitsu FRAM non-encryption algorithm (spectrum) authenticity verification solution
- Based on STM32F303 dual motor FOC driver: sensorless schematic/BOM/code and other open source sharing
- (C- Wireless Charging Electric Car) 2018TI Cup Wireless Charging Car
- Do popular chargers also need double pulse testing? Download the information to learn more and get gifts!
- Computer System Architecture Q&A
- Please recommend a stackup of single-layer FPC with electromagnetic shielding film
- Radio Frequency Identification Technology and Its Application Development Trend
- MSP430F5529 ADC Reference
- Dozens of engineers worked for 5 days, and Alibaba Damo Academy developed an intelligent epidemic robot overnight