Hello Everyone,
Thanks to Arduino Duemilanove, I was able to finish my senior project. The portion of the senior project that I was in charge of, was the self-stabilizing platform. I could do a lot of improvements on this platform, but I decided to do a rough approach and have something working which I could later modify.
I used Pololu's Freescale MMA7260QT XYZ-axis accelerometer as my tilt sensor (later on, I realized I didn't need the Z-axis, and could of used an XY-axis accelerometer instead). I attached this accelerometer to my platform.
The accelerometer's outputs are analog signals, when reading them on the arduino, the arduino automatically converts it to digital (0-1023). I made sure I used External referencing and connected the accelerometer's 3.3V into the arduinos AREF. Since I wanted to see the actual voltage readings instead of the digital, I multiplied each reading by 0.0032(3.3V/1024).
To calibrate each output of the accelerometer (when it's horizontally flat which corresponds with 90 degrees), I created a function that would sample the accelerometer's xy-outputs 100 times to find the average and used this average as my reference.
Now that my accelerometer was calibrated, I subtracted the new readings from the reference to get the difference. I multiplied this difference by (Reference/90) to get the tilt angle in degrees.
The reason I converted the digital readings back to voltage readings and into degrees was because I was outputting these values into an lcd screen to verify that I was getting accurate results.
Using the tilt angle readings, I determined the position of the accelerometer which would correspond to the position of the platform. The eight possible positions that I needed to take in consideration were (+X/+Y), (+X/-Y), (+X-axis), (-X/+Y), (-X/-Y), (-X-axis), (+Y-axis), (-Y-axis).
I controlled four 12Vdc motors individually using two SN754410 H-bridge chips from Sparkfun. The motors were placed on each corner. I connected a rod to a right angle ball-joint which was attached to an arm connected to the motor's shaft. The rods connected to the platform through an inline swivel which gave it +/- 30 degrees motion. Due to the swivels my platform was limited by +/- 30 degrees of motion.
Depending on the position of the platform detected, I activated the corresponding motors to bring back the platform to it's reference level +/- 2 degrees.
So there you go, brief description of how I did it, was really fun to implement thanks to Arduino's simplicity.