Shop OBEX P1 Docs P2 Docs Learn Events
How to detect motor stall? — Parallax Forums

How to detect motor stall?

modemmanmodemman Posts: 41
edited 2010-12-06 15:24 in Robotics
Is there any simple way to detect motor stall? I have a tracked robot running on two 12v geared motors, with no encoders. I drive the motors via the L6205 based H-Bridge on the MSR1 Propeller board. Basically I want to sense when my robot's obstacle avoidance system misses an obstacle and the robot gets stuck in a piece of furniture while the motors are still issued a "go forward" command. I want to prevent motor stalling, overheating, battery drain, circuit shutdown, etc... Also, does the MSR1 provide stall protection? I assume since it has thermal protection, it will just shut down, right? I'd test it, but the board costs 100 bucks, I'd rather ask here :)

EDIT: Sorry guys, just saw this: http://forums.parallax.com/showthread.php?108495-Stall-Sensors-anyone in the "Similar Threads" section. However, when I did a forum search (I always try that before asking...) for the word "stall", I didn't get any hits.

EDIT2: Oh yeah, plenty of hits now... Is it possible I was searching while the new forum was indexing, etc...? BTW, love the new look.

Comments

  • ercoerco Posts: 20,256
    edited 2010-12-03 09:29
    The long and expensive workaround is to install a smoke detector on each motor. :)
  • modemmanmodemman Posts: 41
    edited 2010-12-03 10:36
    YES!!!! :):)

    PS. I'm reading an older thread of yours on using optical mice to track motion http://forums.parallax.com/showthread.php?119032-Optical-Mouse-for-Robot-Odometry&highlight=optical+mouse
  • LeonLeon Posts: 7,620
    edited 2010-12-03 17:35
    Put a suitable resistor in series with it and measure the current with an ADC.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-12-03 19:22
    The easiest way to measure motor current is in the "ground" side of the H-bridge. And the L6205 does provide SENSE pins for this. But, for some inexplicable reason, these are permanently grounded on the MSR1 board, rather than being jumpered so sense resistors could be employed. Unfortunately, the way the board is laid out, there's no easy way to break this connection to add the necessary sense resistors.

    -Phil
  • ercoerco Posts: 20,256
    edited 2010-12-03 19:29
    Resistor & ADC is the right way, no doubt about it.

    BUT... if I may offer a quick & dirty solution, it's to use the Stamp's 1.4V transition from reading low to high on an input pin. It's a voltage level check that can be used as aone-step ADC without any extra hardware. Doesn't always fit the situation, but it's sweet when it does. All you care about is a digital YES/NO stall sensor, which will draw a certain higher current. IF you can afford a higher value resistor in series with your motor (which will slow it down somewhat) that will yield a voltage drop of 1.4 volts or more at your stall current, then feed that voltage into a Stamp pin. Reading low, motor not stalled. Reading high, motor is stalled.

    Might work for you; it interferes less with higher motor voltages where you won't miss a ~1 volt drop across the series resistor under normal conditions.
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2010-12-04 21:06
    I agree with Phil ... "The easiest way to measure motor current is in the "ground" side of the H-bridge" ... but you could also do it from the supply side without too much headache. A simple Op-Amp, or a dual input ADC configured in a differential mode would work. The caveat is that you would be monitoring the overall current for 'everything' in the system. The current draw from the motors would most likely dominate the current draw from anything else in the system though.

    "But, for some inexplicable reason, these are permanently grounded on the MSR1 board, rather than being jumpered so sense resistors could be employed." - Again I agree, This was probably to reduce the part count, although in reality it was just a simple oversight with the thought that it's good practice to use a wheel encoder and a current sense resistor wasn't necessary in such a case. Perhaps an oversight, but since I was not involved in the design process review with this product, it's hard to say.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-12-04 22:07
    During the early phases of the S2 design, there was much discussion about stall detection. I was of the opinion that motor current detection, in combination with the wheel encoders, would be adequate to determine a stall condition. Ben Wirz, the project's hardware guru, pointed out -- rightly, as it turns out -- that in many "stall" situations, the drive wheels are simply spinning in place on a slick surface as the robot struggles against an obstacle. In such a case, neither the motor current nor the wheel encoders yield sufficient clues about a stall condition.

    As a consequence, it was decided to add an encoder to the idler wheel. Even with the drive wheels turning, the idler will be stationary if the 'bot isn't moving. However, since the idler on the S2 is not gimbaled, it will also not rotate when the 'bot is turning in place. As a consequence, the S2's stall detection algorithm has to consider a number of factors in coming up with a stall/no-stall decision.

    -Phil
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-12-04 23:01
    In cases where there is no way to break the motor Vdd or Vss to install a sense resistor, this circuit might (i.e. I've not tested it) work:

    attachment.php?attachmentid=76100&d=1291531903

    The CD4070 should be powered from the motor supply (assuming it's < 15V). Rsense should be equal to 0.6V / Istall, or thereabouts. A stall is detected when A is high and C < Motor Vdd - 0.6V or A is low and C > 0.6V. In either case, the inputs to the XOR gate will be different, and its output will go high (to motor Vdd). A high-value series resistor on its output (greater than [motor Vdd - 3.9V] / 500 uA) protects the Prop input.

    Also, when A and B are floating (i.e. the motor is unpowered), the stall output will be high, due to both transistor bases being forward biased through their resistors.

    -Phil
    574 x 387 - 3K
  • modemmanmodemman Posts: 41
    edited 2010-12-06 15:24
    Thanks guys.

    Phil, I was just about to ask about the S2, I noticed it has a stall detector - question answered!!

    I tried something pretty dumb, but at the time I was doing it it sounded very exciting: My bot runs on tank tracks and is very 'noisy', there's a lot of vibration, I figured I can read an accelerometer and if I notice that there are no 'g' variations being tracked, but the motors are commanded to spin, then there is a stall. However, I couldn't get accurate readings and filtering all that data is too insane for a basic "stall sensor".

    I'll try to get the resistor method working...
Sign In or Register to comment.