Shop OBEX P1 Docs P2 Docs Learn Events
Balance Robot — Parallax Forums

Balance Robot

Andrew GrossAndrew Gross Posts: 5
edited 2012-08-30 23:13 in General Discussion
Hello All ,
I am new to parallax and very interested in what parallax has to offer.
Does anyone out there know anything about balanceing robots? And info on how program one.

Comments

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2012-08-23 10:41
    Balancing robots are quite wonderful and there are several different approaches to programing. Much depends on the choice of sensors.

    For level ground, some people have used ultrasonics pointed at the ground to balance the robot.

    Others have used devices that measure slope, accelerometers. These might be able to go up and down a small slope.

    And then there is the issue of control. If you want to wander with the bot, you either need IR or radio control.

    Here is some background reading. And you are going to need motors, wheels and h-bridges of good quality. If all this is too expensive, some have adapted something like the BOEbot to operate while standing on end.

    http://www.geology.smu.edu/~dpa-www/robo/nbot/
  • Andrew GrossAndrew Gross Posts: 5
    edited 2012-08-23 11:24
    Thanks Loopy ByteLoose

    I have done some reading in the Propeller official guide of Hanno Sandos dance bot.And I am really impressed with what Hanno has done. I want to be able to controll my balance bot threw via. radio controll. My level at best is a 4 with programing the propeller microcontroller(still learning). I have an encoder , hbridge, gyro, accelerometer, motors with gear boxes,
    and a micro controller that I bought from Parallax. I think I am ready to hire someone to help me with my project. Is there anyone out there for hire to build a balance bot?
  • Andrew GrossAndrew Gross Posts: 5
    edited 2012-08-23 11:32
    Nice job erco,
    Are you just measuring distance from the floor?
  • ercoerco Posts: 20,259
    edited 2012-08-23 13:22
    Yes, that's the simplest way. I'm a simple guy, and here's my simple code:

    http://forums.parallax.com/showthread.php?126312-Balancing-Bot&p=965087&viewfull=1#post965087
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2012-08-24 03:04
    I've never built one, so I am not the guy to hire. If you really want to pay somebody, they should offer quite a bit of experience and be willing to explain their approach amongst the many available. After all, I presume you want to learn.

    Erco used measuring the distance from the floor (both front and back). This has been done with with either ultrasonic or IR sensors. I am not sure you have to have a gyro to take the more sophisticated approach, measuring acceleration may be enough.

    Refinements, such as PID for motor smoothness and so on may come later, after you first get a bot that is working. I am not sure that encoders and feedback from the motors is necessary either. One can be too ambitious and just bury themselves in hardware that makes learning more confusing.
  • Heater.Heater. Posts: 21,230
    edited 2012-08-24 04:01
    Andrew,
    Is there anyone out there for hire to build a balance bot?

    Where is the fun in that?
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2012-08-24 06:40
    I'd have to agree with Heater, the fun is in the journey and the knowledge acquired via observations.

    I may just be ready to build one for myself. I have certainly wanted to for a long time.

    So the first step is to select a micro-processor and PID software. The Propeller OBEX has 3 PID examples and I guess quadrature feedback is required. First step in construction is an axle with the motors, and h-bridges, and such attached. Also, it may be best to keep the batteries low to the ground. Some investigation into where the center of gravity should be and how to best take advantage of the pendulum effect would be helpful.

    Erco seems to have done it all with a Basic Stamp and no R/C control. But that is a rather limited device as it cannot easily wander, just wobble in place. The Propeller should accommodate a more complex scheme effectively. There is likely an object in OBEX for r/c control or Zigbee.

    I am thinking of building DIY quadrature feedback using IR sensors. I'll have to research and look at what motors I want to use.

    Measuring the distance to the floor only works on certain surfaces and is not goiod for all-terrain, but it isn't a bad place to get started. The programing is simple and will confirm the physical construct works well at balancing and that the PID is properly functioning.

    Choice of sensors will decide much after that.
  • ercoerco Posts: 20,259
    edited 2012-08-24 07:25
    I used simple IR control for driving forward/backward, and turning left/right.
  • Andrew GrossAndrew Gross Posts: 5
    edited 2012-08-24 17:30
    Thanks guys. The fun will be in the learning process. I thought i would first try the easy rout by hireing someone, and then learning from there. I woild then have shared with all. Hanno has built a nice one. But i would want one that uses all parallax products. That way it would be easier for everyone. So here goes the long journey of building one on my own. When its done. I will share. By the way im looking for something more complex than a ping measurment.
  • ercoerco Posts: 20,259
    edited 2012-08-24 17:57
    I posted a lot of links to general info on balance bots early in my thread and Hanno himself chimed in at http://forums.parallax.com/showthread.php?126312-Balancing-Bot&p=947268&viewfull=1#post947268
  • skylightskylight Posts: 1,915
    edited 2012-08-25 09:17
    @erco I'm having a bit of a blank moment and can't quite see how the IR sensor works to balance, is it placed at such an angle that the sensor senses the light only when off balance or vice versa? Could you briefly explain the principle thanks.
  • ercoerco Posts: 20,259
    edited 2012-08-25 11:02
    That's a Sharp IR distance measuring sensor, which outputs an analog voltage in relation to the distance measured. Nice modules. The Stamp really needs an ADC to read them, although in my early tests I "cheated" and used a resistor ladder instead of an ADC.

    http://www.junun.org/MarkIII/Info.jsp?item=37
  • skylightskylight Posts: 1,915
    edited 2012-08-26 06:52
    Ah that makes sense now thanks
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2012-08-28 01:20
    Thanks guys. The fun will be in the learning process. I thought i would first try the easy rout by hireing someone, and then learning from there. I woild then have shared with all. Hanno has built a nice one. But i would want one that uses all parallax products. That way it would be easier for everyone. So here goes the long journey of building one on my own. When its done. I will share. By the way im looking for something more complex than a ping measurment.

    Using all Parallax products might be a bit challenging. It seems that the first phase is to set up motors with quadrature encoders for feedback. Options are to DIY, to buy add-ons, or to purchase motors that include them. The add-ons seem to be very expensive and problematic when compared with either DIY or complete motor/encoder assemblies.

    Sensor solutions are divided into ground measurement via either ultrasound or ir distance sensors (both work) or gyroscope and accelerometer solutions. In looking at the later. there are huge debates about quality and what is best as the products keep evolving.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2012-08-28 01:40
    @Heater
    Not sure what you are trying to say, but I simply cannot find a Parallax product for adding quadrature encoders to motors or a motor with quadrature encoders that are not part of a packaged robot. SO that leaves only the DIY option.

    Strictly speaking, PID is not absolutely necessary. But I suspect that anyone that builds a balancing robot will soon become interested in having it.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2012-08-28 01:51
    Correction, Parallax does have an add-on encoder at $29.xx per wheel. I just can not find which motor and wheel combination it is for. These are far more reasonable than Pololu's add-ons after you buy the wheels, the sensor, the motor mounts, and so on. Still, I'd just prefer a good motor with encoders built in.

    It would greatly help if they gave the inside diameter of the encoder disk.

    http://www.parallax.com/Store/Accessories/MotorServos/tabid/163/CategoryID/57/List/0/SortField/0/Level/a/ProductID/665/Default.aspx
  • Heater.Heater. Posts: 21,230
    edited 2012-08-28 02:52
    Loopy,

    Sorry I managed to screw up my posts so I deleted them.

    All I was getting is that to build a balancing bot one does not need wheel encoders, at least to start with.

    The first task is to get the thing to stay upright and stable. So you need to know how far off vertical you are and drive the wheels accordingly.
    Once you have that licked you can think about moving forward/backward and turning. If this is commanded by some remote control again you don't need wheel encoders.

    Now, I do see that if you want to get the thing to navigate autonomously then you need to know it's position and heading so wheel encoders may come into play.

    PID is not absolutely necessary. I have seen a video of one rude and crude balancing bot that used simple bang-bang control and relays to drive the motors! It was more of a dancing bot:)

    Then there are other control techniques like fuzzy logic or neural nets to use instead of PID.
  • ercoerco Posts: 20,259
    edited 2012-08-28 04:15
    From my experiments, PID isn't necessary to simply balance in place, all you need is Proportional for that. But to drive around stably you need PID. Encoders are not absolutely necessary to balance or drive, but the bot has no "return to origin" reference, so it will drift around as necessary to maintain balance. Encoders provide information for the Integral portion of the PID controller.

    Control systems can be tricky to tune. Many balancing robots work best when there is mechanical damping added. Typically you'll see bots rolling on fat pneumatic tires which not only look impressive, but add necessary rolling resistance and critical damping. Another trick is to operate the bot on carpeting (sometimes THICK carpeting), which damps out oscillations. Take away the carpet and the pneumatic tires and a lot of these robots will oscillate noticeably. My own balance bot was a lot more stable on carpet.

    My favorite is this unicycle, which is demonstrated on a bed, which provides a LOT of damping. :)
    http://www.youtube.com/watch?v=W5OyoFX0DhI
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2012-08-28 04:34
    Well, I have an x and z gyro and an x, y, z accelerometer, motors, wheels, and h-bridge - but no encoders. Looking around, I see lots of choices, but I'd personally like to get deeply into the navigation rather than just build a toy that dithers in place.
    I also have a Ping and 4 or 5 ir distance sensors.

    One builder mentions that gyros quickly get into floating point maths and that C is likely useful - that seem to be a job for the Proeller and either GCC or Catalina C.

    http://www.photopete.com/swarm/balbot.htm

    My only fear of building without the encoders is that I will have to start over to install them. It would be a shame to have to use different motors and reconfigure the whole thing. Still, these encoders are NOT very critical as the RPMs are not very high in relation to response time. So I am still thinking of a DIY assembly.

    I see that the control loop code is run at about 50 times per second with a rather long rest inside the loop, so PWM motor control is not an issue.

    http://geology.heroy.smu.edu/~dpa-www/robo/nbot/bal2.txt

    I do wonder if Parallax's wheel encoders are too complex. Rather than directly feed raw positioning to the Propeller, one has to set up a communications protocol and then extract data. It seems one COG would just have to take to the encoders.

    Here is a simple one ... from Parallax.

    http://www.societyofrobots.com/member_tutorials/node/185
  • Heater.Heater. Posts: 21,230
    edited 2012-08-28 04:39
    That unicycle is pretty neat. So a normal two wheel balancing bot could be balance without driving the wheels. Just use a big gyro disk like that uni.

    Anyway when it comes to control this is even cooler http://www.youtube.com/watch?v=puOLD3-abwU
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2012-08-28 04:42
    I am just guessing, but Parallax's encoder wheel looks to have a hole for the shaft that is either 5/8" or 3/4". That is huge and won't work with the motors I have.

    It would be nice if they provided an alternative encoder wheel with a smaller shaft that could be drilled out to fit many sizes.
  • ercoerco Posts: 20,259
    edited 2012-08-28 05:25
    Homemade's better. :)

    You can always roll your own encoders... http://forums.parallax.com/showthread.php?119343-Make-Your-Own-Encoders

    Those Hamamatsu sensors are nearly impossible to find now, but cheap little sensors are out there. I'll be working up a robot using these sensors in the next month or so: http://www.goldmine-elec-products.com/prodinfo.asp?number=G18740
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2012-08-28 07:21
    Thanks Erco,
    That is just about the DIY approach I was thinking of - though some use Hall Effect sensors and magnets to avoid problems with optical wheels.

    It seems that the Parallax encoders are included in their heavy wheel and motor sets. They are nice, but a bit more than I would want for a balancing bot.

    I have several kinds of ir sensors already that might work. So I guess I just have to build a configuration and test to verify. If it won't work, then it is back to shopping. I really could not find any bargin dc motors with encoders included and geared to an optimal ratio. But I do see them from time to time.

    For anybody that really is serious about learning robotics in depth, a good pair of motors set up with encoders are quite useful.

    There have been encoders for r/c servo motors and I have been ignoring looking at those, but I may reconsider. The problem is that i fear that these may no longer be available. But some have argued that 50 cps PWM controlled motors are NOT good for PID and encoders as the control is jerky and affects the ability to get calculations right. (That might argue against the HB-25 motorcontroller as well).
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2012-08-28 07:52
    Here are some ideal motors with encoders, just add wheels and chassis.

    http://www.ebay.com/itm/C93309-Lot-4-Faulhaber-3557K020CS-Minimotor-Motors-30-1-3-71-1-10BP4-Encoders-/290765915904?pt=LH_DefaultDomain_0&hash=item43b2ffc700

    I have CNY70 sensors that will work for encoders, but Hamatsu P5587 are supposed to be superior.

    Anybody want to split the order on the above and forward a pair to me in Taiwan?
  • ercoerco Posts: 20,259
    edited 2012-08-28 08:34
    From my experiments, the biggest limiter in using continuous rotation servos is their limited RPM. I used quarter-scale Vigor VS-11 servos, which are big, strong, and torquey, but their max RPM is 60. IMO, you want 120 RPM or better. And nice big wheels.

    Initially I thought that thin disk wheels were the way to go, in order to reduce their moment of inertia (flywheel effect) for quicker response. Turns out, the flywheel effect of heavy wheels works for you, as the video of the unicycle shows. His upper rotating flywheel is solely responsible for keeping it upright on that axis.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2012-08-30 23:13
    Here is a link to encoders for servo and other small motors - ideal for a balance bot.

    http://www.nubotics.com/purchase/index.html

    On other fronts, I still would love to jointly buy the motors I mentioned (in #26) listing on Ebay that have encoders included. These items generally cost abotu $150-$175USD each when new. So the 4 motors for $116USD are very reasonable and the motors are rated at 20VDC.

    They can be run at lower voltages without harm. And I have located the schematic for the encoders which are not properly identified in the listing. Seller claims that EVERYTHING is working.

    I believe the encoders (with 10 wire ribbon cable) are HEDL 5540 series.

    The vendor won't do business with me in Taiwan, just wants to sell to Canada or USA.

    The deal would be that I'd split the cost to you by 50% and pay any additional shipping to Taiwan in full for a pair of the 4 after you select.
Sign In or Register to comment.