It is sure possible
It just require some understanding and patience.
Well first off i did a quick test of the hardware, making a simple arduino program to read some raw values from the IMU, just to check that it was working properly.
Then i studied/implemented/adapted the Kalman filter to obtain the correct angle, which was the thing that was scaring me off the most (it would be a waste to have a complete robot and then be unable to read the value
). I proceeded by strapping the Arduino and the Imu on a wood stick. Then i did a simple pc program (with Delphi, but you can use whatever
) that reads the angle data from the serial line, and show a simple line that is (should be) oriented as the robot. That gave the best "feeling" of how precise the measuring was. At that point i spent quite some time debuggin the filter to obtain a stable and responsitive reading, mostly a work of trial and error that is unluckly very coupled with the specific hardware and setup (read: you have to adjust your own parameters
After i was satisfied with it, i designed the robot (well most of it was already on my mind), i used pen and paper and rulers and also did some 3d sketches with blender. Then went on building it. I can say: keep the design as simple as you can, becouse then just the slightest error drilling a hole or gluing something can make everything displaced and ultimately a great pain
Then i did some test, simply running the motors proportionally to the current angle. At the time i didn't know what a PID controller was
That gave some results but of course it wasn't stable at all. I learned the PID controller and implemented it (which is easy) and tuned it (which is hard, as you probably already know
). The best thing you can do is to find some generic values to determine the order of magnitude and then attach three potentiometers to dinamically change the P,I and D parameters while the robot is running. Wikipedia has a good practical article on the PID that explained a couple of tecniques to find the parameters.
At the end the results was the one on the videos: the robot can actually stand without fall for indefinite time, but it's not completely stable and swings back and forth quite a lot.
That's possibly a combination of bad hardware, bad robot structure, and me not being an engineer
Btw i'm now planning a second version with different hardware, i'll post on this forum as soon as i've something
That was it, feel free to ask any question.
The complete source is avaiable on this thread.