I'm back with a question on how to use diodes and capacitors on servos. I'm using the Arduino Due board to process sensor information and send out mapped degrees to servos. I learned to run the servos off of another power source than the Due. The problem I have with the servos is that when they receive a stream of sensor data they react normally for the most part, but there are still occasional drops in the servos.
The micro-servos I am using have the following specs:
Standard Voltage : DC5V +/- 1V
PWM Input Range : Pulse Cycle 20+-2ms, Positive Pulse 1~2ms
Speed : 60 degrees / 0.1s
Torgue : > 1KG/cm (Vcc=5V)
Max Corner : > 150 degrees
I have been advised to use a diode on each servo to prevent EMF from affecting the entire system which might be causing the occasional drops. I have also been advised to use capacitors for providing the servos with their sudden energy surges as they start up and go backwards. So the questions I have that I'm hoping someone can help answer are:
Do I install the diode on the 5V line to the servo? And what size should I use?
When I install a capacitor on the servo I have been advised to put it as close to the servo as possible and to have the capacitor stretch from the power line to the ground line. Is this true? I would think that a capacitor stores energy, so it should start and end on the servo's 5V line. And since capacitors are polarized how can it feed the servo when it's going from power to ground before the servo?
Any ideas of the capacitor size I should be using?
Lastly, I will be using 5 servos for my project. Does it make sense to use a large capacitor between the aggregated power lines and the common ground, or is it better to use small capacitors close to the servo?
Thanks for the quick feedback Grumpy_Mike. For the diode part I didn't mean accessing the motor itself, just putting the diode on the voltage in (red) line so that power doesn't kick back to create an EMF. And I'm not sure what size diode I should use.
I also forgot to ask about a draw down resistor. Supposedly if I use a resistor as a draw down to a servo the servo won't react when powering up. The servos I have now go a full 90 degrees when powered up, but then go to rest when connected between two Arduinos, a resting state that I wish to have when the servos are powered.
Thanks for the quick feedback Grumpy_Mike. For the diode part I didn't mean accessing the motor itself, just putting the diode on the voltage in (red) line so that power doesn't kick back to create an EMF. And I'm not sure what size diode I should use.
Again no diode required, the manufacture took care of it in it's internal circuitry.
I've not run across an instance of needing diodes and capacitors with servos. That is not your problem. The lines below in are what makes your servo move to the 90 position on startup. Not sure how to modify servo.h and servo.cpp to get rid of the setting a default value when the servos are attached. That being said, suddenly my servo sketches no longer control my servos, including the "sweep" sketch. Now to figure that out.
servo.h #define DEFAULT_PULSE_WIDTH 1500 // default pulse width when servo is attached
servo.cpp
servos[this->servoIndex].ticks = usToTicks(DEFAULT_PULSE_WIDTH); // store default values -
Interesting Zoomkat. I have the following instead of your definitions. And frankly I send discrete degree values instead of pulse width modulation durations, so I'm not sure I even need it:
int minPulse = 600; // minimum servo position, us (microseconds)
int maxPulse = 2400; // maximum servo position, us
This is normally used for relays and other such outputs. A servo uses a pulse position modulation so it doesn't really apply. However there might be some noise being picked up when the pins controlling the servo are a high impedance input so you could try a 4K7 pull down resistor.
Your advice on modifying the line on the servo.h file worked like a charm. I set it to the minimum value (I think it was 544 by default). Now the servos stay at 0 degrees when they are started and turned off. Thanks.