Introduction: Water Level Controller Using Linkit One

Our resources are scarce, and one of the best ways to contribute is reducing wastage of water and electricity

In this instructable I have used a water flow sensor YFS201 to determine the rate of flow and integrated the total amount of liguid flow through it.

I have applied it to turn of the motor automatically on completely filling the capacity of the container

Step 1: Relay & Motor

Select a low requirement motor which doesnt suck in too much power, otherwise it'll burn the relay.

You'll need a 5V 20mA relay which can withhold the motor specifications on the connection end

Coneect one of the coil terminals to pin 13 and the other to ground

Connect one terminal of the motor to NO terminal of the relay

Connect the common terminal of the relay one of the termins to the AC mains.

Connect second terminal of the AC mains to the second terminal of the motor

Note: Some motors have an earthing pin. Connect it to the earth socket otherwise there a danger of electric shock.

Step 2: Connections

YSF201:



• Vin: 3V3
• Gnd: Gnd
• Out: D2


Button Switch:



• terminal 1: D12
• terminal 2: Gnd


Relay:



• Coil1: D13
• Coil2: Gnd

Step 3: Code

I have written my code to integrate the flowrate to give the total capacity in millilitres

Change the capacity level in my code (in millilitres)

Step 4: Compile, Run & Output

Compile and Upload the the code to the board

Now to start the motor, push the button

The motor will continue to work until the capacity is reached.

The motor will turn off automatically on reaching full capacity