-1

i have amg996r servo and an arduino mega. when i am running the sweep example from the arduino servo library the servo is moving almost randomly, looks like it moves toward the desired position and before reaching moving back to 0 degrees(altough it not always keeps this pattern, sometimes it is random).

my circuit is an external 5v power supply connected to arduino ground and the servo positive and ground and the servo pwm pin to arduino pin 9. do you have any idea why is this hapenning?

guy
  • 40
  • 7

2 Answers2

0

Your explanation of the circuit is not particularly enlightening. I would suspect that one reason for your problems is that the servo input pin requires more current than an arduino pin can source. This is one of the reasons why motor driver boards (shields) are usually used.

Alphonsos_Pangas
  • 514
  • 1
  • 3
  • 13
  • i actually tried that on the arduino due with a level converter which can output up to 130mA on any i/o pin and the same is happening.. – guy Apr 02 '16 at 10:55
0

Double check that you are waiting around 18-20 ms between pulses. Then check that your pulses are 1-2 ms. FInally, check you are generating the pulse duration accurately - many delay() isn't accurate. Use delayMicroseconds().

Playing with GAS
  • 565
  • 3
  • 10
  • 18