Electronic – arduino – Will this servo stall detection circuit damage an Arduino

arduinomicrocontrollermotorservo

I am part of a group building a project for school that involves a servo. We made a circuit for our Arduino to detect when the servo is under heavy load / stalling. The circuit we built detects stalls quite well, but we aren't sure about circuit damage.

We know there are other "stall detection" circuits on the web. However, we wanted a generic form of detection that can be accomplished with a method that:

  • Uses common components we would have lying around (resistors, caps, diodes)
  • Needs no heavy-power-rated "shunt" resistors
  • Needs no ICs
  • Doesn't reduce the output of the servo

Here is what we have:
Servo Stall Detection Circuit

The servo PS (V1) has it's + line going through a 75KΩ resistor, and then to an analog input pin on the Arduino (A0), with a 0.1μF ceramic cap going to ground, and a Schottky diode from ground to A0.

When the servo is moving without additional load, the current was measured at about 100mA. Under heavy load, it draws about 300mA. A complete stall is about 500mA.

When the servo is under low load, the analog pin reads 1023 out of 1023, with a small amount of bounce down to around 900. If the servo is under a heavy load, the bouncing is strong. Under a complete stall, the analog reading stays around 850 with little bounce. Obviously those readings weren't difficult to use for stall detection.

As for protecting the components, I am not very familiar with flyback or EMF. I was not able to find anything about them in relation to servos, only regular motors, almost as if people aren't worried about servos. It appears some people believe the internal circuitry of servos protects from flyback/EMF…?
The diode was added for flyback protection, but I don't know if it really helps in that setup.

We are also not sure how a servo is supposed to act in relation to resistance and voltage drop under load. The stall detection was put "before" the servo in the circuit so as to avoid reducing the power of the servo by having a resistor in series with it, and to avoid having to order a heavy-power-rated shunt resistor. I can't personally say why this detection works, but it does.

Regardless, can we continue using this circuit as-is, or do we run a large risk of damaging the Arduino? If the circuit needs modification for safety, what would be a minimal way of doing so with common components?

Best Answer

No, you are not likely to damage your Arduino with this setup. In fact, the diode is probably unnecessary, because the R-C filter severely limits any transients to begin with. The resistor alone limits the current through the pin to no more than 1 mA for any sustained voltage in the range of ±75 V.

The bigger problem is that this whole scheme relies on the fact that the V1 source has some definite value of source impedance, and you're measuring the voltage drop across this impedance in order to infer the current being drawn by the servo. If you were to change to a different source (higher current capacity, lower source impedance), the whole thing could stop working.

That's why most published schemes use an explicit current-sensing resistor — to remove that dependency and insure that the circuit works with any source. If you're really concerned about the power lost across such a resistor, you could use a Hall-effect current sensor instead. There are several commercial devices available for this.