DC motor stall/over current protection

I am going build an RC lawn mower. I hate mowing the lawn and I hope I can out-source the job to my children. At the first they will control the lawn mower using a wireless PS2 controller. It may some day evolve into a drone (controlled from a computer through a WiFi/webcam link) and perhaps later into an autonomous robot.

It will have three 24V/240W DC motors in it, two for the differential drive and one for spinning the blade. It is quite possible that the motors will stall, for example when the blade hits dirt/a rock or if the children drive it against a tree. The motors are probably a bit overkill for the differential drive, but they were cheap and easily available.

I have already bough two cheap motor controllers (YK31) for the differential drive. They are similar to the popular YK40 controllers that are common in Chinese electric scooters. I first thought that they must have some kind of over current protection built in, but I have found almost no specs of the controller so I cant check it out. After a bit more googling, I now guess that they don't have over current protection built in. I found out e.g. that they warn against riding up too steep hills and that the scooters may have separate circuit breakers.

I have thought of different alternatives for the stall/over current protection:

  1. Ciruit brakers
  2. Easy to implement
  3. Needs to be manually reseted after a circuit breaker has tripped.

  4. Current monitoring and over current protection implemented in Arduino.

  5. Can be automatic/remote controlled

  6. DC currents sensors (e.g. hall effect) are bit a expensive

  7. shunt resistors (alternative for hall sensors) are a bit tricky because they typically work on 1mV/A level and it is difficult to measure such low voltages using Arduino.

  8. The current that the controllers feeds to the motors is 25kHz PWM. (I checked it out using an oscilloscope). That makes measuring the effective current using Arduino a bit tricky, at least when Arduino has also other tasks to take care of.

  9. Comparing the motor speed with the output voltage, e.g., if the average voltage over some specified time (a few seconds perhaps) is over some limit while the encoder shows zero speed, we can assume that the motor has stalled.

  10. easy to implement, needs little (or none) extra hardware

  11. doesn't measure the current directly. But if I know the nominal stall current and the duty cycle, I can estimate the effective stall current, can't I?

What do you think of the alternatives I presented? Do you come up with better ideas?

As you just want to know whether the current is over some limit, you could use a shunt resistor and a comparator for each motor. The comparator output can be read through a digital input pin. The current may fluctuate a little because of the PWM, although the motor inductance is likely to smooth that out if you measure motor current rather than current to the controller. If fluctuating motor current is still a problem, you can use an RC circuit on the comparator output to smooth it.

If you choose a shunt resistance of about 10 millohms, it will drop 100mV at the 10A rated motor current, which is sufficiently large that the 5mV maximum offset of a LM339 quad comparator doesn't introduce too much error.

[EDIT: if the controller is like the YK40 then it may be that neither side of the motor output is near ground potential. If this is the case, you could still use a shunt resistor and comparator, but you would need to drive the comparator from a separate supply - perhaps derived from the motor input via a rectifier and voltage limiter - and use an opto isolator to pass the signal to the Arduino. If the controllor supports reversing the motor, it gets worse because you really want 2 comparators per motor.]

Thanks, the comparator approach didn't cross my mind because I have never used them. The controller doesn't have reverse. I built a relay h-brigde between the motor and the controller. It wouldn't even be necessary to pass the comparator output to the Arduino, but I could pass it to the controller's brake signal instead. Though I probably want to pass the info to the Arduino anyway.

One problem crossed my mind. If neither side of the controller's output is in the ground level, then where do I get the comparator's reference voltage from? [Edit: I guess I should put the comparator to the controller's input side. Low pass filter is a lesser problem.]

You'd have to generate a local reference using a zener diode or similar. I think you should use Hall effect current sensors, which would be a much simpler solution as they provide the isolation you need and their outputs can be read directly by an Arduino analog input. Prices are around GBP5 + tax each here, which equates to about EUR 6 or USD 8.

I already have a couple of hall sensors I bought for an other project, but didn't use them. The problem is that the PWM frequency is quite high (25kHz) and I need to measure the current several times within one cycle to get a good estimate (unless I can trust that inductance smooths it enough). I still think that your original suggestion, i.e., a shunt resistor/comparator/low pass filter, but on the input side (between the controller and the battery) may be a good idea. Then I could get an accurate reference voltage easily from the Arduino's +5V using a voltage divider.

I think that at a PWM frequency of 25KHz the current will be very smooth - the motor inductance will see to that. You could always smooth the output of the Hall effect sensor if necessary.

If you do decide to measure the input current instead using a shunt resistor, bear in mind that the average current in the motor will be close to the peak input current.

1KW motor for blade is bare minimum.

I know that 250 watts won't cut long/thick crass, but there are several commercial battery powered and robot lawn mowers that work with even less.

Now when you said it, filtering the output of the hall sensor (if needed) sound obvious. Damn, why didn't I realize it myself.

We shall see who was right at some point ;) As for current monitoring then use shunt + smth like this : http://www.diodes.com/datasheets/ZXCT1081.pdf (this manufacturer has better stuff for your purpose, i just copied link from 1'st thing i found + it's cheap) then feed it's output to arduino. Basically it's voltage amplifier, if there is voltage drop 100mV on shunt it will output 1V (depending on model) to arduino.

Motors usually die because they overheat. Try using a thermistor mounted on the motor to measure its temperature.

pekkaa: I already have a couple of hall sensors I bought for an other project, but didn't use them. The problem is that the PWM frequency is quite high (25kHz) and I need to measure the current several times within one cycle to get a good estimate (unless I can trust that inductance smooths it enough).

The inductance smooths it. Be sure to measure motor current, not supply current which is very choppy. Anyway you only care about the maximum reading its not that vital.

Very nearly four years late, boys.