Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: Imignant on July 27, 2010, 01:21:02 PM

Title: accelerometer controlled servo
Post by: Imignant on July 27, 2010, 01:21:02 PM
Hi everyone,
I need some help to figure out what i need and how to set up an accelerometer to control a servo.
This is for the wrist joint of an RC arm with 4 DOF plus the gripper.  I want to make the wrist joint simply stay parallel with the ground so I don't have to control it.  But I also want to be able to flip a switch on my TX and have the gripper drop 90deg(perpendicular) with the ground and hold that position regardless of what the rest of the arm is doing.  I'm pretty sure I could accomplish the first part with a head locking heli Gyro but not the second part.  Also a gyro would cost the use of a second channel.

So what I'm thinking of doing is buying an Arduino duemilanove and an accelerometer or gyro.  I have been looking at these three things for a month and I just don’t know where to start.  I suppose the accelerometer should be a low g(2g or 3g) because I want smooth operation, but I also need it to have a range of at least 180deg.
I have read data sheets, tutorials, and watch videos, but I need some specific advice.
Thanks for your time.   
Title: Re: accelerometer controlled servo
Post by: waltr on July 27, 2010, 01:31:09 PM
Basically the accelerometer only needs is sense the direction of gravity. The ADXL335 if you wish to do the ADC in your Arduino or the ADXL345 and interface to the Arduino with SPI or I2C. These are fairly low cost and should work well for tilt measurement.

SparkFun has both available on breakout boards.
Title: Re: accelerometer controlled servo
Post by: Imignant on July 27, 2010, 01:49:53 PM
thanks waltr
yeah, I have been looking at the ADXL335 @ sparkfun, will I be able to connect the PWM output of my futabah receiver (utilizing an on/off switch) to the arduino and flip the gripper down 90deg?  I am assuming the ADXL335 will then function the same way it does when it is parallel. I have seen a lot of videos where the servo is real jittery, will the ADXL335 be smooth?  my wrist servo has a 5,1 reduction, also where do i get the code for this?
Title: Re: accelerometer controlled servo
Post by: waltr on July 27, 2010, 08:45:09 PM
 I don't see why any of what you ask can't be done with an Arduino. I think that depends on your programming skills.
The Arduino is not a processor I've used so hoping someone who has can give you a better answer.