10 years, 9 months ago.

servo motors pulse movement

i have (4) AAA battery interconnected to supply 6V to my servo motor, when i attached the (red wire) power and (black wire) ground to the servo motor,

motor moves a bit then stops, when i pull out the red wire and re-inserted, it moves a bit and then stops. it doesnt fully rotate which i expect it to be.

can someone guide me how to proceed.

2 Answers

10 years, 9 months ago.

Hi zild, can you post your code using the <<code>> <</code>> tags to try to help you?

Greetings

Hi ney, sorry for not including it earlier. this is my code.

#include "mbed.h"
#include "Servo.h"

 Servo myservo(p21);
 
 int main() {
     while(1) {
         for(int i=0; i<100; i++) {
             myservo = i/100.0;
             wait(0.1);
         }
         for(int i=100; i>0; i--) {
             myservo = i/100.0;
             wait(0.1);
         }
     }
 }
posted by zild murai 09 Jul 2013

Hi Zild, have you try the example code and see if it works (it controls the servo to move through its full range)?

// Hello World to sweep a servo through its full range

#include "mbed.h"
#include "Servo.h"

Servo myservo(p21);

int main() {    
    for(float p=0; p<1.0; p += 0.1) {
        myservo = p;
        wait(0.2);
    }
}

Greetings

posted by Ney Palma 09 Jul 2013

you can see my attached pic here (http://i39.tinypic.com/2sb64yh.png) im pretty sure that my battery works cause i have tested it prior attaching it to my servo.

i compiled the attached code you provided and uploaded it on my mbed, after restarting mbed, still no movement from servo.

i really cant figure out why it doesnt move, i have tried several programs/libraries regarding servo but i still dont get any action.

the only time i get response is when i re-insert my battery supply to servo, it just moves 1/4 of an inch. but its very very slight.

edit: btw im using GWS S35 STD http://www.pololu.com/catalog/product/948/specs

posted by zild murai 09 Jul 2013

Hi zild i see you are using 4AAA batteries is that right?? maybe the AAA batteries dont have the enough current to make the servo moves, well is my guess. Why dont you try with 4AA batteries instead. And check if your batteries arrangement is supplying 6v with the voltimeter.

PD: the batteries are rechargeable????

Greetings

posted by Ney Palma 09 Jul 2013

Hi ney, it turns out that i have to connect the battery ground to the breadboard. to use a "common ground" after doing so, servo motor worked smoothly. many thanks ney for providing insights.

posted by zild murai 11 Jul 2013

Well Zild is great that you solve your problem is you see the comment made by Ad van der Weiden you will see that he is suggesting just that (connect grounds)

Greetings

posted by Ney Palma 12 Jul 2013
10 years, 9 months ago.

Hi, a typical servo has three wires: 6V, GND and the pulse input which sets the position. This pulse is usually between 1 and 2 ms wide, with 1.5ms representing the center position. The repetition rate is typically 50Hz. Servo's have limited rotation angles, typically in the range 90 - 270 degrees, depending on the servo. They cannot fully rotate because they have a mechanical stop inside.

Hi, im sure that i have inserted the correct pins to my servo. what confuses me is, upon insertion of 6V pin, it rotates for about 1/4 of an inch only, then no movement. kindly refer to my code above i took from a servo library.

im unsure if my servo is defective or im doing something wrong.

posted by zild murai 09 Jul 2013

The picture was helpful, you have two power supplies, one for the mbed and one for the servo but these supplies do not share a common ground. Connect the black wire of the battery to the GND of the MBED

posted by Ad van der Weiden 09 Jul 2013