Shop OBEX P1 Docs P2 Docs Learn Events
Balancing robot won't work... — Parallax Forums

Balancing robot won't work...

RobofreakRobofreak Posts: 93
edited 2008-02-14 01:26 in Robotics
Hello all,

I have just recently tried making a balancing two-wheeled robot using a MEMSIC Dual-axis accelerometer, the Propeller microcontroller and a single motor gearbox with a shaft comming out both sides, that I have attached some (I think) 54mm diameter wheeles to.
I'll try to explain it as best I can. (sorry, no pics...) It wasn't meant to be a permanant robot, just a test base to see if I could...

It was basically a small 10" x 5", 2 or 3mm thick slab of Sintra (or some of you might know it as expanded PVC) that I had attached my homemade Propeller programming board, a small Radio Shack (heaven on earth!) bread board which had the propeller's 16 through 23 pins hooked up to, a pack of 4 AA's hooked up in series, a long metal 90-degree bent, uh, rod (that's all I can think to call it right now...) mounted pointing upwards that I had attached a, once again, small Radio Shack bread board to with the MEMSIC on it (trying to get it as high up as possible), which was hooked up to the propeller's 24-26 pins (Memsic power to pin 24, Y-axis out to pin 25, and Gnd to pin 26). Then I had a single motor gearbox (you can find one at www.hobbyengineering.com) with "large diameter wheeles" (once again, hobby engineering) on the bottom of the sheet of sintra, for drive. On the first breadboard, was a quad-half h-bridge IC (you guessed it, hobby engineering) controlling the motor.

The operation of the program was simple: read the input from·the MEMSIC in another cog, using the "BS2_Functions.spin" program to read the pulses, while the main cog runs a program that uses the information from the MEMSIC to control the motor. It was simple, if it's tilting forward, move the robot forward, and vice-versa. There was a certain value set so it could know when it was balanced.

That's pretty much it. Now for the problems:
when the motor's running while balancing, it reverses a lot of times, drawing lots of current. So much that it would shut doen the propeller. So, I soldered a 4700uf capacitor to the regulator's output and ground pins, and that helped a lot, but didn't keep it from dieing. But when it did work (as in, not shutting down), it didn't work, you know? It could balance a little bit, but not all that well. I had to keep it from falling over by keeping my hands in front and behind it at all times.

So, any suggestions?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Austin Bowen,

Robo-freak.com

"One must watch out for mechanics. They start out with a sewing machine, and end up with the atomic bomb" - A quote from someone that I saw on Addall.com

Comments

  • LawsonLawson Posts: 870
    edited 2008-02-08 18:07
    For situations when main power may drop out a lot I've done two things. First I put a large capacitor on the input of the regulator. This allows the capacitor's voltage to sag a long way before the microprocessor feels it. This second thing I did was add a diode between the droopy supply and the capacitor. This keeps the droopy supply from draining power off of the capacitor during a droop.

    Good Luck,
    Marty

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Lunch cures all problems! have you had lunch?
  • JohnBFJohnBF Posts: 107
    edited 2008-02-09 16:04
    When you get the power problem solved you'll probably find that the Memsic by itself probably won't balance the robot. Actually, the underlying problem is causing the rapid reversals which create the power problem.

    The underlying problem is that forward and backward motion are also accelerations, along with tilt. If the robot tilts forward your routine will make the wheels go forward. To the memsic, this forward motion is the same as the robot tilting backwards, so the wheels reverse. The backward motion is the same to the Memsic as falling forward, so the wheels go forward, and so on, as fast as the system allows, and having nothing to do with the actual tilt of the robot.

    One solution is to use an accelerometer in combination with a rate gyro. The rate gyro does a good job of determining if the robot is actually tilting, but it does not know where absolute up and down are, and it drifts over time. Over time the average values from the Memsic reflect up and down. So the idea is to use the rate gyro to determine tilt, and periodically correct its drift with the Memsic.

    The sophisticated way to integrate the two sensors·is with a Kalman filter. Take a look at the thread on this topic a little earlier in the this forum.

    /John
  • JohnBFJohnBF Posts: 107
    edited 2008-02-09 16:06
    Sorry, I meant to refer you to an earlier thread on Kalman filters in the Propeller forum. /John
  • number5number5 Posts: 6
    edited 2008-02-13 17:02
    I found my rate gyro on Ebay.
  • RobofreakRobofreak Posts: 93
    edited 2008-02-14 01:26
    Hey guys,

    Thanks for all the info. I looked at rate gyros on Ebay, and found something pretty cool:

    http://cgi.ebay.com/Inertial-Rate-Gyro-Sensor-4-Humanoid-Robot-ESC-GPS-MCU_W0QQitemZ170193468245QQihZ007QQcategoryZ67003QQssPageNameZWDVWQQrdZ1QQcmdZViewItem

    Would that work?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Austin Bowen,

    Robo-freak.com

    "One must watch out for mechanics. They start out with a sewing machine, and end up with the atomic bomb" - A quote from someone that I saw on Addall.com
Sign In or Register to comment.