How to stall a motor

How do we intentionally stall a motor and detect that the motor has stalled? For example, we want to be able to move an arm or a forklift to its highest or lowest position… In FLL, we’d do that by applying power to a motor until its RPM reached zero. Does this paradigm exist in Code Blocks?

you can use a:
if…motor position=(degrees)…then_
ex. if leftMotor position=900 degrees, then stop leftMotor

Um, not to be nitpicky or anything, but its stopping a motor, not stalling it.
In order to stall a motor, just apply so much load it cant move lol

2 Likes

Yes, I know I probably got my terms mixed up. After some trial and error, I came up with this:
image

Do I run the risk of permanently damaging the motor? Is there a better way of doing this?

2 Likes

Like this maybe:
43 PM
customize this to your own robot

There is a distinct difference. OP is wanting to run the motor until it is stalled, often used as a way of detecting a physical limit.

6 Likes

You should be good, ideally you would reduce current (torque) on the motor when running this code, I forget if you can do that in blocks or not, but if you don’t keep sending power for too long when it is physically stalled it will be ok.

5 Likes

Reduce the torque before or after a stall has been detected?

You could also see if the current on the motor “spikes”, indicating a stall condition. It’s not a 100% full-proof (i.e. if you’re carrying something heavy) but it can work for lightly loaded motors.

This example runs the “wait until current spikes” condition, but also runs a “print the current value to the screen” to help debug it as well.

7 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.