Page 1 of 1

Rover 5 Pan/tilt servos

PostPosted: Sun Dec 28, 2014 4:43 pm
by Aidan
Hello,

I've run into problems with the rovers pan/tilt servos and the wall follower program (and I guess any future programs). It started with the rover not looking forward so I altered the look_forward angles to 40 degrees for pan and 0 for tilt. Ideally I would want a value of about -10 but negative values don't seem to work. This causes another problem when, as the rover is driving forward and looking slightly up, it will reach the wall and turn left as planned but then it is unable to look more than 40 degrees right to keep following the wall. Is there any way to use negative values to control the servos or, failing that, reset the zero of the servos to a more practical point (say pan facing backwards and tilt upside down).

Sorry, if I'm missing some really obvious solution,

Thanks for your help,

Aidan

Re: Rover 5 Pan/tilt servos

PostPosted: Mon Dec 29, 2014 12:13 pm
by Alan
Hi Aidan,

Welcome to the forums. :)

I think that the problem may be in how the pan/tilt servo was assembled. I probably didn't make it clear enough in the instructions, but ideally the pan servo should be assembled so that 90 degrees corresponds to the head pointing forward. There is a bit of an art to this as the range of motion of each servo can vary somewhat. One useful technique can be to turn the pan servo all the way left and then detach and reattach the metal bracket so that it points roughly 90 degrees to the left. The commands that you can send to the servo are limited to the range 0 to 180 degrees so you need to assemble the pan/tilt head so that the key angles (0, 90, 180 etc) correspond to directions you want.

The following short Arduino sketch may also help you when assembling the pan/tilt head
Code: Select all
#include <Servo.h>

const int SERVO_PIN = 9;           // The signal pin for the servo
const int SERVO_ANGLE = 90;    // Set this to the desired angle

Servo gServo;

void setup()
{
    gServo.attach( SERVO_PIN );
}

void loop()
{
    gServo.write( SERVO_ANGLE );
}


Hope that helps, please let me know if you need more info or if I've misunderstood something.

Regards

Alan