Powering servo and APM with USB

is it possible to power both apm and servos with a USB cable? I mean by connecting the apm board to the computer? I tried to control the servo but it seems like it doesn't work. Is it because of the lack of power supply by the USB? The followings are the code that i found on the web to control the servo.

Servo myservo;  // create servo object to control a servo 
                // a maximum of eight servo objects can be created 
 
int pos = 0;    // variable to store the servo position 
 
void setup() 

  myservo.attach(8);  // attaches the servo on pin 8 to the servo object 

 
 
void loop() 

  for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees 
  {                                  // in steps of 1 degree 
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
  for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees 
  {                                
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • No it is not possible to power the servos via USB.  The USB specification only provides about 1.5 Amp @ 5 V  which would be quickly cause a overload on the host computer when multiple servos are moving.

This reply was deleted.

Activity