Topic requirements
(1) Conduct overall research and design of liquid level monitoring and control.
(2) Use a submersible liquid level sensor to measure the liquid level.
(3) By collecting data on the liquid level, accurately determine whether the current value is within the set range. If it is greater than the set maximum value, the water pump starts working until the liquid level reaches the maximum value, then the water pump stops working. If the liquid level is less than the minimum value, the buzzer alarms.
(4) Use the LCD1602 display to display the current liquid level in real time.
Topic Analysis
!!!!!!!!! Attention!!!!!!!!!
This design uses TLC1543 instead of AD0809 in the figure below.
Schematic diagram Design instructions
1. Power supply circuit design:
In this system, the water injection pump, water discharge pump and liquid level sensor require DC12V power supply, while the working voltage of the microcontroller and other peripheral circuits is DC 5V. LM2596 is a 150KHz fixed frequency PWM DC-DC regulated power converter. It has 3A output current driving capability, high efficiency, low ripple, high linear regulation rate and load regulation rate. In this design, the power supply scheme adopts 12V voltage input, and 12V voltage provides power to the water injection pump, water discharge pump and liquid level sensor, and the DC-DC chip LM2596 is selected to reduce the 12V voltage to a stable 5V voltage, providing voltage for the single-chip system and other peripheral systems.
2. Main control circuit design:
STC89C52 single-chip microcomputer is a high-performance, low-power 8-bit single-chip microcomputer with high performance, low power consumption, large capacity, multiple interfaces, powerful timers, and rich peripherals. Therefore, STC89C52 single-chip microcomputer is selected as the system master in this design. In the design of the main control circuit, a button reset circuit is provided. When the single-chip system is running and the program runs away due to environmental interference, the reset button is pressed and the internal program automatically starts from the beginning. The operation of the single-chip microcomputer must rely on a stable clock pulse, and an external crystal oscillator circuit is still necessary. The P0 port of STC89C52 is an open-drain output. When used as a bus expansion, no pull-up resistor is required. When used as an I/O port, a pull-up resistor is required. In this design, it is used as the data transmission port of LCD1602, so a row of pull-up resistors needs to be added to the P0 port.
3. LCD1602 display circuit design:
LCD1602 is a common character liquid crystal display that can easily display regular character information. It has the characteristics of low power consumption, easy control, and convenient display of regular character information. In this design, LCD is used to display real-time time, liquid level, operation mode, water pump status and other information.
4. LED indicator circuit design:
There are several indicator lights on common equipment to monitor the status and operation of the equipment. These indicator lights are called light-emitting diodes (LEDs). Fully understanding the meaning of these indicator lights can often easily and quickly determine the cause of the fault during network fault diagnosis, achieving unexpected results. In this design, there are 5 LED indicators, which respectively indicate the power indicator, manual mode, automatic mode, water inlet, water outlet and other states.
5. Keyboard circuit design:
The key circuit refers to a circuit that controls electronic equipment. In the circuit, the device can be turned on, off, adjusted, switched and other operations by pressing the key. The main function of the key circuit is to control various operations of electronic equipment, such as turning on and off, adjusting the volume, switching channels, etc. In this design, there are 5 keys, one of which is used as a reset key. The other four keys are independent keys, which are reused by the program as mode switching, water inlet, water outlet, upper and lower limits of liquid level adjustment and other functions.
6. Alarm circuit design:
In this design, an active buzzer is used as an alarm, which is simple to operate. Since the driving current of the IO port of the single-chip microcomputer is not enough to drive the buzzer, the transistor S8050 is used to amplify the current to drive the buzzer.
7. Motor control circuit design:
Since a larger current is required to make the motor rotate, the power supply circuit of this system is not enough to provide such a large current for the motor. Therefore, a relay is used as a switch in this design, and the single-chip microcomputer controls the motor by controlling the relay, so as to achieve the effect of water pump filling and drainage.
8. Water level monitoring circuit design:
TLC1543 analog-to-digital converter adopts serial communication interface, has the characteristics of multiple input channels, high cost performance, easy to interface with single-chip microcomputer, and can be widely used in various data acquisition systems. The sensor used in this design is a submersible liquid level sensor, and the output signal is a current of 4mA-20mA.
9. Real-time clock circuit design:
DS1302 is a low-power real-time clock chip with trickle current charging capability launched by DALLAS, USA. It can count years, months, days, weeks, hours, minutes, seconds, and has multiple functions such as leap year compensation.
10. Program burning circuit design:
In this design, the onboard CH340N is used for program burning and serial port debugging. ! ! ! CH340N is independently powered! ! ! ! , and does not share the same power supply with the system. The single-chip microcomputer uses power-on reset to burn the program during burning. After testing, the reset button cannot achieve the effect of burning the program, but it can still reset the system. As for why the program cannot be burned, the reason is unknown.
PCB design instructions
! !!!
...
! ! TLC1543 failed to verify the corresponding code sensor experiment (the reason has not been found yet, maybe I bought a pirated chip). There is no problem with the hardware part. Due to time reasons, I was in a hurry to submit the course project, so I did not use the sensor to collect the information of the liquid level, but simulated the liquid level value by manually giving a value, and the same is true for water inlet and outlet (750ms minus 1 or plus 1).
Don't look at the BOM table, look at the device catalog table I uploaded
Demonstration video
[Course Design] Liquid Level Control System_Bilibili_bilibili
Other attachments uploaded
details see attachment