Is this hardware capable of balance?

About a year ago I attempted to make a homebuilt segway for my HS senior project, because after seeing the Craigway, Knight Krawler, and Trevor Blackwell’s homebuilt, I was convinced a well functioning balancing vehicle could be made for well under half the cost of buying a Segway. Well, let me just say that when my project was complete, it became very apparant as to why the real Segway costs so much.

So, here’s what I’ve got Check out the pictures and video. The video was using code that read tilt as either forward or backward and drove the motors at a constant speed in the direction it was tilting, no matter how much it was tilting. (I know this isn’t a good program, but I am no programmer)

And here are the specs:
Large 24V right angle wheelchair motors approx 113 rpm free speed
16" diameter tires direct drive from motors (spprox 0.5-1.5 degrees backlash in setup)
RoboWars IBC Speed Control
Parallax Basic Stamp 2 on a Board of Education
Memsic 2125 Accelerometer
Four 12V 10Ah SLA batteries in a series parallel configuration
28" wide hub to hub and approx 80lbs weight.
Approx 5.5" from groung to bottom of riding platform.

My question is, given the right program, is this setup capable of balance like a segway? (not necessarily extremely smooth like the real Segway but smooth enough to be rideable) If yes, then what is the right program?

If no what needs to be changed? I need to know the following things. Given a good program and proper other factors:

Is the motor-wheel-platform setup capable of balancing the vehicle?
Is the accelerometer capable of balancing the vehicle?
Is the Parallax BS2 capable (fast enough) of sampling the gyro/accelerometer/whatever and generating the PWM signals for the speed controllers?
Is the Robowars IBC capable of enough frequency or whatever to accurately control the motors based on the pwm signals it receives from the microcontroller?

And if the answer to any of these questions is “no” (which I’m sure it will be on at least one of them), what hardware do I need to make this thing balance.

I’m not expecting this to be as fast or as smooth as a segway. I just want to be able to ride it safely and maybe let you all give it a try at an event next year. I just want it to be useable.

I want to spend as little as possible on making this work, but I know that some cost probably will be involved in making it work and I can prepare for that within reason. I don’t really want to scrap the project for making something else because it was my HS senior project which I will probably remember forever.

Any help is greatly appreciated as always. :slight_smile:

This may or may not help you but I ran across this (http://www.geology.smu.edu/~dpa-www/robo/nbot/) a while back and bookmarked it. IIRC somewhere in one of the links I saw at this site was a PDF with a lot of info on an algorithm for balancing. In any case, you might like to check out some of the video clips of the nBot in action. They are pretty neat.

I doubt it. I think you will almost certainly need more sensors. I don’t think an accelerometer alone will give you the information you need to balance.

Most balancing robots need a gyro and wheel sensors at a minimum.

Joe J.

Good choice of projects! we tried and it didn’t work out too well :(. check out this site http://www.tlb.org/scooter.html that guy even has some sample code… hope that helps :slight_smile:

also you dont want wheels doing your balancing. use a very heavy counter weight and control it with a motor.

I concur with Joe. It’s a rather classic sort of controls problem, and it’s a lot easier to keep the thing balanced if you know the angle that it’s at. To this end you need a gyro or yaw rate sensor. Preferably a gyro so you don’t have to assmue it’s starting in any particular orientation. Preferably both cause with both and an accelerometer or encoder on the wheels so you can get a state space controller going. A state space controller will sort of automatically stabilize the system if it’s at all possible.

After that, it depends on just how unstable the construction is and the specs of your motors.

I don’t have any provisions for an encoder on the wheels. Also, the accelerometer will tell me what angle it is at, but I think you are right in saying that I need a gyro too. TLB’s homebuilt doesn’t have encoders so I don’t think I need them because his works pretty well.

More than theory on how it works, what I was really looking for is *what specific parts do I need to make it work? *

TLB uses an Amtel controller programmed in C. Is it really faster than a BS2 programmed in PBASIC? On his dual wheel scooter, he sends serial commands to the speed control but in his eunicylcle he uses the microcontroller to generate PWM signals to the speed control.

First, I need to know if my Robowars IBC controller will be as capable as the one he has (not in terms of voltage and current but in terms of response time and frequency, etc)
Here is mine: http://robotcombat.com/marketplace_robowars.html
Here is his (x2): http://robotcombat.com/marketplace_robotpower.html

If my speed control will not work, please explain why.

TLB has his eunicycle code on his website. How does one go about getting this code from the PC computer to the microcontroller? I assume there is a special program/loader needed? Also, how does the microcontroller connect to the computer?

TLB uses a board from here http://www.bdmicro.com/ but I’m not sure exactly which one. Any ideas?

For the gyro and accelerometer, he uses this http://www.rotomotion.com/prd_REV2.4.2DOFA.html but it is out of stock and quite pricey. It says it is filtered and amplified which I assume are features necessary for this sort of project?

I was thinking that my motors are probably just about at capable as his, but my electronics are not. So, I was thinking that if I duplicated his electronics on my machine, then I could start with his code, and then at least I’d be on the right track to success.

However, his electronics seem a little pricey (the gyro and accelerometer mainly). Are there any alternatives? Or is anything that does the job really going to cost that much?

Also, his website explains the concepts very well but leaves out some of the details like how the gyro and accelerometer interface with the microcontroller, and how the microcontroller gets programmed. I’m hoping someone here can fill in those blanks for me.

Once again, thanks for all the help. I usually don’t come right out and put my projects up on the line for public viewing until they have some degree of success, but I couldn’t achieve any with this one so far, so I had to call upon all you for help. I really hope by the time regionals come around (hopefully much sooner actually) that I can have this thing balancing like a pro!

You dont absolutely need encoders or some other type of feedback on the driven wheels to create a balancing effect. The accelerometer should give you sufficient information needed to start the balance, but the most you will ever be able to get is a platform that rocks back and forth. This will be because, based on the information you’ve given, you would take the given rotation angle, then use that to drive the motors at a certain speed in a certain direction. The precision on that sensor wont give you enough info to create an exact stopping point, and the motors will overshoot their target. You could of course add a larger deadband, but would only increase balancing problems as the platform levels out in the deadband while off balance, and due to sensor “drift”

As to previous posts: I’m not exactly sure what a yaaw rate sensor would do for you in the aspect of balancing. Maybe to see if the motors are unbalanced while driving and the platform turns? Feedback on the driven wheels would help considerably though. Using that you could set up a basic PID (not sure if your basic stamp will handle it, but theres room for cheap upgrade) Being able to control a motors exact velocity and placement would help vastly while trying to balance.

the problem with using an accelerometer rather than a gyro (i.e. an angular rate sensor – in the old days, angular rate sensors actually had spinning masses in them that were mounted on a complex mechanism with very good bearings that allowed the spinning mass to keep pointing in the same absolute position regardless of the oreintation of the outside – this took advantage of the so called gyroscopic effect – conservation of angular momentum actually but I digress…) is that accelerometers give well… a measurement of acceleration. If the sensor is not accelerating then it can be used as a tilt sensor by measuring the acceleration due to gravity, but if it IS accelerating, life is much more complex – I think too complex for your system to noodle out.

Gyros – angular rate sensors – have there own problems. They too don’t give angle – they give angular rate. But, you can integerate them once to get angle – this introduces a problem with drift (small errors add up to eventually get the angle estimate off target). Drift can be managed with some creative coding to zero the integration – when you get to that point, we can talk more.

Joe J.

still i say that heavy counter balancing on the bottom will deaden the tendency to tip and you will get a more smooth ride if you use counter weights to balance than wheels

ah-haha. But the whole point is the programming and controls challenge presented by the 2 wheel system. Else you’d just slap a few more wheels on there and call it done. Besides which, you really wouldn’t have enough room under the wheels to balance an entire person out. I mean. 150 lbs about 30" above your pivot, vs. 12" below the pivot if you’ve got absolutely huge wheels… That’s 375 lbs of counter weight, at least.

Certainly putting your batteries and everything else as low as possible will help a bit, but you can’t really hope to mechanically balance it with anything short of a really tiny piece of neutronium.

no im not talking completely balance it but it allows you to dampen minor changes in weight easily and makes for a smoother ride. i was thinking a 10 pound block of lead. not that big really.

You might do some research on inverted pendulums. This would give you some of the math and algorithms you’ll need. There’s allot on the web since biped robots have become popular. The basic stamp is kind of limited. there are better choices for processors and programming when you need fast response. Have you looked at adding a gyroscope to stabilize the platform?
The problem with gyroscopic stabilization is not so much getting the mass up to the required speed as it is containing the fragments if and when it fails. Tilt sensors that are not influenced by acceleration are available but, they will hurt the bank account. May be if you used 2 IR distance senors on the front and rear you could subtract the outputs and have the error to plug into the control system. This would work on smooth floors. Maybe that Segway isn’t too expensive.

I’m thinking I will try all the equipment I have, but add to it an Analog Devices ADXRS300 gyro to the setup because I have learned such a gyro is what these balancing robot platforms need in order to function properly. And then I will keep the accelerometer to correct for gyro drift. Once I get the gyro, hopefully a couple of you can help sort out some programming, and we’ll see what we’ve got from there. :slight_smile:

You might be surprised - it could be easier to balance with the weight at the top of the pendulum.

You can go through the physics - OR - and this will help visualize it…

Go get a broom or a stick with one heavy end and one light end. Try balancing it on your hand with the heavy end on the low side. Now try it with the heavy end on the high side. Which was easier? Why?

NOW - if you do the physics, you have something to compare it to so you don’t get confused. I admit, at first it seems like it would be better to have the weight low… but momentum is a powerful thing…

Good luck!

P.S.- I know this is the easy way out, but you could mount a range finder on either side - if the device starts to tip (on flat land) the distances will be different, and you can straighten out. Just hope no one walks into the field the ranger finder - because you’ll end up on the floor. And don’t get close to a wall. And stay off hills. And clutter on the ground. And… and… and…

Should have posted THIS MESSAGE here but posted it there instead (it goes with that thread too so it was really a judgement call).

Rather than double post, I encourage you to follow the link if you are interested.

Joe J.