How do you detect if a motor stalls

I have an if statement where I want it so if the motor stalls then I do something. The slight problem I have is that there isn’t an encoder on the motor. Is there any way to detect if the motor stalls another way without using encoders.

Theoretically you can use the current of the motor to recognize when it stalls. If you hook up the CAN to the PDB it tells you the current going through every port. The current will spike when it goes to stall and you can do something with that information.

To start, it would help to know what language you are programming in, C++, Java, Labview etc?

Although we have not implemented it yet, we have been thinking about implementing current limiting. The way we were thinking about doing this is monitoring the current draw of our motor (find the port the motor is plugged into on the PDP and monitor that one). From here in your IF statement, you would say if the motor current is above value X, perform action XYZ.

We are using java

You might want to consider filtering the instantaneous current with a simple IIR filter of current squared. After all, that would likely correlate more closely with motor smoke than instantaneous current.

Were you thinking something like this?

// declarations
static double i2_filt = 0;
constant filt_ramp = 0.1; /* smaller numbers average over a longer period of time */

// in periodic
i2_filt = (1-filt_ramp) * i2_filt + filt_ramp * i_meas * i_meas;

Under a steady current draw, this would approach the current squared, with a decay time approximately equal to the periodic interval divided by the filter ramp value.

It is pretty easy to write a PercentStall Function.

MotorVoltage = DutyCycle * BatteryVoltage
MotorStallCurrent = MotorStallCurrent12Volt * (MotorVoltage/12.0)
PercentStall = MotorCurrent * MotorStallCurrent

MotorCurrent is available via the WPILib PDP object.

Dr. Joe J.

I think you mean:

PercentStall = MotorCurrent / MotorStallCurrent

Yes. Something like that.

We use the SRX’s current monitoring, and don’t use a filter. It works almost flawlessly. The SRX may have a filter built-in.