Water level control system

Good Afternoon,
As a school project, I have to build a system that keeps the level of water in a container the same while water is flowing out of the bottom at varying flow rates. The flow of water going out of the container will be controlled either by a manually operated valve or I need to find a method to control it by Arduino.

-The project may include an LCD display to display the current water volume in the container.

  • The project may also include a data collection system to record the water level at different times (for example every 10s)

My difficulties with this project are:

  • I have a 12v dc pump and when I vary the voltage the flow varies. How can I vary a 12v supply from 4v to 12 v using Arduino? (what is the circuit called?)

  • As an extra part, my lecturer wants me to find a way to vary the flow of water going out of the container using Arduino as well how can this be tackled when using small pipes like 8mm or similar sizes because the smallest variable flow valves I found were half-inch and they were very expensive.

Thanks in advance

PWM can control a motor's speed.

By putting a motor on each end you could control input and output. By driving the input motor with the same PWM signals as the output motor you can achieve a 1:1 in flow to outflow.

A variable flow can be achieved by a normal valve, for example, 1 second open, 3 seconds closed, in a cycle, then maybe changing the open and closed intervals.

Alternatively, for the variable flow outlet "valve" simply use another pump, but ensure that the outlet tube is held higher that the water level in the container to prevent any unwanted leakage.

Can someone please explain to me how this PWM works? What I need is to control a supply to give me between 4 and 12V to vary the speed of the pump motor as required by the system.
Thanks

In principle it works like this.
If a pump has to be operating say at half power, that is the equivalent of switching it on at full power for 1 millisecond and switching it completely off for the next millisecond. That is done in a continuous cycle.

Yes but how can the Arduino that gives out 5V maximum power a pump at 4-12v?
Thanks in advance and sorry for the multiple questions.

The Arduino pins would not power the motor directly. The pins would instead drive a Mosfet or transistor to power the motor.
Search for "using a transistor as a low side switch"

please post the precise assignment. This description doesn't explain how the water comes into the container and how you measure the actual water level.

basically I wouldn't use PWM with a cheap pump but a simple relais module.

Define two levels of water: a high water mark when you switch on your pump and a low level water mark when you switch off the pump. https://en.wikipedia.org/wiki/Hysteresis