weird phenomena...

hey guys, I need some advice here:

I connect several servos to my arduino, as follows: the arduino powers through a 9V battery (using the power jack), and the servos power through a 5V (3Amp) external power supply. all gorunds connected together.

the project runs nicely for a while, and then the servos halt.. when I touch any wire leading to any particular servo with my bare finger - it suddenly goes back to life! (for a while). this is not due to any loose connections, as it doesn't happen when I touch the wires with some stick.

I guess it has something to do with static charges that were built somewhere. sounds familiar to anybody ? any suggestions?

thanks in advance, Rubin

It sounds like you are not setting the output pins to be outputs in the setup() section of the sketch. And you are switching things by enabling and disabling the internal pull up resistor. As such you never get a decent ground and the output floats. Your fingers bring it back to ground.

It sounds like you are not setting the output pins to be outputs in the setup() section of the sketch. And you are switching things by enabling and disabling the internal pull up resistor. As such you never get a decent ground and the output floats. Your fingers bring it back to ground.

Wow, This is like CSI. I never would have thought of that! :stuck_out_tongue:

Sounds like it’s right though ;D!

thanks!

I thought that the myservo.Attach(x) command using the Servo.h library takes care of that for me...

would you also recommend installing any capacitors on the servos or directly over the power source leads ?

The Servo library does set the pinMode for all attached pins so there is no need to do this in setup.

Capacitors on the servo power rails are highly recommended. Mike has a detailed tutorial covering power supplies and decoupling on his site: http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html