Video of ArduRoller out for a spin

Newer Older

Video showing the second iteration of my ArduRoller balance bot.

Specs:
- Chassis: laser cut 2.7mm bamboo ply (Ponoko); various M2.5 machine screws from Amazon; Instamorph low-melt-point thermoplastic to fill in the gaps.
- Brains: 1 x Arduino Uno
- Motor driver: 1 x Sparkfun Ardumoto
- Motors: Sparkfun 2 x 24:1 gearmotor
- Wheels: 1 set Sparkfun 70mm -- repaired with Instamorph after they cracked around the axle
- Gyro: 1 x ADXRS613 (Sparkfun breakout) mounted at the axis of rotation
- Accelerometer: 1 x ADXL203CE (Sparkfun breakout) mounted at the axis of rotation
- Batteries: 2 x 3.7V Li-poly 850MAh (Sparkfun)

I've shared the code and assets at github.com/fasaxc/ArduRoller.

katieboswell575, EVOL design studio, and 9 other people added this video to their favorites.

  1. fasaxc 23 months ago | reply

    Thanks for the fave

  2. terrorchid 23 months ago | reply

    Brilliant. What happens if you nudge it?

  3. fasaxc 23 months ago | reply

    Thanks for the faves.

    It always comes to rest when you nudge it. A gentle nudge sends it a few inches. A more aggressive nudge sends it a few feet. I'm still tuning the code for the new chassis, which is a bit less forgiving than my older prototype (based on a sparkfun box!). There's a video of me nudging my earlier prototype here:

  4. fasaxc 23 months ago | reply

    Thanks for the fave

  5. toyzinhu 4 months ago | reply

    Hey,
    Could explain a little bit about the calculation you did to put together the accelerometer and the gyroscope?

    Thanks

  6. fasaxc 4 months ago | reply

    You should have a read of my instructable. It covers some of the details. There's more in the comments there too: www.instructables.com/id/ArduRoller-balance-bot/

  7. toyzinhu 4 months ago | reply

    Hi fasaxc,
    I have read everything, but I still have some question.
    in this part of the code:

    float g_factor = max(0.0, 1.0 - (15 * max_gs_sq)) * 0.02;
    tilt_rads_estimate = (1.0 - g_factor) * (tilt_rads_estimate + gyro_rads_per_sec * TICK_SECONDS) + g_factor * x_filt_gs;
    tilt_int_rads += tilt_rads_estimate * TICK_SECONDS;

    I know that these variables to be used on the PID Controller, but how you did these calculations? Where each variable came from? per example, how g_force is calculated? I am really interesting in understand this part of the code, since is missing just this part for me do my code.

  8. fasaxc 4 months ago | reply

    This term is the previous best guess at the tilt + the change in tilt detected by the gyro since the last estimate:

    (tilt_rads_estimate + gyro_rads_per_sec * TICK_SECONDS)

    That term should be very accurate in the short term but, since it integrates the error in the gyro it drifts over time.

    This term is the tilt detected by the accelerometer:

    x_filt_gs

    In the short term, the accelerometer is very noisy but if you average it out over the long term, it gives a precise value for straight down.

    The two terms get combined with a factor like this, in what's called a complementary filter:

    new_best_guess = (1-factor) * gyro_guess + factor * accel_guess

    Since 1.0-factor + factor == 1.0, the factor just chooses how much of each guess we mix in to the whole. More gyro and we get more drift, more accelerometer and we get more noise.

    Originally, I used a static factor, along the lines of 0.05 so that most of the guess was taken from the gyro, which is far more reliable. The code that you show there has an experiment in it that increases the factor when the gyro is reading exactly 1.0g. The intuition behind that is when the gyro is reading 1.0g it's more likely to be reading only the tilt and not the efffects of acceleration too. To be honest, I don't think the experiment worked that well.

    This part is simply integrating the tilt over time:

    tilt_int_rads += tilt_rads_estimate * TICK_SECONDS;

keyboard shortcuts: previous photo next photo L view in light box F favorite < scroll film strip left > scroll film strip right ? show all shortcuts