Shaking servo motor

Hi!
We have this project for university of making a robot arm and we decided to use arduino and servo motors to execute it. It's the first time I'm using arduino and building electronic circuts of any kind, but I've done some time in C++, so we decided it'll be doable.

The thing is we got our components a few days ago and I tried setting everything up but I encountered a weird problem. I tried controlling a servo with a potentiometer and it "shakes" and makes sounds like those remote controlled cars when they start running out of battery. The code is pretty simple for it:

#include <Servo.h>

Servo servo;
 int val;

void setup() {
  servo.attach(10);
}

void loop() {
  val = analogRead(A0);
  val = map (val, 0, 1023, 60, 145);

  servo.write(val);
  delay(15);
}

As a photo below, I'm attatching the scheme for my project. I'm sorry in advance for what you gonna see there but I couldn't find any site to make it properly (I'll take recommendations :slight_smile: )... I hope it's readable.

I'm also uploading a short video exposing what is the problem with my servo.

I've added a led to the circut that also starts blinking when the shaking is happening. I measured a voltage at the ends of a servo's VCC and GROUND wires and it showed about 5.12V when it doesn't move, then it drops to about 4.6-4.7 while working properly and when it starts shaking it drops dramatically to even 2.6-2.7V. I tried connecting a capacitor as people on the internet were suggesting but it didn't help.
Maybe it's worth adding that it happens mainly when I turn my potentiometr to the left.
I was considering a power source to be instable, can that be it? Would trying a new power supply help?

1 Like

You got the clue! Your issue is with power.

The servo, if it's a plastic geared servo can consume up to 800mA. Metal geared servos want an AMP, typically.

Do you know how much power can flow through a breadboard? A rough answer is not much.

It looks like you are using is a metal geared servo, which would mean you want to allocate 1 Amp of current to the servo.

A direct connection of power to servo, not through the breadboard, is in order.

Oh, good job on posting good starting info.

Is that a 9V smoke alarm battery (PP3) powering the servo? If so, that very likely may be the problem. Not only is 9V too much voltage for a servo, those batteries can not supply very much current. When you try to pull too much current the voltage will drop, like you are seeing. A 4 AA cell battery pack is a better supply for a servo.

PP3 batteries should have a warning on them, "Do not use for Arduino projects".

This tutorial is a starting point on how to draw a good schematic.

It is actually something like this, powered with 4x LR6/1.5V

OK, my mistake. I could not see but the top bit and it looked like a 9V.

That certainly points to a power problem. Whenever a motor starts to move it will draw the "stall current". That current can be 10, or more, times the running current. So when it is shaking it is repeatedly drawing stall current. If the power supply can't handle that current or if there is resistance in the power path (ie. bad breadboard contacts) the voltage at the motor will be drawn down like you see.

How can I solve this? Connecting it directly to the power supply worked but I have another servo that has a higher torque so I suspect it requires higher current. What kind of power supply should I get to make it work properly? The servo I'm struggling with rn is LF-20MG?

I tried connecting it directly to the power supply as you suggested and it worked! Thanks so much! Unfortunately there is a but... I have another servo that has a higher torque than the one I showed on a video and when I connect it to the power supply directly the problem remains... Should I get another power supply to make it work? If so, what exactly should I go for?

Your supply shouldn’t dip below 6v.

What voltage does the servo data sheet say to use ?

Feed the potentiometer with the 5v from the Arduino.

Many small hobby servos should be powered by a supply that can provide 2-3A or more.

Most will run fine at 5VDC

  • Feed the potentiometer with the 5v from the Arduino.

So how can I prevent the current from dropping? Is there some way of power supplying a servo that can provide me the stability?

Buy a power supply that can produce 3A of current @ 5v.

I built my own servo development board.

The board has plug-in spots for 2 metal geared servos. Jumpers are used to configure the power. Each individual servo has a 5V 1.5 amp LDO regulator available for power. Each regulator output has a large electrolyte capacitor for those surge moments. There are connection points to the MCU and connectors for the individual servos. It's one of the handiest tools in my tool collection.

My recommendation is to build or find a servo development board that you can use for prototyping.

If you have 4 x LR6 cells in series and you're only measuring 5.12V then either your battery is flat or you have some high resistance connections somewhere. A new alkaline LR6 will measure at least 1.5V, more normally around 1.6V.

You would do better with 4 x AA rechargeable NiMH cells (Eneloops or similar). They can provide much more current than standard AA cells even though they are slightly lower voltage.

Steve

Those ubiquitous cheap plastic battery holders cannot handle high currents, as they do not have welded connections between the springs and contacts, they are merely riveted - not reliable for high current operation in my experience. This could be an issue here (although I'd check the cell voltages are holding up first, they might be overloaded)