Karma

Published: Mon 17 December 2007
By john

In trains.

Karma is coming back to eat my dogmafood.

In 1998, I took a course at RPI called Introduction to Engineering Design. It's the big engineering project course, where they take teams of engineering students of different types (chemical, mechanical, computer, electrical, etc..), give them a problem and a budget, and then it is each team's job to design a solution and build a working prototype by the end of the semester. It's required for every engineer, and it's really important because it's one of the few classes at RPI where you actually have to both design and build something. You get out from behind the computer simulations an go rummaging around junk yards and wielding power tools to actually create things with your hands. Every engineering school has a course like this. It's a right of passage.

In my IED course, my part of the project was to design a motor controller with random movements using a microcontroller. That's when I bought the BASIC Stamp controller that I still have today and am using to control my point-to-point trolley setup. Everything worked great until the day of the final project, when the microcontroller simply refused to do anything but spin the motor in one direction. Not devastating for the project as a whole, but it cost me an A in the class and I never did really figure out what went wrong. I had my suspicions, but when you're done with a class like IED where you spend the last few weeks basically living with your team working day an night to get things built and working, you want nothing more than sleep. And sleep I did, for about a day and a half if I recall correctly.

Auto-reversing circuit Now, fast forward to today. I'm building another circuit with the BASIC Stamp. After spending all night wiring up all the IR circuits and detectors to the real 8'x4' layout, and running wire back to my protoboard, I turned everything on for the first time. Of course, the IR circuits aren't working for some reason, so I'll have to figure that out somehow. So I decided to just make sure my auto reversing circuit worked. This circuit consists of 2 5V relays, hooked up to pins on the Stamp through a transistor. One relay stops the train (breaks the circuit), and the other reverses the direction of the train. The microcontroller simply runs the train for 5 seconds, stops it, waits 2 seconds, reverses the train, waits 2 more seconds, and then starts it for 5 seconds again. It does this in a loop. But when I run even just that code, it fails to run correctly. Instead it runs in one direction only (or stops, and the continues in the same direction.)

It slowly dawns on me.. This is exactly the same type of circuit (2 relays), and exactly the same problem I had 9 years ago that I never solved. I have my suspicions, I think I left the reset pin floating, which is probably getting wiggled by the relay coil flipping about an inch away. It's too late to do more tonight. If that's not it, I don't know where to go next.

Sometimes, karma really is a bitch.

blogroll

social