self balancing camera platform with Arduimu V2 - help requested

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 http://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);
}

 

Tags: Arduimuv2, camera, self-balancing, servo

Views: 309

Attachments:

Reply to This

Replies to This Discussion

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.

Thanks Ritchie!

Your post helped me identify what is going on.

1) I used sweep and still the bizare jerky partial motion

2) I disconnected the servo that was not being "swept"

3) sweep worked fine

4) reconnected 2nd servo and that servo started jerky motion and interrupted the smooth motion of first servo

5) swapped servo wiring and one connected worked fine, but connect second same problem

6) wrote "sweep" demo for 2 servos putting second on pin 10

7) couldn't get smooth motion on anything despite trying one servo at a time and swapping which pin served which servo.

 

hummm????   gottta think this one through

try to add a capacitor
I tried a bunch of things and near as I can tell, my servo signal is being "shared" by the two swervos if they are both wired up.   I'll tear open my wiring harness to double check there are no problems beneath the shrink wrap.
If both servos work fine when used on their own but when together do not they are drawing too much current. Adding a capacitor to the +5v line will allow you to have a "store" of power for sudden moves which for a consistently moving platform isn't much help unless its a big capacitor. I suggest using a supply for the board and a supply for the servos (you can run them off the same battery but the IMU regulator is clearly not up to it).

You are spot on.  I had noticed the power light dip as the servos started. I tried some smaller servos and the program executed exactly as written.  I need to research capacitors and look at a larger power supply.

No just a separate supply should do it (no need for another battery). Plenty of voltage regulators on eBay for £3 for 5.

RSS

Social Networking

Contests

Season Two of the Trust Time Trial (T3) Contest has now begun. The fourth round is an accuracy round for multicopters, which requires contestants to fly a cube. The deadline is April 14th.

A list of all T3 contests is here

Advertisement

© 2013   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service