The most important thing to check the liquid level is to prevent the hot water tank from burning out when there is no water. If the hot water tank is dry-burned, it will not only cause the damage of the heating resistor, but also a great safety problem. There are many ways to detect the liquid level. The simplest and most convenient method is to use two wires directly into the water tank. When the two wires are completely in the water, the water is like a wire, and the two wires can be detected by passing through the I / O port. To the corresponding electrical signal. Although cheap and simple, it has low reliability and stability. The photoelectric liquid level switch has high reliability and stability, and is easy to install. Shenzhen EPT Tech's photoelectric level sensor FS-IR1901 can not only adapt to liquid level detection with different colors and different levels of transparency. Its characteristics can use the infrared photoelectric effect. After the sensor is powered on, the infrared emitting head of the sensor will emit infrared rays. If no liquid is encountered, the infrared rays will not have any effect. The emission phenomenon occurs when liquid is detected. The infrared receiving head will receive the reflected signal, and the sensor output port will realize the high and low level conversion. The sensor at the output end, the yellow wire is connected to the I / O of the microcontroller. Because the current of the output signal is not enough, a 10K resistor must be added to amplify the current signal to ensure the reliability of signal transmission. The red wire of the sensor is connected to the 5V power supply, and the blue wire is grounded to ensure the normal operation of the sensor.