Saturday, July 18, 2009

Everybody Needs a Hobby

There's some element to having a hobby that keeps you from going completely insane. For a long time, computer games were my hobby. I quit playing WoW over a year ago, but never quite found a suitable replacement. I've been waiting for Starcraft II to come out, but as it keeps getting postponed, I need something to do until then.

I bought a set of stepper motors off some obscure website, along with the parts and schematic to make the serial motor driving circut too. I was really excited when it came. I bought a soldering iron of my own, and went to work assembling the circuit board. I got it all finished and to my utter dismay, it didn't work. You may be suprised to find out that neither of us own a voltmeter. So debugging the circuit wasn't really an option without buying one.

But buying things is such a difficult thing when it comes to engineers. You have to be sure you're buying the best thing for the money. And so you have to do all the research, and read all the reviews. You have to look at the specifications and the functionality. When you're finally done, one of three situations occurs:

1. You don't want it anymore because it took so long to figure out what you wanted.

2. You find that they don't have anything good enough to do what you want, or that you could build one yourself better than what is availiable.

3. You want the coolest one availiabe, thus making the item too expensive.

Needless to say, we still don't have a voltmeter.

I started my senior year at the UofA right after that, so I had very little time to work with my motors. The motors got shelved for more than a year. A few days ago, I was sitting there thinking, "I'm an engineer now; I probably know enough to fix that." It was a funny sort of realization.

I finally had a little time to pull out the motors again. It still didn't work. I spent a few days trying to figure out why. I finally decided that the circuit didn't do what I really expected it to anyhow, and that I could build one that worked better myself.

I was so excited that my wife had a geek box. Somehow her BYU tuition bought her something useful, where mine at the UofA paid for a lot of crap I never used, and neglected buying me real engineering lab supplies that I'd continue to use for years to come. Anyhow, I've been using her geek box for the past few weeks. She'll either decide she wants it back, or that I can have it. Either way, I'll probably get one of my own here soon so that I can clean up all the random parts strewn all over my desk and office floor, or just because I want to make a manly one instead of hers with seahorse and fish stickers.

I programmed a simple I/O application using the parallel port. I wrote it in Visual Basic because getting the GUI is just so quick. The Win XP's security causes the I/O to the ports to be somewhat limited, but it works for most practical applications. The RS-232 serial protocol didn't really suit my needs because I wanted to be able to control the individual data lines and keep my circuitry pretty simple. I ended up hooking up a 4-channel H-bridge to my parallel port. A little bit-flipping later, my motor was whizzing away.

Well... it sounded like it was whizzing anyway. Turns out I bought a stepper motor with 1.8 degree resolution. It's very accurate and I can tell exactly how far the motor has turned and can make minor adjustments to have a great amount of control over the motor. This is great except it maxes out on the realistic frequency at which the inductive coils can be energized and de-energized, even though that sounds somewhat Star-Trek-ish. Since the motor coils are inductive, it resists changes in current. I could do the math and figure out exactly what that frequency is, but I took the lateral-copout and let the computer do the very-fast guess and check. Turns out that the motor starts freaking out at about 200 cycles per second, which equates to about 30 RPM for my motor... 1 turn every 2 seconds. Yuck. The motor just can't go any faster than that. Oh well. I guess I over-valued accuracy and sacrificed speed without really knowing it at the time. That's what I get for buying my motors before I graduated, I guess.

Once I got the motors going, I showed Leann. She wasn't that impressed, although I coaxed her into giving me compliments on how good of a job I had done. Really I don't blame her, you can hardly see the motor's axle turning. I had to tape a wire to it so that I could tell it was turning while writing the code.

I built my first prototype out of cardboard and coat hangers. Mostly it was just a waste of time. The wheels didn't stay on very well, and the cardboard was too flimsy to hold the motor on straight. The rubber band I was using between the motor and the axle was too strong. It ended up bending the axle and tearing the cardboard. The car only survived long enough to prove that the motor had enough torque to power a vehicle with a little help of gearing.

I pulled up my CAD program and started building a model of my car. I decided that building my car out of Legos would probably be the most practical, so I started modeling individual Lego peices. That took a long time because I was precisely measuring the peices so that they'd be to scale and virtually fit together correctly. After a few hours of modeling I decided to just go buy the real thing. So I got the Quad Bike / Dune Buggy dual set #8262. (If you have legos already, you can download the instuction booklets in .pdf off their website.) I did look at downloding the instructions and ordering the Lego peices off of a 3rd party distributor, but decided that was just too much work. (And you have to buy them in bulk)

I think Leann started feeling bad for me and my pathetic attempts at being a mechanical engineer. But, the best part is that I talked Leann into letting me buy a toy. Yeah, the stepper motors were a pretty good toy too, but that was a long time ago, so I got a new toy. It's been a long time since I actually bought a toy that comes in a box with colorful pictures on the outside with some boy pretending to play with it. I had to drive to three different stores to find one that actually had a decent set of Technic Legos. I needed a set with enough peices that I could make a few different things out of it so that I wasn't limited to just what it was *meant* to build.

Once I got home I built the dune buggy... the more promising of the two instruction sets. The set is meant to be built by a 9-16 year old boy. However, the steering assembly is complicated enough that I seriously doubt a 9-year old boy would ever have come up with that on their own. The poor kid would be doomed to always have to build an inferior Lego contraption. I'm an experienced Lego-builder. I even belonged to the Lego kids club and got the magazine each month. I owned the BlackTron space sets, and my little brother owned the ice vehicles (I can't remember their real name at the moment) I had the vehicle built in about a half hour.

I played with the car for an hour or two. It's a pretty good design, and is pretty fun to play with. It has a steering axle that comes out of the top so that you can turn the wheels while playing with it from the top. That was pretty cool, but in the process of playing, my inner-engineer began to kick in. The steering on the vehicle was just too wobbly. The turn radius was far too small to be effective. Leann went to bed around 11:00 pm, while I stayed up until 3:30 am re-building the steering assembly. Now, this wasn't an easy task. With limited parts, I had to change the vehicle from front-wheel drive, rear steering to rear wheel drive, front steering and improve the steering at the same time. But I managed to do it, and keep the shocks at the same time. The original design also only had power to one wheel off the drive shaft, so I changed it to be 2-wheel drive instead of 1-wheel drive.

Today I hooked the Lego car up to my stepper motor. I still used a rubber-band to transfer power from the motor's axle to the drive shaft of the vehicle. This isn't the best situation because of the stretch factor involved. It makes the car drive in spurts. The rubber-band stretches around the axle until it builds up enough torque and then the car lurches forward and stops. This would be better done with gears, but I have to figure out how to get a gear attached to the motor's axle without permanantly damaging the motor so that it can't be used for anything else. Even though the car didn't drive very fast or smoothly, this time Leann was impressed. (I was actually somewhat impressed myself) The car moved fairly well on my first attempt. Not too shabby.


Anyhow, I'll eventually replace the main driving motor with a plain DC motor so that my car can go faster. But at the current moment, the car is tethered to the circuitry and also the back of my computer so it can only go as far as my alligator-clip leads can stretch. But it's probably for the best. The desk isn't that long, so going faster wouldn't really do me all that much good anyhow. Unless I could get up to 88 mph and add a flux capacitor!

Check out the video of my car. Sorry for the crummy quality, I had to reduce the resolution so that it was small enough for email and such.


3 comments:

G said...

M has my "geek box" out in the garage. He considers the rainbow stickers a badge of honor for finding a good catch, don't you? ;)

Good job, that's pretty cool!

Bryan said...

Nice! I threw away everything from my geek box after too many long days and nights in the labs at BYU. I'm sad about it now. The worst part is the box is still around, but it's holding my wife's sewing stuff. A constant reminder of a hasty action that I now regret. Don't let the froofy stickers bother you. At one point, and maybe I shouldn't admit this, Leann and the other girls had a bunch of us guys putting stickers on our calculators because we all had the same HP 48G and kept mixing them up at study sessions. I think I still have a sparkly star on mine. Anyway, nice car. I was glad to hear Reid in the background helping out with things too. Way to start him out right.

Nick and Serina said...

Matt, you know what the greatest thing about having a kid...you can buy toys "for him" but really keep them for yourself. It's a cool looking car and pretty impressed that you got it out. But than again you are Matt and you could always fix thing back in high school when they need fixing. Enjoy your lego car!!!!