Spinning in circles

I searched the forum for this question, but didn't get a match, so I apologize if this has been asked before.
So I have twelve robots that have the same problem. One wheel works only part of the time and so the robots spin in a circle.

I've tried 1,000 things on the robot I'm working on right now, but it's still spinning in a circle and it's maddening. It is the left wheel that's not right.
Here's a list of things I've done:
1. Fresh batteries.
2. Traced the servo and encoder wires to their source and made sure they're well seated and plugged into the correct place ( P12, P13, etc.).
3. Made sure the VIN and 5V jumpers are in the correct configuration.
4. Ran the Test Encoder Connections program. It works perfectly.
5. Ran the Calibration program. The left wheel is wonky but works part of the time.
6. Made sure the gap is on the top of the servo.
7. Ran Test for Trim. It spins in a wide circle.

I ran the display calibration program. It's clear there's something wrong with the left servo, but I don't know what to do about it. I attached my results.

Thank you for any advice you have to offer.


  • ElectrodudeElectrodude Posts: 1,374
    edited 2016-05-27 - 05:11:11
    What happens if you swap the two motor cables where you plug them into the Activity Board, so that the left motor is plugged in where the right motor cable should go and the right motor is plugged in where the left motor cable should go?

    You might also want to swap the encoder cables when you swap the motors cables so you don't confuse the motor driver. Try swapping just the motor cables, both sets of cables, and just the encoder cables to see what happens.

    Better yet, try some code that doesn't use the encoders, both before and after swapping any cables, to find out if the problem is with the motors or the encoders. Hopefully someone who knows more than I do about the encoders can say what kinds of problems bad or swapped encoders will cause.

    If swapping the motor cables moves the problem to the right wheel, you have a wiring problem. Otherwise, if the problem stays with the left wheel, you have a motor (or maybe encoder) problem - check the motor's trim pots again. If both motors work but are both backwards (because you swapped the cables), then put all the cables back how they're supposed to be and check your wiring again.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2016-05-28 - 02:47:02
    Do you have another Servo? If so, I would replace the one that is "wonky" when running the calibration program.

    Edit:Never mind. I misread.
  • 12 Activity Bots? Wow, welcome aboard : )

    Can you post the code you're using to make them move when the problem exists?
  • Here is the code I'm using:
    Test for Trim.c

    Test and adjust trim for servos and encoders


    #include "simpletools.h"
    #include "abdrive.h"

    int main()
    drive_trimSet(0, 0, 0);
    drive_speed(32, 32);
    drive_speed(0, 0);
  • ggreenggreen Posts: 4
    edited 2016-05-28 - 13:44:15
    So I switched the wiring all around, and I still have the same problem. The left wheel won't turn when I run the test for trim program or any other program.

    I don't really have any spare parts, or I would switch the servos out. The main thing is that all of my robots have the same problem, and so I don't think that many servos could possibly be bad. I'm at a loss as to what to do from this point.
  • One of the things on the trouble shooting link (from the link you posted) is how the servo is mounted (no gap between servo bracket and encoder bracket).

    Since you have 12 bots with the same problem, look for a problem that could be consistent for all. Mounting of either the servo or encoder on the left side could be a consistent problem. (possibly rubbing of the wheel or servo, or the positioning problem noted above.)

    I think you can run the servos without using the encoders by using the servo_speed function to see if it is a problem with the servo or the servo/encoder combination.

    The function is described in the documentation for the servo.h library.

    The function is
    int 	servo_speed (int pin, int speed)

    Speed ranges from -100 to +100 and is approximate since there is no encoder feedback. You have to issue the command for each servo (to go straight one has to be + the other -).
    You need to include servo.h in your code.
    I would test the bot by putting it on a platform or box so the wheels are off the ground so you don't lose control of it.

    Hope this helps
  • I have fixed servo gap problem and have ran the test encoder connections program.

    Since I have 12 robots with the same problem, I don't think it can be a hardware problem.

    Thanks everyone for trying to help. I don't know what to do now short of sending them all back to Parallax.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    The odds of having 12 defective ActivityBots is staggering. Having 12 with the same problem is even more unlikely. There has to be something we're all missing here.

    Please contact us at support@parallax.com and link this forum thread. If you can provide a contact number and time (include time zone) one of us will get back to you to try and determine what exactly is happening with your ActivityBots.
  • It's possible that your servos are manually uncentered to a degree that the calibration program cannot compensate. Try running the code below and center both servos or go to this link and scroll to the bottom to find the code and further instructions.


    Then run the calibration program again. If it still doesn't calibrate, please contact us at support@parallax.com.

    ActivityBot Servo Centering.c
    #include "simpletools.h" // Include simpletools
    #include "servo.h"

    int main() // Main function
    servo_set(12, 1500);
    servo_set(13, 1500);

Sign In or Register to comment.