Water Height Controller

Introduction: Water Height Controller

For the TU Delft course Measurments for Water we had to build our own measurment device which will upload its results to the internet. We were allowed to choose what quantity we wanted to measure about water. We decided to make a device that is able to measure and control the water height in a container.

We were provided with a Particle Photon connected to the internet. There was also broad a range of different sensor which we could use. Next to that we had access to all sorts of materials and devices, such as pumps, batteries, wood etc.

In the following steps we are going to explain how we build our water height controller.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: The Components

To make this device you need:

  • Particle Photon
  • Ultrasonic Sensor (we used a HC-SR04)
  • Mosfet (we used a IRF520)
  • Submersible Pump
  • Hose
  • 12V Power Supply (we used a Eagle HP003C)
  • Some male and female cables.
  • Breadboard
  • Micro USB cable
  • Led (optional)
  • 220 Ohm Resitor
  • Plank or Pole to attach the devices to
  • Buckets
  • Container


  • Ducttape
  • Screwdriver
  • Nipper

Step 2: Connecting the Ultrasonic Sensor

We start with connecting the ultrasonic sensor to the Particle Photon. The Photon is attached to the broadboard so we can connect the devices easily. We connect the VCC pin to the Vin on the Photon. The Trig and the Echo pins are connected to the digital pins of the photon. We used D4 for the Trig and D5 for the Echo. The ground pin was connected to the ground on the photon.

With the code the ultrasonic sensor should work now.

Step 3: Connecting the Pump

Connecting the pump & power supply to the Mosfet:

We start with connecting the 12V Pump to the mosfet module. The pump has a positive and negative cable which we connect to the V+ and V- entrances on the mosfet.

To supply the pump with power we connect a 12 volt power supply. We used a switching power supply that was set to 12 volt. We cut off the head of the power supply cable so we could connect it to the mosfet. These cables were connected to the Vin and GND ports of the mosfet. The power supply can be plugged into a wall socket.

Connecting the Mosfet to the Photon:

The GND pin on the mosfet is connected to the ground on the Photon. The VCC pin on the mosfet to the Vin on the Photon. The SIG pin is connected to a digital pin on the Photon (we used D1).

Step 4: Creating the Set Up

With all the parts connected to the Photon we are ready to create our set up.

We used three wooden planks to make an L shaped pole to attach the devices to. This L will be placed upside down in the water.

At the bottom of this pole we attached the pump, this end will be placed into the water.

At the top of the pole we placed the breadboard with the Photon.

In between the Photon and the pump the mosfet module is placed.

The ultrasonic sensor is placed at the top on the outsticking part of the pole facing downwards.

All we need to do now is supply the Photon with our code and the device is ready to run!

Step 5: Adding the Code

The used arduino code is given above.

We used a critical water height of 10 centimeters in our code. This value can be changed to fit your own needs.To do this you need to change the values in the if loop.

The 80 used in calculating h is the height of our sensor above the bottom of the pole. This value may vary depending on the height of your sensor.

Use a micro usb cable to connect the photon to your computer and flash the code to the photon.

Step 6: Adding a Led Indicator (optional)

We have also added a Led as a visual indicator to show if the water level is to high. This is optional and is not needed to run the device.

The Led is placed on the breadboard and connected to the same digital pin as the mosfet. The Led is also connected to the ground. In between the Led and the digital pin we placed a 220 Ohm Resistance.

The Led will now burn when we are pumping water.

Step 7: Using the Finished Device

The device is now finished and ready to measure and control the water height!

Place the device in a container and start filling it with water. When the water height reaches the indicated critical value the device should start pumping water out until it is below this value.

Be the First to Share


    • Backyard Contest

      Backyard Contest
    • Silly Hats Speed Challenge

      Silly Hats Speed Challenge
    • Arduino Contest 2020

      Arduino Contest 2020



    2 years ago

    That would be a good system to monitor the garden rain drum :)