Normally, I would be celebrating with my friends in the RIT
robotics club, however, this is the weekend before finals week, and
people are either out of town, asleep, or unavailable. My other
friends see it, say, oooh, that is cool, but I don't get the feeling
that they understand how much of my heart has gone into it like
you'all would. So, without further ado, here is my story (I will post
pictures and video later so you'all can have proper imagery to go with
the story):
Anyway, about 13 weeks ago, I started a three week project as a
challenge to myself (and as an open ended self chosen and directed
project for a class) to build a balancing robot. For the class, we
had an MSP430(f149) dev board with and LCD, two seven segment
displays, and a keypad. I decided I would use two infrared sensors to
measure the distance to the ground, and using the difference between
the two, determine the tilt angle. At the time, I was coding on top
of uCOS-II. However, for various reasons, (I kept killing GP2D02
sensors, I had other classes, other work, I couldn't quite configure
the MSP430 A2D to work well with GP2D12), I didn't get the robot
working in the three weeks before the projects were due.
So, fast forward seven weeks, and I decide to resurrect the project.
This time, I moved to a much smaller frame (tamiya motor gearbox
attached to a strip of lexan). To be honest, the tamiya motor gearbox
provides enough torque for my balancing robot. However, I didn't have
good hubs for my wheels so I had to scrap that. In desparation, I
took a sumobot that a friend had. At this point, I'd initially been
using an AVR 8535 *ducks tomatoes thrown*, however, I killed it by
accidentally connecting 14V through the micro, instead of to the
voltage regulator. So, I moved on the the only other microcontroller
I personally possessed, the OOPic.
Using the beta compiler, I was able to create a program which seemed
to work pretty well. The OOPIC A2D worked great, and since my motor
controller was the magnevation dual motor driver, I could use the
oDCMotor object directly. However, disaster would strike and I would
somehow kill both of the OOPics in my possession. At this point, I
was about to give up, I had no other micros of my own, and I was tired
of migrating from platform to platform, changing compilers. . . as
luck would have it, MDRC (RIT's robotics club) had some PIC16F877 -
the PIC on which the OOPic firmware runs. Since I had a drop in
replacement for my OOPic available, I decided that I would keep
everything as assembled, and just code the PIC. After a few nights of
coding, and one night to develop a TTL -> PC serial level shifter (no
max232's available and I barely have cash to live on), I got my
balancing robot working!!!
The feeling was unbelievable. The robot balances better on carpet
than tiled or hard floors (wood or concrete). The carpet provides
more friction for the wheels (which transfers more torque to the
ground). I've got video of it balancing for over 3 minutes in my apt.
It doesn't stand still in one place, it kinda moves around (I don't
have closed loop control over wheel speed). But it works.
The serial level shifter. Basically, I used two op-amps one for uC Tx
-> PC Rx and one for PC Tx to uC Rx. Most laptop computers and
usb->serial devices accept 0 -> at least 6.5V as valid serial signals.
So, an inverting amplifier with a very high (infinite) gain supplied
by at least 6.5V is enough to shift the data transmitted from the PIC
(or any other microcontroller). The receive side is more complicated.
Again, I need to invert the transmitted data from the PC. However,
since these voltages would follow the true serial spec (though in my
laptop's case, they were approx -8.6 and +8.6), I would need to divide
down these voltages, then add an offset. Anyway, I have the circuit
diagram for this as well as a picture of what I created. I'll post
that as well.
I needed serial communications because I built a "terminal" into the
PIC. Essentially, it allows me to start or stop the robot,and to view
and modify the PID gains and ir threshold values. This makes
determining the PID coefficients for my robot a lot easier. I can
change them on the fly, observe the robot, change again, w/o having to
modify and recompile source code. After I found a set of gains I
liked, I added code to auto detect a threshold when the PIC is reset
to compensate for the IR sensor drifting depending on the supply
voltage and other things.
I know I've rambled on a lot and while I went of a lot of things,
there are many details not here. If you're interested in finding out
more, feel free to ask. I'll post the media in the morning, I need to
get some sleep - I've got a long day tomorrow. . not to mention for
the next few weeks to come writing up a conference paper and prepping
for IGVC [check out the website http://www.igvc.org ].
to unsubscribe, go to http://www.yahoogroups.com and follow the instructions

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )