# Smart water tank monitor

#### tjones91

Joined May 6, 2020
19
Hello, i have a circuit below that uses an SR-04 ultrasonic distance sensor to measure the height of the water level and use a relay to turn on and off a pump to control the water level and an HLK-5M12 SMPS . I got the schematic from here.
According to the website/schematic the circuit runs on 220v.
Is this correct explanation? When the distance between the water and the sensor become greater( less water in the container) > 30 the motor turns on putting more water in the container and turning the water off when it is less than <6.
I believe it does this by when the distance is greater than >30 the Digispark microcontroller outputs a "HIGH" on T1(NPN transistor) which activates RL1(relay) putting it to N/O and this gives the other 110v plus the original power switch 110v = 220v required to turn on HLK-5M12 which gives the supply voltage that lets you turn on the pump, then the SR-04 turns off the control pin to stop overflow and this process repeats.
Is that correct? Thanks.
P.s ( I'm not going to get into code seeing as this is not the correct forum so i kept it minimal and the numbers 6 and 30 are just referring to centimeters).

#### AlbertHall

Joined Jun 4, 2014
12,156
There is no 110V in this circuit.
When the power switch is on power is supplied to the HLK-5M12 which supplies power to the rest of the circuit. Then the digispark can read the HC-SR04 and control the relay via T1 to turn on or off the pump.

#### tjones91

Joined May 6, 2020
19
There is no 110V in this circuit.
When the power switch is on power is supplied to the HLK-5M12 which supplies power to the rest of the circuit. Then the digispark can read the HC-SR04 and control the relay via T1 to turn on or off the pump.
Thank you for the response, I thought X1-1 and X1-4 are each a HOT leg.
So what is the purpose when the relay gets pulled to N/0 and X1-4 is now connected to AC1?

#### AlbertHall

Joined Jun 4, 2014
12,156
X1 and X2 are the 230V input power.
X3 and X4 are the 230V power to the pump.
X2 and X3 are permanently linked.
The relay contact links the power from X1, via the power switch, to X4 to power the pump.