Pages: [1]   Go Down
Author Topic: Self balancing waiter tray. (or almost it)  (Read 8637 times)
0 Members and 1 Guest are viewing this topic.
Rio de Janeiro
Offline Offline
Newbie
*
Karma: 0
Posts: 34
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, in truth it's not exactly that, but that's the nickname it got.

It's a self-stabilizing platform. It doesn't matter the angle you put the lower platform in, the upper platform will ever stay in the horizontal position.

I used the method from this post, by Lauzsus, and adapted to my needs, including the servo motors.

Check it here:
« Last Edit: August 09, 2011, 02:25:20 am by Rivello » Logged

0
Offline Offline
God Member
*****
Karma: 0
Posts: 594
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It needs to go on a roller coaster for testing
Logged

Freelance engineer, consultant, contractor. Graduated from UW in 2013.

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That's pretty cool. Got any code you can share with us?

Lefty
Logged

Rio de Janeiro
Offline Offline
Newbie
*
Karma: 0
Posts: 34
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sure, the principle is the following:

It reads the inclination angle data given by the accelerometer and gyro, applies Kalman Filter to best predict the real inclination and write to the servo motors the inverse angle to compensate the inclination.

For my luck, I found an already made Kalman Filter algorithm for arduino in this post: http://arduino.cc/forum/index.php/topic,58048.msg417140.html#msg417140

Then I basically used the same code, just adapting it to write the angles to the servos:

// added in the beginning:
#include <Servo.h>
Servo servo1;
Servo servo2;

// added in setup:
  servo1.attach(6);
  servo2.attach(9);

// added in the end of loop() function:
  servo1.writeMicroseconds(1560-yAngle*9.55);
  servo2.writeMicroseconds(1510+xAngle*9.55);

Where 1560 and 1510 are the values corresponding to the center position of my servos and yAngle and xAngle varies from -90 to +90 and are scaled to fit the observed servo limits.

Any question, please comment!  smiley-mr-green
Logged

Vejen, Denmark
Offline Offline
Edison Member
*
Karma: 9
Posts: 1178
RAWR! ^,..,^
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Sure, the principle is the following:

It reads the inclination angle data given by the accelerometer and gyro, applies Kalman Filter to best predict the real inclination and write to the servo motors the inverse angle to compensate the inclination.

For my luck, I found an already made Kalman Filter algorithm for arduino in this post: http://arduino.cc/forum/index.php/topic,58048.msg417140.html#msg417140

Then I basically used the same code, just adapting it to write the angles to the servos:

// added in the beginning:
#include <Servo.h>
Servo servo1;
Servo servo2;

// added in setup:
  servo1.attach(6);
  servo2.attach(9);

// added in the end of loop() function:
  servo1.writeMicroseconds(1560-yAngle*9.55);
  servo2.writeMicroseconds(1510+xAngle*9.55);

Where 1560 and 1510 are the values corresponding to the center position of my servos and yAngle and xAngle varies from -90 to +90 and are scaled to fit the observed servo limits.

Any question, please comment!  smiley-mr-green
By sure, you mean "No, but I do what to show you how I use the servo lib"? smiley-razz
Logged

captain-slow.dk | non contagious!

Rio de Janeiro
Offline Offline
Newbie
*
Karma: 0
Posts: 34
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, but it's exactly that,

why to complicate things? It's just an union of a kalman filter, an IMU and servo motors.   smiley-lol
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well it is your sketch, and your free to show what parts of it you wish.  smiley-wink

Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 72
Posts: 7176
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Very well done! Your machine passed bar exam smiley-wink

If I had this, I would walk with it mounted on my right shoulder and put my drink on top of it.
Logged


Rio de Janeiro
Offline Offline
Newbie
*
Karma: 0
Posts: 34
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well it is your sketch, and your free to show what parts of it you wish.  smiley-wink


I hope you didn't get me wrong. I didn't show the rest because it was not my creation. (I adapted from Lauszus post, which adapted from another project)

You can see the sketch I started from by downloading the file "IMU6DOFVer3.zip" which I got from this post Guide to gyro and accelerometer with Arduino including Kalman filtering by Lauszus.

The only modifications I did was the mentioned above.

Cheers,   smiley
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Rivello,
I'm not an expert...but I will like to know how to connect  (wire) all the listed components.
Please help me. Thank you!
Dan
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 101
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What is the name of the sensor ur using?

Nice Project though.
cheers
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

really thanks for info sharing buddy! i am confused with how to connect the 6dof to my my arduino uno!!! there is no pins declared in the program! it is done via i2c! i am sorry i am a beginner and can u exp about i2c connections?  my mail id is raghavendran.dme@gmail.com
Logged

Pages: [1]   Go Up
Jump to: