I have built a prototype assembly for use on a motorcycle. (picture link at end of post)

 

I am attempting to operate my servos off "pin 9" and "pin 10"  I have written test code to just move the servos in a pattern to test what to do when I start using the IMU sensors.

 

First attempt, I ran the sketch with the servo power and ground going through the board.   The servos were not moving to position, but were oscilating.  We hypothesied that the IMU was not able to pass sufficient voltage through the board and modified to the setup shown where the + and gnd are direct to the servos and only the PWM signal wires go through the IMU.

 

I want to have this sort of functionality https://www.youtube.com/watch?v=aWAiZNZfeYc in two axis.

 

1) can the IMU provide sufficient voltage signal to control the servo?

 

2) does anyone see a problem with my common + and grnd set up?

 

3) can anyone suggest a sketch to study on how to pull the sensor data from the board?

 

Thanks in advance!

 

Code I wrote;

/* test program 2/7/11 to move both servos through a range of motion
*/

//call servo subroutine
#include <Servo.h>
//set variable servo1 and variable servo2
Servo servo1;
Servo servo2;

void setup()
{
//assign pins 9 and 10 to each servo
servo1.attach(9);
servo2.attach(10);
}
void loop()
{
//move range +10, -10, +20, -20, +30, -30 and back to 0

servo1.write(90);
servo2.write(90);
delay(200);
servo1.write(80);
servo2.write(80);
delay(200);
servo1.write(100);
servo2.write(100);
delay(200);
servo1.write(70);
servo2.write(70);
delay(200);
servo1.write(110);
servo2.write(110);
delay(200);
servo1.write(60);
servo2.write(60);
delay(200);
servo1.write(120);
servo2.write(120);
delay(200);
}

 

P2130118.JPG

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

Join diydrones

Email me when people reply –

Replies

  • 1) can the IMU provide sufficient voltage signal to control the servo?
    It should do it easily but if you are using a BEC system and stall the servo it might not work as BECs blow easily with stalled servos. You should be fine though.

    2) does anyone see a problem with my common + and grnd set up?
    No problem I use that in almost all my tinkering with servos including the pan and tilt system I am doing at the moment. Use stable headers to make it easier :)

    3) can anyone suggest a sketch to study on how to pull the sensor data from the board?
    Unfortunately no but as this is an AP board there will be source in the repository for doing it. So just have a dig and modify that to your needs. I'd also recommend servo control using the ms of the signal rather than angle as it will be more accurate.

    A better test code would be the standard servo sweep code and just add another servo to the setup.
This reply was deleted.

Activity

Jose Araujo liked Jose Araujo's profile
Aug 29
spencer harvey liked spencer harvey's profile
Jul 9
More…