Open top menu
Running 6 servos on Arduino

Running 6 servos on Arduino

Some time ago I ordered 6 cheap miniservos just for ‘just in case’. Then a bit later I ordered the Torobot 32 channel servo controller.

Now, I actually found some time to assemble the parts together. After some googling and starting up my Arduino, it started to come to life.

It’s actually pretty straight forward; hook up the Arduino to your USB, connect an external power supply. Then connect the TX to the RX on the servoboard. Connect the powersupply, gnd and a powersupply needed for the servos.

Explanation for the letters in the picture:

A: This is the incoming external powersupply connected to the VSS of the servo board. This powers the logic on the board.
B: The GND that is needed for both boards.
C: This is, for now, the powersupply for the actual servos on the servoboard. This actually has to be a proper powerful enough powersupply instead of taking it of the Arduino board. But for test purposes and thus not expecting to much of the servos, this will do fine.
D: stands for DATA, without this TX to RX on the servo board, nothing will happen. It transports the serial data from the Arduino to the servoboard.

Project23ServoLetters

Then program the Arduino with this:

void setup() {
Serial.begin(9600);
}

void loop() {
move(1, 1400, 100);
move(1, 750, 100);
move(2, 1400, 100);
move(2, 750, 100);
move(3, 1400, 100);
move(3, 750, 100);
move(4, 1400, 100);
move(4, 750, 100);
move(5, 1400, 100);
move(5, 750, 100);
move(6, 1400, 100);
move(6, 750, 100);
moveall(1,2,3,1400,100);
moveall(1,2,3,700,700);
moveall(4,5,6,1400,700);
moveall(4,5,6,700,100);
}

void move(int servo, int position, int time) {
Serial.print("#");
Serial.print(servo);
Serial.print("P");
Serial.print(position);
Serial.print("T");
Serial.println(time);
delay(time);
}

void moveall(int servo1, int servo2, int servo3,int position,int time) {
Serial.print("#");
Serial.print(servo1);
Serial.print("P");
Serial.print(position);
Serial.print("#");
Serial.print(servo2);
Serial.print("P");
Serial.print(position);
Serial.print("#");
Serial.print(servo3);
Serial.print("P");
Serial.print(position);
Serial.print("T");
Serial.println(time);
delay(time);
}

And your all set! It demonstrates the 6 servos moving one at a time and then 2 times in sets of 3.

If you want to read a manual for this board, go here. I’m a mac user so the supplied example programs are useless to me. That’s fine with me, because I’ll probably be using this board for something┬áthat doesn’t need a computer anyway. More on that perhaps later.

Enjoy!

3522 Total views: 1 Views Today