Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Having trouble getting a servo to do anything with the Wixel


#1

I have a very peculiar problem getting a servo to work with the Wixel. The test program I am using for this is shown below. In running this program, the servo by itself never moves. However, when I touch any kind of ground (including my hand) to the jumper wire terminals powering the servo, it begins to move, just not in the way it should. In endlessly turns one direction and at the same speed, no matter how I change the program. I have tried modifying the servo targets, speed, and even changing pins, but nothing changes anything. Here is the code I am working with. If someone could help me get the servo working properly, that would be great.

#include <wixel.h>
#include <usb.h>
#include <usb_com.h>
#include <servo.h>

uint8 CODE pins[] = {11};  // Use P1_1 for servos.

void updateLeds()
{
	usbShowStatusWithGreenLed();
}

void myServosInit()
{
	servosStart((uint8 XDATA *)pins, sizeof(pins));
	servoSetSpeed(0, 10);
}

void updateServos()
{
    if (getMs() >> 11 & 1)
    {
        // For 2048 ms, the code in this block will be called.
        // Then for the next 2048 ms, the code in the "else" block will be called.
        // The pattern repeats every 4096 ms.

        servoSetTarget(0, 1000);
        LED_YELLOW(0);
    }
    else
    {
        servoSetTarget(0, 1500);
        LED_YELLOW(1);
    }
}


void main()
{
    systemInit();
    usbInit();
    myServosInit();

    while(1)
    {
    	updateLeds();
    	boardService();
        usbComService();
        updateServos();
    }
}

EDIT: I forgot to mention, the servo I am using is Pololu’s own “Sub-Micro Servo 3.7g (Generic)”.


#2

How are you powering the servo?
Post a diagram or clear photo showing all your wiring.


#3

Here’s a picture I drew up. I also tried the circuit without the switch, and got the same results. I know the program should be working because the yellow LED toggles every 2 seconds, as it should. At this point I’m assuming its a faulty servo.


#4

Your drawing suggests that the servo and Wixel grounds are not connected together, as required.


#5

I did as you said and wired the servo power through the ground of the Wixel before returning to the battery. Here is the updated picture of my wiring. I got the same problem as before, except that the servo spins endlessly without manually grounding the terminals of the jumper wires.


#6

Hello.

In your first post, you mentioned using our servo (Sub-Micro Servo 3.7g (Generic)), which is not a continuous rotation servo. If that servo is spinning continuously in one direction, then the physical end stops are probably broken and the servo is likely damaged beyond repair.

Did you test the servo to see if it was working before using it with the Wixel?

- Amanda