Controlling motor speed using a hall effect sensor.

Hello folks this is my first post. I have limited knowledge of the C language

Feasibility question:

Is it possible to convert the pulse output of a hall effect flow meter into a pwm signal capable of controlling the speed of a dc motor in a linear fashion?

An Arduino can read the output from a Hall effect sensor and measure the interval between the pulses and it can produce a PWM signal.


Sounds like an XY problem. Why is a PWM signal needed? You're definitely not telling us the whole story. Care to disclose?

Controlling the speed of a DC motor requires another sensor (rotary encoder...), and a (PID) regulator. PWM is fine for controlling the motor.

My plan is to attempt to silence a very noisy shower waste pump.

Few specs:

The shower is below ground level so has to be pumped

The shower fitting has two inlets hot and cold. Flow meters are fitted inline.

The shower fitting is a thermostatic mixer so the amounts of water flowing through the inlets varies as the temperature automatically regulates itself.

Water flow also changes depending on what setting you have it on either high low or something in between.

If water in the waste outlet drops to the point where the pump begins to suck air, it is incredibly noisy.

I want to use an arduino to ‘match’ the outflow of water from the shower tray with the inflow from the shower head so that a head of water is maintained in the shower waste pipe at all times to avoid the horrible sucking noise.

There are systems available which will achieve the above but they are expensive and in any case I though I’d have a go at making something myself.

Anyway back to the original question, I know you can control the speed of a large dc motor using pwm and a transitor.

The flow meters output is a regular pulse so what I want to know how would I go about reading the pulses from the flowmeter and then converting them into a pwm signal to drive the transitor? Is the above even possible?

A level switch in the waste outlet could turn off the pump before it starts sucking air. But that were too simple ;-)


DrDiettrich: A level switch in the waste outlet could turn off the pump before it starts sucking air. But that were too simple ;-)

Yes, the shower must drain to a sump, where the pump is, so a simple level switch to detect when to turn the pump on would do the job. In fact two level switches, a lower level and an upper level. If only the lower is ON then run the pump in quiet mode. If the upper is ON and the lower ON, then run the pump fast to keep the sump from over flowing. You will need to use a MOSFET to drive the motor with PWM control. What are the motor specs? Tom... :)

A shower sump can be a surprisingly hostile environment for mechanical equipment.

What about a microphone that detects the unwanted noise and immediately slows or stops the motor?


I guessed right. It was likely an XY problem. The water level needs to be monitored. I've seen in a hydrology lab floater with a magnet on top. The magnet actuates the magnetic wiper on a linear potentiometer. I was told the potentiometer is not expensive, and available on ebay.

Maybe something like this?