Pages: 1 [2] 3 4 5   Go Down
Author Topic: Self Balancing Robot  (Read 24042 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 113
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Sure, i've uploaded it here. Contains all the code and examples, and it's released in the public domain.
The code should work good, but it's not 100% tested.

http://www.lugato.net/MD23.zip
Logged


0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Seems good enough! Great job!

You can try to move the heavy battery to the bottom of the robot. This may reduce the swing effect somewhat.

BTW, could you supply some details on the LCD you use and as well the AXELCD library files?
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 113
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks zhengrob smiley Are you using it in a project?

About the battery, is doesn't work that way, becouse the robot is an inversed pendulum and so it actually works better when the weight is high rather than down (it increase intertial and give more reaction time).

The LCD i'm using is the Picaxe LCD display, this one, datasheet here. Basically it's a standard lcd with an additional board attached. It can work serially or with I2C. As my robot was almost only I2C, i used that mode. The library is very simple, it just sends the correct i2c messages with a syntax similar to the Serial.println method.

I'll post sources this evening.
Logged


0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello msx! thanks for your message!

I am just learning Kalman filter algorithm and your project is a good example instruction to me.  Arduino is new to me therefore any details will help me to better understand the entire routine.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 113
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

sorry, a little late, here's the picaxe lcd i2c display library smiley

http://www.lugato.net/AXELCD.zip
Logged


0
Offline Offline
Sr. Member
****
Karma: 17
Posts: 382
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I have build a balancing robot based on Sparkfun 5DOF acc/gyro combo, Arduino and Parallax continuous servo.
I had sofar mixed results and suspect the servos have to much backslash

I want to test the AX12 route.
Can you point me to some Arduino code to run these specific servos  :smiley

TIA
Yves

-------------------------------------------------------------------------------
The "looseness" you describe is a real problem with balancers.  I used motors similar to yours at first, but was able to achieve much tighter and more responsive balancing by switching to zero-backlash servos (Dynamixel AX-12).

Here's a little sample movie of what a difference reduced backlash makes: ....

That demo is using the "encoder" (continuous rotation pot) integrated into the AX-12.

A friend of mine worked on a commercial balancing toy.  He mentioned that it used cheap high-backlash motors, and they had to use sophisticated filtering and modeling to accommodate the backlash.  It took an experienced control expert quite a while to get it working.

So I'll just stick with tighter motors.  

- Nathan
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 301
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
This is really nice work!!
How did you design the control law? Do you have or used any white paper on (LQR) controller design?

smiley
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 113
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks smiley
uhm no, I implemented a PID controller to control the motors.
Logged


0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 301
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

>I implemented a PID controller to control the motors.
Well, did you publish your implementation steps somewhere? Is it possible to know and repeat your steps? smiley

I have a background in mathematics of PID, LQR and so on, but no practical experience. It could be very helpful to just repeat your steps for the first time, if it is allowed.
 
smiley

Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 113
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It is sure possible smiley 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 smiley-razz). 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 smiley-razz) 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 smiley-razz)
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 smiley

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 smiley
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 smiley-razz ). 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 smiley

Btw i'm now planning a second version with different hardware, i'll post on this forum as soon as i've something smiley

That was it, feel free to ask any question. smiley
The complete source is avaiable on this thread.
Logged


0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 301
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you very much for sharing your experience, it gives insight! I am following you smiley-wink
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 113
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

great smiley
if you are planning on hardware, i'll suggest making it smaller than mine. It was too heavy and the structure was barely strong enought not to break apart when falling. In my new version i'm keeping the Arduino and the IMU, and using instead a simple motor driver (an L293something), two small pololu motors and 4 AA cells.
Logged


0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 301
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you for information!
Actually I'm late for using this information, as I've already purchased the hardware.

By the way, why didn't you use a driving system based on incremental quadrature encoders? Well they have their own specially adapted Kalman filter, and I think that (at least theoretically) using them together with their KF, gives a cheaper/better/lighter/more sophisticated driving system. May be you have already tested them?



Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi my friend, this is really great, congratulations smiley-wink. I found in an other forum than you "burn" the MD23. I am worried, because I followed your steps and I do not want to burn my md23, do you found what was the problem?, thanks a lot.

Cuauh
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 113
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks smiley
Yes i did burnt an MD23. That was a very sad experience, my first "expensive" hardware lost.
Anyway, i did it just connecting the MD23 to an unregulated power supply. Yes that's a stupid mistake, but i'm learning electronics on the go, and i was not aware.. basically the power supply shoot 15V or more to the board and a chip released its magic smoke.

If you're unaware of the issue (but you probably are smiley-razz), i suggest learning it the soft way reading this:
http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=103


ironbot: uhm no, i didn't used the encoders.. I can't see how to take advantage of them. how would you use them ?
« Last Edit: January 17, 2009, 04:47:17 am by msx » Logged


Pages: 1 [2] 3 4 5   Go Up
Jump to: