Gyro / Accelerometer .. Programming for Pheonix

Howdy everyone.

So it’s been a while since I messed with this device http://img7.imageshack.us/img7/8660/gyroaccel.jpg I spent about $80 on it last year and its been sitting since, although I would like to do something interesting with it… mainly a coding demo or something to … well just use it…

The original idea was to put it on the pheonix so that when walking up a ramp the body would be corrected and the top of it would be flat. I have been getting some help from Kurte in lynxmotion.net/viewtopic.php?f=8&t=6079 this thread as to take the original Phoenix 1.3 code I have been dabbling with with t7C “RC” control and getting it working with Kurtes assembly code. Without his code the phoenix was walking like it was shuddering and soon it should be walking correctly, once some of the bugs get ironed out.

So with that description out of the way has anyone programmed with a Gyro before?
My first guess to how this thing was going to function was simply output some voltage value on X, Y and Z data pins and when rotating these pins in the X axis for example that value would change and then stay changed until the original position the device was put in at initial power.

Unfortunately what happens is the device changes value when rotated in a specific direction then when the device is no longer being rotated the value returns to normal.

Just probing here but my first initial guess at how to use this is use the “Adin” command to read the voltage , do some division on this value to make the changes smaller and put this in a variable? while constantly reading the pin state. When the device would be powered on the values would be zeroed out then the change would be recorded in a variable. Each read on the same pin would simply be added to that variable keeping track of the orientation of that axis … follow?

the only problem I see with this, or maybe in general with gyros/accelerometers if they are powered on at a non level surface then the data collected after the initial power on is incorrect <— is this correct?

Frankly I find it challenging to explain my theory here, if someone follows my train of thought here FANTASTIC.

What does everyone think?

–Aaron

Looks interesting, which device is it?

You’ll always have gravity, so there is a 32.2 F/S acceleration in the vertical. you should be reading that. If you tilt (stationary), then the acceleration felt will be divided amongst the axis appropriately. If you accelerate along an axis, you should see that acceleration. If you are tilted while you accelerate (acceleration not simply along one of the axis), then that acceleration will be algebraically distributed according to the angle of the acceleration. Do the vector math, subtract gravity, and you’ve got your acceleration. Taking integrals of the acceleration felt on the three axis (after removing gravity) should give you distance along those axis.

I bought Dimension Engineering’s accelerometers.

robotshop.ca/home/products/robot-parts/sensors/accelerometer-gyro-imu/sensors-accelerometers/dimension-engineering-de-accm.html

I’ve played with them, but to “really do the job” you need something like an IMU, and do some rather sticky math!

Alan KM6VV