Go Down

Topic: SERVO+ARDUINO HELP (Read 867 times) previous topic - next topic


I don't understand why my robotic arm is not working. If anyone can tell me why, based on the description below, before three o'clock pm, I would appreciate it.
I have:
-four servos (3 are HS422s, one is the "medium servo" from Sparkfun) connected to an Arduino; one with signal to pin 6, one to pin 9, one to pin 10, and one to 11
-each of the servo's are in parallel to the power source (which is the 5 volt breadboard power supply from Sparkfun)
-four 10K pots (2 are in a joystick config, however) connected to Arduino; one on analog pin 0, one on 1, one on 2 and one on 3
-the grounds are connected
-the Arduino is powered via USB, the rest via the power supply

Arduino is running this code:
Code: [Select]
#include <Servo.h>

Servo sm1; 
Servo sm2; 
Servo sm3; 
Servo sm4; 

int pot1 = 0; 
int pot2 = 1;
int pot3 = 2;
int pot4 = 3;

int val1;
int val2;
int val3;
int val4;

void setup() {

void loop() {
  val1 = analogRead(pot1);
  val2 = analogRead(pot2);
  val3 = analogRead(pot3);
  val4 = analogRead(pot4);
  val1 = map(val1, 0, 1023, 0, 179);   
  val2 = map(val2, 0, 1023, 0, 179);
  val3 = map(val3, 0, 1023, 0, 179);
  val4 = map(val4, 0, 1023, 0, 179);

The motors dont respond at all until I unplug one or two, and then they jerk around and go crazy. Please help me!


The software looks fine so it must be hardware.

Are you sure you have the power and signals wires identified correctly?

Can you put a meter on the power supply to make sure the power supply is up to the task?
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp


The SparkFun power supply is rated at a MAX of 1.5A - a good rule of thumb is that each servo will require between 0.5A and 1A, so you're definitely either exceeding the limit or cutting it real close.  This is quite possibly the cause of your problem.  Are you able to get each servo to work individually?  (as in, running with the sweep code example with the other servos disconnected)


I second the thought to run the sweep tutorial on each individual servo.
Preferably with it removed/disconnected from the arm to remove load.


Don't give the bugs dark corners to hide in.
Code: [Select]
#include <Servo.h>
const int SERVOS = 4;
const int servoPin [SERVOS] = {6, 9, 10, 11};
const int potPin [SERVOS] = {0, 1, 2, 3};
Servo sm [SERVOS]; 

void setup()
  for (int i = 0; i < SERVOS; ++i) {
    sm [i].attach(servoPin [i]); 

void loop()
  for (int i = 0; i < SERVOS; ++i) {
   int val = analogRead(potPin [i]);
   val = map(val, 0, 1023, 0, 179);   
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

Go Up