Balancing Bot

ercoerco Posts: 14,441
edited August 2012 in Robotics Vote Up0Vote Down
I'm getting some parts & info together to make a Segway-style balancing bot. Here's a nice balance bot webpage with many interesting links to other sources, including Trevor Blackwell (of AnyBots) and his homemade Segway, near the bottom: http://www.tedlarson.com/robots/balancingbot.htm#flexo

Another guy used a Ping sensor (he goes on in some detail about how well it works) with an Arduino controller: http://www.societyofrobots.com/member_tutorials/node/185 (more good links)

And another: http://geology.heroy.smu.edu/~dpa-www/robo/nbot/


Anyone with any balance bot success is very welcome to chime in here!
You'll find me in the new Robotics forum.
Tagged:
«134

Comments

  • 97 Comments sorted by Date Added Votes
  • agfaagfa Posts: 293
    edited October 2010 Vote Up0Vote Down
    I've not had any success, but I plan to do the same myself. I've purchased an accelerometer and a gyro from Parallax as they became available on the Daily Deal. I've got my eye out for a set motors now. Sounds very interesting, keep us posted.

    agfa
  • ercoerco Posts: 14,441
    edited October 2010 Vote Up0Vote Down
    agfa: You and I are starting with the same parts then! I nabbed the P'lax DoD gyro last week and I have a 2-axis Memsic and whatever their last 3-axis DoD accelerometer was. I have 2 big analog BB servos I'm modding for CR, then I'll build a quickie framework and test the servo response. Servos may or may not be quick/torquey enough in this app, or it may take some mechanical tweaking (height & CG) to make the system stable.
    You'll find me in the new Robotics forum.
  • vettezr1vettezr1 Posts: 77
    edited October 2010 Vote Up0Vote Down
    Guys I have always wanted to build a balance bot but I have not been able to find any complete docs that were clear enough for me to follow ,, I would love to try along with you guys erco if you post your progress
  • ercoerco Posts: 14,441
    edited October 2010 Vote Up0Vote Down
    @vettezr1: Sounds good, let's make it a team project! Our one-year-old twins are close, but not quite walking (balancing) upright yet, so the race is on to see if we can get the robot balancing before the girls do!
    You'll find me in the new Robotics forum.
  • Martin_HMartin_H Posts: 3,719
    edited October 2010 Vote Up0Vote Down
    Two balance bots I've seen:

    Legway is a balancing bot built using the Lego NXT kit. It uses the light sensor to detect angle of tilt which is a pretty neat idea.

    Arduway is an Arduino version of that bot using the NXT motors with an accelerometer.

    I'd love to build either, but school is in session and cub scouts has become a big part of my son's week (and mine by extension).
  • ercoerco Posts: 14,441
    edited October 2010 Vote Up0Vote Down
    Martin_H, if you're choosing your son over a robot, I must question your basic priorities... :)

    Yes of course I am kidding. I have my twins and I am not planning on making this robot my life's work. As you have seen from my other projects, I like getting the maximum output for the minimum input. As I envision it, the whole robot should be so simple that it can be assembled in one evening, once the size, shape, servos, battery & function are verified.

    Writing & improving the code can be an ongoing project, though!
    You'll find me in the new Robotics forum.
  • jaegjaeg Posts: 156
    edited October 2010 Vote Up0Vote Down
    Do balancing bots need to be a specific height to work properly? I was eating some Nutter Butters and when I was done looked at the package, turned it upside down and thought, "Hey this could work" http://www.taquitos.net/im/sn/GoPaks-NuttButt.jpg Attach some Solarbotics GM style motors use the wheels designed for them and have a accelerometer on top. The only board I had handy was a picaxe robot board so I stuck it in there and there is plenty of room for it and a 4 pack of batteries designed in this fashion. http://protog.com.au/images/4AA%20battery%20holder.JPG

    The bottom would be big enough that it could possibly keep the robot from fall too far and hurting itself too. Although that would mean the robot can't start out lying on the floor and popping up either. So that would be a trade off.
  • ercoerco Posts: 14,441
    edited October 2010 Vote Up0Vote Down
    Balancers come in all shapes & sizes. Each is a delicate "balance" of several factors, height, weight, CG, tire size & traction, motor voltage (torque & speed). I've made a mechanical balancer (microswitches touching the ground) with Solarbotics gearmotors and it barely worked even using a 9-volt battery. Yes, I'm the guy with a history of over-volting those innocent gearmotors, see http://www.youtube.com/watch?v=VmNc_V5jdPE

    The funny thing about balancers is that the better they work (more stable), the less power they need; batteries last a long time and less motor power is required. But if they are less stable and do a lot of correcting, or if you bump them a lot, they require LOTS of speed and torque from the motors, and more power from the battery.

    Before I get too deep with the control system, I'll use microswitches to mechanically verify that my servos are powerful enough to make the system stable. These are the servos I have laying around and am trying first: http://www.alibaba.com/product-gs/279896653/toy_ANALOG_SERVO_VS_11.html
    You'll find me in the new Robotics forum.
  • jaegjaeg Posts: 156
    edited October 2010 Vote Up0Vote Down
    How tall do you plan on making the robot?
  • ercoerco Posts: 14,441
    edited October 2010 Vote Up0Vote Down
    I'm guessing ~18-24" tall. May change as testing dictates.
    You'll find me in the new Robotics forum.
  • LeonLeon Posts: 7,478
    edited October 2010 Vote Up0Vote Down
    Here is an inverted pendulum in the ESIEE embedded systems lab which is run by a friend of mine:

    http://www.youtube.com/watch?v=A426svG8gXA

    It isn't very stable, they wouldn't have got many marks for it.

    They have several of those units which are used by students on a control systems course. The (rather expensive) controllers are programmed in real-time Java.
    Leon Heller<br>G1HSM
  • max72max72 Posts: 1,096
    edited October 2010 Vote Up0Vote Down
    We need Hanno here...

    http://hannoware.com/dancebot/

    He described it the "programming and customizing.." book.

    Massimo
  • There is an inherent problem with most of these balancing robots. They fall over when switched off.

    I too am trying to build a balancing robot. I have code running in an SX28AC linked to a LIS3LV02 accelerometer. The SX28AC also turns on/off a compressor which controls some pneumatic rams that lift the central core (containing the cpus/battery/sensors etc). When the core is lifted, the robot (should) balance, when the core is on the floor, the wheels lift off the ground, so the robot can sit and stand. The pneumatic rams also provide some suspension to the robot.

    So far the code in the SX28AC reads the accelerometer and drives the motors forward/backward. It also passes telemetry back over an i2c link to a PC running Linux. Odometry off the motors (Ford Mondeo windscreen wiper motors) is a bit flaky. I'm bouncing IR directly off the amatures and counting/timing pulses. The code in the SX28AC is pretty much there apart from the odometry, and I'm not sure is I really need it if I use SLAM algorithms for mapping etc.

    My next hurdle is building the central core, though I have most of the materials, it's a matter of working out what is the best way to put it all together. Everything seems to be physically larger than I want. H x W x D for the robot = 50cm x 55cm x 30cm - it will just squeeze through doorways.

    I'll try to attach a photo of the SX28AC thing. Ha seems to have worked, so I'll explain a bit about that. Motor drivers are via a Robot Electronics MD22 - that's what the PCB is sitting above. 3 pins bottom right are connected to a sliding pot to provide feedback as the height of lift. Four LEDS - right most blinks when code is running, the next two indicate the state of the relays on the pneumatic valves, left most is lit when the compressor is running. The 3 two pin connectors on the left (with no wires) go to the valve and compressor. Chunky red/yellow/black are power - draws over 3A when it's all running (Gulp!) Multi-colored multi-pin goes to the accelerometer. The 3 pin blue/orange/yellow goes to a tachometer - two motors so there's two of them, though only one connected up in this photo. 4 pin with only green/grey/white wire is the i2c link, which just leaves the 4 pin red,blue,green,purple feeding the MD22.
    I've got 3 spare pins. I think I will use one connected to several push buttons in parallel, so I can detect when the central core actually touches ground.
    1600 x 1200 - 215K
  • ercoerco Posts: 14,441
    edited October 2010 Vote Up0Vote Down
    Re: falling over: So true, inherently unstable when switched off, but so are motorcycles and helicopters. Solution, as you have described: park 'em. I have seen legs like kickstands on BBs, both stationary or retractable. My own plan is to mount a short T-bar on top (fore & aft) and park by simply leaning against a wall. It will allow self-parking and self-startup, and could be combined with a recharging dock.
    You'll find me in the new Robotics forum.
  • HannoHanno Posts: 1,130
    edited October 2010 Vote Up0Vote Down
    Howdy!
    I built a vision-guided balancing robot powered by the Propeller several years ago. It turned into a race of who could "walk first", my son now aged 4 or my bot. I got it to balance very reliably- it balanced a flute of champagne in an art exhibit for 4 weeks- with minimal issues. It used an inexpensive grayscale ntsc camera to look for a bar-code belt buckle and could then "dance" with it's partner- keeping a set distance while facing the partner. To debug and tune DanceBot I wrote "ViewPort"- which led to "PropScope" and now "12Blocks". I'm hoping to go full circle and make it easy for people to get started with balancing robots using TBot- coming soon. See my signature for links...

    I wrote 2 chapters for the official propeller book on how to build the balancing bot (complete with code) and the computer vision.
    Big bots are easier to balance than short ones- try balancing a broomstick on your hand, then a pencil.
    It's relatively easy to get a bot to balance in place for up to a minute. It's much more complex to have it moving around for an extended time. The key is to quickly and accurately control the motors.
    You really should use a gyro and accelerometer- fused using a Kalman filter.
    Motors should be relatively powerful and strong, with minimal backlash- and they must have decent resolution.
    The Propeller makes it easy to separate complex projects into simple tasks. Ie- first debug the code to drive motors in one cog. Then, put that away and debug the code to measure the encoders... I ended up using all 8 cogs.
    Hanno
    Professional IDE to edit, debug, and run SPIN, PropBasic and C: ViewPort
    Visual programming language: 12Blocks
    Multi-function Oscilloscope/LSA/Function Generator: PropScope
    500 page book of Propeller Projects:Programming and Customizing the Multicore Propeller
    Blog:http://onerobot.org/blog
  • ercoerco Posts: 14,441
    edited October 2010 Vote Up0Vote Down
    @Hanno: Good on ya, Mate! Thanks for joining in, it's nice to hear from someone who's done it with style. You've already gone further than I plan to with vision, dancing and everything else. I'm a minimalist and am hoping to use a humble BS2E for balance, and remote control/homing using an accelerometer & gyro. It would be nice to use a BoE or HW board, since a lot of people have those ready to go. One guy just used a BoeBot with a Ping sensor! http://www.youtube.com/watch?v=vhJIWGOb8hg

    Moving beyond simple balancing and remote control, I do anticipate the need for encoders for navigation, which will require a lot more processing power. That will get me into the Propeller world. The upcoming Scribbler 2 will win a lot of us Basic Stampers over.
    You'll find me in the new Robotics forum.
  • As I understand it, a gyro is not absolutely necessary, since it's possible to derive the same information with consequetive readings from the accelerometer. I'm getting readings every 24uS with +/- 1.6uS. There's not much I can do about the +/- 1.6uS, but if I take every 16th reading, this tolerance drops to less than 1%.

    However, as Albert Einstein once said, “In theory, theory and practice are the same. In practice they are not.” - so I will bow to the greater knowledge of someone that has actually built a balance robot before I state for sure that a gyro is unnecessary.

    So for now, I shall retire to the shadows again.
  • agfaagfa Posts: 293
    edited October 2010 Vote Up0Vote Down
    Many, on this forum, have said that it can't be done with just an accelerometer. I've been playing around with a bot using just an accelerometer and I have to agree. A gyro isn't absolutely necessary though, I've seen bots that use pings, ir, and even switches.

    agfa
  • HumanoidoHumanoido Posts: 5,770
    edited October 2010 Vote Up0Vote Down
    I would like to see a project with some wheels and motors with a balancing robot theme like the Toyota Winglet. Then it would be useful for transporting around.
  • ercoerco Posts: 14,441
    edited October 2010 Vote Up0Vote Down
    @Humanoido: I wanna see that too! :)
    You'll find me in the new Robotics forum.
  • Martin_HMartin_H Posts: 3,719
    edited October 2010 Vote Up0Vote Down
    How about a balance bot made out of a tower of stacked micro-controller boards!

    BTW I've seen some cool videos of omni ball robots on you tube. They are the ultimate holomonic drive.
  • HumanoidoHumanoido Posts: 5,770
    edited October 2010 Vote Up0Vote Down
    Martin_H wrote: »
    BTW I've seen some cool videos of omni ball robots on you tube. They are the ultimate holomonic drive.
    Indeed, those are cool! Unlike wheels, the problem with your balls is they contact the surface with such a tiny area, that when a pebble is encountered, the jolt is huge, so the ride is not so smooth. Wheels on the other hand have a greater surface contact area and are capable of spreading out forces and absorbing them.
  • ercoerco Posts: 14,441
    edited October 2010 Vote Up0Vote Down
    Dag-nabbit! I tried to be tricky and take a shortcut around the accel/gyro/Kalman/IMU stuff. Thought I'd do something new & unique. I've been studying the various Sharp IR distance sensor specs and I literally just ordered two of these GP2D120s earlier today: http://www.junun.org/MarkIII/Info.jsp?item=37 They output an analog voltage to indicate voltage. By using one on each side of a Balance Bot, you could get a differential voltage as the bot leaned and use that info to drive the wheels. You could probably tune it to balance stably using nothing but op amps.

    But just tonight I found a 2007 video of a guy who beat me to it using the exact same sensors & differential voltage methodology: http://www.youtube.com/watch?v=u8arOtG8aHk&NR=1

    At least the guy is an engineering professor, so I shouldn't feel too bad.

    Hey, maybe I can still be the first guy to make a balancer yet using just a galena crystal and a rusty nail. I'm on it!
    You'll find me in the new Robotics forum.
  • HumanoidoHumanoido Posts: 5,770
    edited October 2010 Vote Up0Vote Down
    erco wrote: »
    Dag-nabbit! I tried to be tricky and take a shortcut around the accel/gyro/Kalman/IMU stuff. Thought I'd do something new & unique. I've been studying the various Sharp IR distance sensor specs and I literally just ordered two of these GP2D120s earlier today: http://www.junun.org/MarkIII/Info.jsp?item=37 They output an analog voltage to indicate voltage. By using one on each side of a Balance Bot, you could get a differential voltage as the bot leaned and use that info to drive the wheels. You could probably tune it to balance stably using nothing but op amps.

    But just tonight I found a 2007 video of a guy who beat me to it using the exact same sensors & differential voltage methodology: http://www.youtube.com/watch?v=u8arOtG8aHk&NR=1

    At least the guy is an engineering professor, so I shouldn't feel too bad.

    Hey, maybe I can still be the first guy to make a balancer yet using just a galena crystal and a rusty nail. I'm on it!
    Erco, you will have something new and unique, the 1st balancer radio! Hope you get this working. Maybe you can help me make some homebuilt balancer winglets. Can't afford the Toyota 3 grand plus price tag. I seriously need some robotic transportation that is totally portable and tiny for all these smooth bike trails that run everywhere.
  • Martin_HMartin_H Posts: 3,719
    edited October 2010 Vote Up0Vote Down
    The differential voltage between the two distances sensors is a really good idea. In the video I liked the way he externalized the PID control with a pot. It makes the programming easier and makes the bot more interactive.

    Erco, I really like the idea of building a balancer completely analog. It could be the Herbie the Mousebot of balancing robots!

    There's only one way I can top it. Here's my design for a passive balancing robot:
    512 x 330 - 14K
  • ercoerco Posts: 14,441
    edited October 2010 Vote Up0Vote Down
    Martin: This guy beat YOU to it! http://www.youtube.com/watch?v=whuW-firTN4 Not exactly an inverted pendulum. It's more stable when it's off... :)

    A much better robot here: http://www.youtube.com/watch?v=DWmS40quzxM
    You'll find me in the new Robotics forum.
  • Martin_HMartin_H Posts: 3,719
    edited October 2010 Vote Up0Vote Down
    What a riot.
  • ercoerco Posts: 14,441
    edited October 2010 Vote Up0Vote Down
    I received my GP2D120 sensors ($8.75 from Junun) yesterday; a record fast 3-day ship from Washington state to LA. I've done some bench testing with them and I must say I'm quite impressed. They are sophisticated CCD units that give an analog output that varies with distance. They yield amazingly consistent results with a variety of reflected objects and a variety of angles. Infinitely superior to simple IR reflection sensors using an IR LED with a phototransistor or 38 kHz receiver module.

    I plan to use two as angle detectors in a balance bot, per my earlier post. I'm initially interested in an analog solution, then moving to digital. The sensor analog voltage output is ~0.4-3.0 volts; you could RCtime that with a Stamp and get distance info pretty easily and cheaply.

    Nice curve-fitting and general info on these modules at http://www.acroname.com/robotics/info/articles/sharp/sharp.html
    You'll find me in the new Robotics forum.
  • ratronicratronic Posts: 1,451
    edited October 2010 Vote Up0Vote Down
    Hi erco, this is a very interesting thread. Have you any thoughts on your interface between the these sensors and the motors yet? I've always wanted to build a balancing bot. My problem is I can barely balance myself!
    Fix it, if it ain't broke! .......... D Rat .......... Dave ..........
  • ercoerco Posts: 14,441
    edited October 2010 Vote Up0Vote Down
    I have lots of thoughts. Clearly there is lots of interest here, as well as many ways to sense balance, and many degrees of stability. I think my first move will be a quickie, just using one sensor to measure tilt using a Homework board and driving the wheel servos accordingly to see how quickly I can achieve semi-stability. I'm hoping to match what this fellow did with a Ping sensor on his Boe-Bot: http://www.youtube.com/watch?v=vhJIWGOb8hg

    PID it ain't, but you gotta start somewhere!
    You'll find me in the new Robotics forum.
Sign In or Register to comment.