In my Arduino Mini (3v) project, I am using DC Motor Driver (BD65496MUV) to run a small 50RPM DC Motor. Motor rotates an independent mechanical knob whose starting and ending points, I do not know.

At some point I expect the knob to get locked/stuck. I need to know when that point reaches and stop the motor from running. I cannot access the mechanical knob so crash sensors etc are not an option.

I understand there may be a way to read the current to the motor and from that deduce when the motor is stuck, however I am drawing blank beyond that. How can I tell when the DC motor is stuck?

  • \$\begingroup\$ can you access/modify anything along the motor drive shaft? If so, you could use an encoder to measure the motor's rotational speed. \$\endgroup\$ – helloworld922 Apr 20 '17 at 21:00
  • \$\begingroup\$ I can. But It is a micro size motor. Are there any micro encoders to do the job? \$\endgroup\$ – Kashif Apr 20 '17 at 21:02
  • \$\begingroup\$ Which motor is it? Can you measure its DC resistance? \$\endgroup\$ – Bruce Abbott Apr 20 '17 at 21:08
  • \$\begingroup\$ as a kid, i made something with a CdS and an xmas light taped up to disconnect a winch motor via a relay. i guess the impedance happened to match and the LDR stalled the inrush... \$\endgroup\$ – dandavis Apr 21 '17 at 9:17

You can insert a suitably low-value current sense resistor in series with the motor supply and measure the voltage drop across it. When the motor is stuck, it will pull its maximum current (stall current) and this should/will be distinct above its normal running current. This is the simpler option to implement.

You can also detect and measure the motor's generated e.m.f. when it is undriven and freewheeling along. That requires the voltage from both motor terminals to each be routed to a potential divider and then measured. If you have a pair of ADC inputs on your Arduino, you could use those with input protection diodes coming off of the potential divider taps. You can remove the motor drive, wait a short while for the motor inductor's back e.m.f. (less than 1 ms - experiment with scope') to die away then read voltage across the motor voltage. When it is moving, the motor will produce a generated voltage. This is the less intrusive option to implement.

Edit: OP posted "This is my motor. It is rated at 6v but I will be running it with my 3v (2xAA) power. Free-run current @ 6V: 40 mA, Stall current @ 6V: 360 mA" 24/04/17

It is hard to say what the stall current will be at 3 V from 6 V data. Treating it as a resistor, which it isn't, then let's look for 200 mA as the threshold for a stall.

The voltage drop across the resistor has to be small enough not to waste excessive motor power but large enough to be separate from noise. Let's say that a stall current should produce a 0.2 V drop across the resistor, just under 7 % of the total motor power at that point. This leads to a 1 ohm resistor. Going worst-case, it could dissipate I2R (0.36 x 0.36 x 1 = 0.1296) W at stall so let's use a 0.5 W resistor for generous and cheap derating of 25 %.

Assuming the Arduino ADC has an FSD of 3.3 V, this 0.2 V is represents a conversion to 15 (15.45) for an 8-bit ADC, to 248 (248.18) for a 12-bit ADC. (You'll know more about your particular Arduino's ADC than me.)

It is sensible to act on a filtered measurement rather than an instantaneous measurement, to reduce susceptibility to noise. This should be fairly easy if the reading it through an ADC as the software can process it. Otherwise a simple hardware RC filter can be implemented but this is less flexible. A combination of the two would be good: a hardware RC filter to remove noise above the ADC's sample rate and a simple digital filter in software.

Therefore the hardware RC filter can have a cut-off frequency of 200 Hz. This leads to a response to a stall in the 10s of ms which should be enough while being less susceptible to motor stutters if the motor load mechanism gets 'sticky'.

From fc = 1/(2 x pi x R x C), we get R = 24,114 with C = 33 nF. Use 22 K and 33 nF.

So your current sense circuit is:


simulate this circuit – Schematic created using CircuitLab

Your digital filter in software is a subject in itself. You can either look up a proper filter algorithm in a suitable text or slap together a rough'n'ready thing to have a try. In the interests of a shorter post, I of course favour the latter. So try taking readings of the motor ADC at 1 ms intervals, maybe on a 1 ms interrupt. Keep a history buffer of the last 64 readings. Every 10 ms (to lighten the load on your CPU), add the last 64 readings together and divide that by 64. That gets you an average of the last 64 samples on 10 ms intervals. Use that to detect the motor overcurrent. (I'm sure someone will tear this to pieces mathematically but it sets up a starting point and a software framework for the OP to experiment from and learn.)

  • 2
    \$\begingroup\$ +1 from me, though I would add he needs to separate start-up current from hits-end stop current which will present as the same value. At start-up he needs to ignore the high current for a short delay, defined by his mechanical inertia, while the motor has time to react. \$\endgroup\$ – Trevor_G Apr 20 '17 at 21:39
  • 1
    \$\begingroup\$ @Trevor, spot on. I tend to outline a certain amount then expand the answer if the OP expresses interest in implementing it. Thanks for your comments :-) \$\endgroup\$ – TonyM Apr 20 '17 at 21:54
  • \$\begingroup\$ Thanks @TonyM: I like the first option, it is simpler for my level of understanding. What would be a suitable current-sense resistor for my 3v micro gearmotor running off a 3v Arduino Pro Mini. \$\endgroup\$ – Kashif Apr 22 '17 at 18:50
  • \$\begingroup\$ Hi @Kashif, what's your motor's typical running current, maximum running current and stall current? You can get stall from the motor's characteristics in the datasheet but you might want to measure typical and put a drag load on it to measure a sort of maximum. \$\endgroup\$ – TonyM Apr 22 '17 at 18:59
  • \$\begingroup\$ @TonyM: This is my motor. It is rated at 6v but I will be running it with my 3v (2xAA) power. Free-run current @ 6V: 40 mA, Stall current @ 6V: 360 mA \$\endgroup\$ – Kashif Apr 24 '17 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.