Servo control using MegaServo library

Hello,

I control two servos using the MegaServo library. The library works excellent only the servos jiggle a little bit from left to right. you can constantly hear (clicking noise) them move just a little bit.

I've connected the servos to digital pin 24 and 25 of my Arduino Mega.

Does anyone also has got this experience and maybe a solution?

Thanks in advance.

How are you powering the servos?

Best to use a separate power supply.

I use an external power device to power the servos. I control the servos using a SNES game pad.

When the buttons are pressed the servos respond correctly. But when the game pad is idle (no buttons are pressed) the servos move a little bit (jiggle). The servos move from left to right and back over a very small area.

I want to connect a camera to the servos, because of this moving it is difficult to create still images.
In idle mode no commands are send to the arduino so I have no idea what this "moving" can be?

Best regards,

OpenSource

Just a additional remark.

The ground of the Arduino Mega and the ground of the external power supply are connected (common ground).

Cheers :slight_smile:

anyone?

It would help to track down the problem if you can run at test to see if it's a hardware or software problem.

Try connecting the servos to pins 11 and 12 on the mega (keep all other wiring and power supply connections the same) and run a test using the standard Arduino servo library. If the problem does not go away then it may be an issue with the power supply (perhaps electrical noise produced by the servo that will require a decoupling capacitor). If the problem does go away we can look to see if its caused by the software.

Another thing may be if the servos are old or used in a model, the feedback pot track may be dirty.

I've tried the servo library that's included in the Arduino software already but somehow I can't get it to work.

See:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1240258842/0#0

But I will test it again :slight_smile:

The servos are brand new so dirty potentiometers are not possible.

did you add a risistor to the input pins ? check the learning section pushbutton wiring

No I did not add a resistor. Why should I? The servo itself builds up much resistance. Or is this not enough?

I think kenwaldek is asking if you used pull-up or pull-down resistors on the switches in the test sketch. You don't need resistors on the pins connecting servos

No I have not.

Probably a stupid question:

What is the use of a pull-up / pull-down resistor?

I the use of a pull-up / pull-down resistor is usefull, how do I implent this in my project?

Thanks in advance.

There are many tutorials that cover the need for a resistor when connecting switches to input pins. here is one: http://arduino.cc/en/Tutorial/DigitalPins

Ok I am about to continue solving this problem (I know its been a while :))

I've heard a few options:

  1. Add a decoupling capacitor.
  2. Add a pull up/down resistor.

What will be the best option a combination of both or just one (decoupling of pull up/down)?

How do I connect a decoupling capacitor? Just between the digital pin and the servo? And what value should this capacitor be (uF)?

When using a pull up/down resistor, does it matter which one? Is there for example a special purpose for a pull up resistor as well for a pull down resistor? Or just use a pull up or a pull down resistor? (same purpose, just a different connection)?

I'll keep u informed

Thanks in advance.

Pull-up and pull-down resistors serve the same purpose and both are equally effective, choose whichever you find easier or more intuitive. Try it with just the resistor, you may not need to use decoupling capacitors.

I've tried a 10 K pull down resistor but this does not solve the problem?

Maybe a capacitor will help? If yes, what value?

0.1uf ceramic capacitors on power lines is probably the first thing to try. There is a detailed article on decoupling here: De-coupling

But best if you can post a photo of your setup showing the wiring and power supply. A video showing the symptoms would also help.

Little movie :slight_smile:

This movie clip is made when the servos are Idle. As yo can see they move from left to right just a little bit.

I can't figure out what it can be. The servo uses a external power supply with a common ground (ext power supply + Arduino Mega).

When I use my SNES pad to control the servo everything works fine. But once again in idle mode it sarts to move out of its own.

Best regards.

Update:

This is maybe important to report. On the same power supply are also two small motors.

Motors: Micro Metal Gearmotor 30:1 - ROB-08911 - SparkFun Electronics

Driver: SparkFun Motor Driver - Dual TB6612FNG (1A) - ROB-14451 - SparkFun Electronics

The motors are directly connected to the driver (no extra capacitors or resistors, I don't know if this is necessary?)

Also when the motors are idle and the servos are idle the moving of the servos occurs.

Not sure if your saying the problem only occurs or only stops when the motors are idle. Try a test with just the servos wired up (the motors completely disconnected) and with short wires to the power and servos.

No the problem occurs when the motors are idle and when they are running.

I've also seen this documentation on the Pololu site (motors manufacturer):

I will test if the motors are the problem, I think the are.

Maybe soldering two capacitors on the motor and twisting the wires reduce the problem (see link).

Thanks for all the help so far, I really appreciate it :).

Cheers