Electrical – Detecting motor stall with lm311

currentdc motordetectionsensingshunt

I have 9v DC motor that I want to use to lock a door. Control is achieved using an esp8266 board. The esp8266 also switches the direction of rotation via an H bridge. So far, so good..

Now I want to detect the stall at each end of the motor travel. Initially Im trying to do this without the H bridge, just for simplicity.

There is a good amount of info about the subject out there, but Im afraid my electronics knowledge is poor and thus far I havnt been able to get anything to work.
My approach has been to use a .1 ohm sense resistor with an lm311 as in this circuit below.
The supply is an adafruit variable voltage module delivering 9v and Ive tried a number of different pullup resistors. Im afraid I just dont understand enough to work this out.
Regardless of the R pullup value.. 1,5,10 K and even without it, the output seems to wobble arounf 1.8v setteling down to about .9v. When the motor is stalled I detect no change at all in the output.

enter image description here

In an ideal world, I would get I nice 3.3v on the output when the motor stalls so that I can deal with it in software.
Id be grateful for help. Thanks

Best Answer

There are a couple of problems here.

Firstly, you are connecting an input to the positive supply rail (pin 3 -Vin) - this won't work - the LM311 isn't a rail-to-rail device and if you were powering from (say) +15V the data sheet tells you that the usable input range is up to 13.8 volts.

Given that your top supply is +24V you must not assume that inputs can be taken as high or higher than 22.8 volts.

Next, you really need to engineer a solution that allows the voltages on the two inputs to cross each other - this guarantees switching operation on the output. Unfortunately you have -Vin always set to a voltage that +Vin can only aspire to reach.

What you probably want is a high-side current monitor. If I remember correctly Linear Technology make some: -

enter image description here

Maxim have a few options: -

enter image description here