Shop OBEX P1 Docs P2 Docs Learn Events
Balancing bot using 3-axis accelerometer? — Parallax Forums

Balancing bot using 3-axis accelerometer?

MeepoMeepo Posts: 24
edited 2007-10-22 19:57 in BASIC Stamp
I bought a 3-axis accelerometer from Parallax, and I'd like to mess around with it a bit to learn how to use it. Can I build a small 2-wheel balancing bot with it, or do I also need a tilt sensor of some kind?

Comments

  • sdysdy Posts: 40
    edited 2007-10-21 18:34
    An accelerometer can be used as tilt sensor. Position it so the acceleration it's sensing is due to gravity. If it's a 3 axis, on axis must be sensitive to up/down acceleration. Hook it to an A/D and try it.
  • JohnBFJohnBF Posts: 107
    edited 2007-10-21 22:57
    It's very difficult to use an accelerometer by itself in a balancing robot. If the robot balances by driving the wheels to stay under the center of gravity, the accelerometer will interpret the forward or backward motion as tilt. Over time the true tilt can be ascertained by use of a routine that filters out this noise, but in the short run the accelerometer is confused by the forward and backward motion.

    A rate gyro is not subject to this problem but drifts over time. Since a rate gyro is accurate in the short run and an accelerometer is accurate in the long run, they make a perfect combination. However the routines to integrate the two can be complex (try googling Kalman Filter).

    A good first step toward a good balancing robot is to use a sensor that measure tilt directly in relation to the floor. This could be an arm connected to pot to measure its position, or various kinds of sensors that measure distance to the ground. This is easier than finding absolute up but limits the robot to smooth level floors. But it's a good opportunity to work out the mechanics of the balancing robot and the routines to take the tilt and translate it into directions to the wheels, usually using a PID loop.

    Balancing robots are very challenging, but lot's of fun and a great learning experience.

    /John

    ·
  • Tony BoersmaTony Boersma Posts: 41
    edited 2007-10-22 19:57
    You could use the Z-axis accellerometer (down) as the signal to watch, I think that as it would tilt over the output would gradually get smaller, then instead of the X-axis (fwd/aft) being a varying signal just use it·to tell you which way it's tilting but not actually how fast or slow.
    The Y-axis would be unused.
    The control signal would work to drive the Z-axis signal back to 1-g.

    This is for a robot that can only needs to balance fwd/aft.
    ·
Sign In or Register to comment.