Go Down

Topic: controlling 5 servos (Read 939 times) previous topic - next topic

nouh00

hi everyone,

i want to control 5 servos with an arduino uno.the way i want to have the motors controlled is if i hit enter on my computer then i want it to start sending codes to arduino to control the servos.so my question is does anyone have a code for 5 servos and how do i connect the servos to arduino.

retrolefty


hi everyone,

i want to control 5 servos with an arduino uno.the way i want to have the motors controlled is if i hit enter on my computer then i want it to start sending codes to arduino to control the servos.so my question is does anyone have a code for 5 servos and how do i connect the servos to arduino.


Well before you tackle how to control five servos, first you should come up with a plan on how you will be powering the 5 servos. An arduino board cannot power that many servos but will have no problem controlling all of them.

Lefty

zoomkat

You will need to find or write an application that can take keyboard keystrokes and send servo commands based on the keystrokes to the arduino.
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

nouh00



hi everyone,

i want to control 5 servos with an arduino uno.the way i want to have the motors controlled is if i hit enter on my computer then i want it to start sending codes to arduino to control the servos.so my question is does anyone have a code for 5 servos and how do i connect the servos to arduino.


Well before you tackle how to control five servos, first you should come up with a plan on how you will be powering the 5 servos. An arduino board cannot power that many servos but will have no problem controlling all of them.

Lefty


basically i will be using some batteries and a regulator to power the servos

JimboZA

#4
Dec 06, 2012, 05:45 am Last Edit: Dec 06, 2012, 06:09 am by JimboZA Reason: 1
Well here's some stuff which might start you off....

First have a look at this: http://arduino.cc/en/Tutorial/Sweep if you didn't already.

To have 5 servos (or should that be servoes? or servi? :) ) just repeat the Servo myservo; line with lines like Servo myservo3; etc and then have lines like myservo3.attach and myservo3.write.

Then have a look at the code below which shows how to read characters from your pc and act on what was keyed in. In this case I used the "h" and "H" to control an LED but that could be adapted to send writes to a particular servo. (It also echoes the received code back to the monitor so you can see it's reading the keystrokes correctly.)

Code: [Select]
char incomingByte;   // for incoming serial data

void setup() {
       Serial.begin(9600);     // opens serial port, sets data rate to 9600 bps
       pinMode(13,OUTPUT);
       digitalWrite(13, LOW);
}

void loop() {

       // send data only when you receive data:
       if (Serial.available() > 0) {
               // read the incoming byte:
               incomingByte = Serial.read();

               // say what you got:
               Serial.print("I received: ");
               Serial.println(incomingByte);
       }
       
        if (incomingByte == 'h' || incomingByte == 'H')
       {
         digitalWrite(13, HIGH);
       }
       else
       {
       digitalWrite(13, LOW);
       }
         
}


Thanks for the post.... it's given me some ideas for some servo stuff I want to do...
Arduino ethernet server here.... http://jimboza.gotdns.com:8085/

No PMs for help please

retrolefty

Quote
basically i will be using some batteries and a regulator to power the servos


And what current rating for the regulator is planned? A single 7805 type will not be enough for 5 servos.

Lefty

Go Up