Home > Microcontroller >Microcontroller Production > Using 89C2051 to make a four-way digital display water level controller circuit

Using 89C2051 to make a four-way digital display water level controller circuit

Source: InternetPublisher:消失的歌 Keywords: Water level controller Updated: 2024/08/08

A hotel requires that when the solar water tank is used for auxiliary electric heating, the amount of water heated should be determined according to the occupancy rate of the guest rooms to reduce the operating cost. To this end, the author uses the 89C2051 single-chip microcomputer to make a four-way digital display water level automatic controller. After experiments, the effect is good, and now it is introduced to single-chip microcomputer enthusiasts.

1. Circuit structure
The circuit schematic is shown in the attached figure. The circuit consists of five circuit parts: water level detection, water depth selection, single chip microcomputer, digital display and relay control. Four normally open reed switches H1~H4 are placed at four different heights in the water tank, and their lead wires are connected to the P3.0-P3.3 ports of 89122051 after photoelectric isolation, as a water level detection circuit; three switches S1~S3 are used as function selection switches, respectively connected to the P3.4, P3.5, and P3.7 ports of 89C2051, as a controllable water depth selection circuit; the function of S1 is to set the water level between H1~H4 for automatic high water level detection control, S2 is to set the water level between H1~H3 for automatic medium water level detection control, and S3 is to set the water level between H1~H2 for automatic low water level detection control. Taking advantage of the fact that each I/O port of AT89C2051 has a 20mA current absorption characteristic, P1.0~P1.6 ports are connected to a common anode digital tube through a current limiting resistor to form a digital display circuit. P1.7 port is used as the relay drive control terminal.

2. Circuit working principle
After power-on, AT89C2051 automatically resets and starts executing the program from unit 0000H. First, set the Pl port and P3 port to high potential, enter the test preparation waiting state, turn off the display, and the P1.7 port does not output the control signal. After initialization, AT89C2051 cyclically detects the P3.4, P3.5, and P3.7 ports, that is, detects the status of the function switches Sl~S3. If any port is detected to have a low potential, the program executes the corresponding water level automatic detection. The closing and opening of the function switches S1~S3 will result in the following situations:

1. When S1 is closed, the program switches to the state of the four normally open reed switches H1~H4 at different heights in the water tank for cyclic detection. When the water level drops to the lowest position, H1 is closed, so that the digital tube displays "1", indicating that the water level has dropped to the position of H1, and at the same time, the P1.7 port outputs a low potential, the normally open contact of relay J1 is attracted and the power of the pump is turned on, and the pump fills the water tank with water; when the water level in the water tank rises to H2, H2 is closed, the digital tube displays "2", indicating that the water level has risen to the position of H2, and the relay J1 remains attracted, and the water level continues to rise; when the water level rises to H3, H3 is closed, the digital tube displays "3", indicating that the water level has risen to the position of H3, and the relay J1 still remains attracted, and the water level continues to rise; when the water level rises to H4, H4 is closed, the digital tube displays "4", indicating that the water level has risen to the position of H4, the normally open contact of relay J1 is disconnected, the power of the pump is turned off, and the water level finally remains at the position of H4. When the water level in the tank drops, the opposite happens.

2. When S2 is closed, the program switches to the state of the three normally open reed switches H1~H3 at different heights in the water tank for cyclic detection. When the water level drops to the lowest position, H1 is closed, and the digital tube displays "1", indicating that the water level drops to the HI position. At the same time, the P1.7 port outputs a low potential, the normally open contact of the relay J1 is attracted and the power of the pump is turned on, and the pump starts to fill the water tank with water; when the water level rises to H2, H2 is closed, the digital tube displays "2", indicating that the water level rises to the H2 position, the relay J1 remains attracted, and the water level continues to rise; when the water level rises to H3, H3 is closed, the digital tube displays "3", indicating that the water level rises to the H3 position, the normally open contact of the relay J1 is disconnected, the power of the pump is turned off, and the water level remains at the H3 position.

3. When S3 is closed, the program switches to the state of the two normally open reed switches H1~H2 at different heights in the water tank for cyclic detection. When the water level drops to the lowest position, H1 is closed, and the digital tube displays "1", indicating that the water level has dropped to the position of H1. At the same time, the P1.7 port outputs a low potential, the normally open contact of the relay J1 is attracted and the power of the pump is turned on, and the pump starts to fill the water tank with water; when the water level rises to H2, H2 is closed, the digital tube displays "2", indicating that the water level rises to the position of H2, the normally open contact of the relay J1 is disconnected, the power of the pump is turned off, and the water level stays at the position of H2. .

4. When S1~S3 are all closed, it is an incorrect operation and the controller randomly controls the water level in the water tank.

用89C2051制作四路数显水位控制器电路

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号