By Rob Turner
Youve been thinking about constructing a small robotic platform, maybe control a few motors for some special applications and you want to get off cheap and use dc motors. Well, its going to cost you. DC motors usually need things like gearboxes, and location sensors if you want to get any use out of them. But if all you need is continuous rotational motion or linear motion until a switch gets bumped, this is the motor. Speaking of linear motion, here is a little recipe side dish:
A good linear setup can be easily made with a Radio Shack 3 volt DC motor, a square 1/8 inch styrene tube, and about 5 inches of 256-threaded rod. Cut an inch of the styrene tube and pressing it onto your motor, making sure the shaft still rotates. Now you simply start screwing the threaded rod into the other end of the styrene tube. Isnt it cool how the threaded rod taps the styrene for you? For a real good hold, use modeling or crazy glue to hold it in place.
Now you can mount the motor into your project, or attach a slide to it. I like to use a 0.3 inch piece of 1/8" styrene as the part that slides up and down the screw. Once again I just use the screw to tap it, and I usually just glue the outside of the piece to whatever it is Im trying to move. Or I press the small styrene piece into a larger brass tube using a little glue to secure it. Piece of cake.
Now all you need to do is determine where the slide is on the screw and youve got it made. True gear heads use optical encoders, I like to use a switch. With a switch its easy to determine where the beginning of the slide is, and I can just send a pulse to the motor and get the assembly to move to approximately where I want it. It seems like Im forgetting to tell you something
So now that you have this cool linear slide, you probably think this would be a great app. to use up some of those micro-switches that youve had in your junk box since you where seven years old. Sure, you can use those switches to sense when the slide is at the end/beginning of the its range, right? Nope. Its ok I use to think I could use those too, I even convinced myself that those switches where actually made to stop when something bumps into them.
The reality is those switches where made to fill space in your toolbox. If micro-switches where meant to stop anything with any kind of momentum, they would have made them so they activate sooner and not bind up the second an object in motion. But fear not! We will simply construct our own.
Switches are actually pretty easy to build. A spring, a contact point with a stopper, a little insulation, an outer case, youre in business. Lets build one real quick.
Its pretty easy to make a spring. Using a 6" length of 1/16" square brass tube, insert one end of the steel wire into the tube, and crimp the tube shut, thus securing the wire. you are now free to wind the wire tightly around the tube, leaving no gaps between the coils. After you have wound wire down about an inch of the tube, snip the excess wire off at the top and the bottom of the spring using an old pair of wire cutters since the steel wire tends to nick the edge of the cutters.
The wire will recoil slightly, making a pretty cool little spring about 0.1" across with bends in it that form hexagonal coils. Now just pull the two ends of the coil apart and stretch the wound wire until the distance between the coils is a little less than 0.1", and the spring is unable to pull back to it's original shape. Snip off a smaller spring about 0.4" long.
0.4 inches of 1/8" Styrene. Youll learn to love this stuff.
For the case I just used some square brass tube 5/32" actually, about 0.4" of it. The contact is just a thin piece of square brass tube (1/16" about 1.4 inches long) that runs down the center of the styrene. The styrene is glued into the larger piece of brass. For the stoppers I cut two 0.2-inch pieces of styrene, one piece fits flush on the end without the spring, and the other piece is glued on so as to add a little bit of tension to the spring.
Solder a wire onto the contact piece and one onto the outside of the case. I use silver solder, it holds well. Now assemble like the picture using glue to hold the styrene stops onto the contact rod, and the styrene insulation in the case. Easy on the glue, if you get it on the contact rod and it glues to the insulation, things wont slide.
Now I glue or solder the case of the switch right below the motor and allow the slide assembly to bump into the contact switch. On my projects the slide assembly is metal and grounded. So now I can just run a 10k-ohm resistor from say, +5 volts to the contact rod. Now when the contact rod hits the slide assembly I get a nice TTL low for my microcontroller. The spring allows the assembly to come to a slow without binding.
The assembly is now ready to start moving back out with no problems.
Your going to have to make adjustments in the tension of the spring and the position of the switch to suite your application. You might even want to eliminate the back stopper and replace it with a couple pieces of brass tube so you can make a normally closed switch. As long as you understand the basic concept of what your application requires and what you need to do to get your project to work, youre cool. After all, thats what hobby robotics is all about.
If you have a small DC motor and you want to hook it up to a processor or a controller easily, I would highly recommend using L293D motor controller chip. Richard Hughes (http://members.aol.com/rich924) has good prices and even got me the surface-mount version. For most of my applications I use the Basic Stamp II but I know SRS Robohackers arent like the rest of us- theyre different. Here is a generic schematic with the control lines labeled.
Notice that the L293D supports two DC motors. Pin 16 is the +5 voltage for the chip, while pin 8 is the voltage for the motors. The first motor gets hooked directly to pins 3 and 6. The motor is turned on by sending a high signal to both the enable (pin 1) and one of the two direction pins, lets say pin 2, while keeping pin 7 low. To go the other direction keep the enable pin and pin 7 high while pin 2 goes low. To stop enable pin is high while both 2 and 7 are low.
The same goes for the other side of the chip. When driving two or more motors I like to hook pins 2 and 15 together and pins 7 and 10. Sorry to say I dont remember what the specs are for this chip, I usually send about 6 volts through it with a 0.7-volt drop for the L293D internal transistors, and I expect a 200 to 300 milli-amps total for both motors.
Rob Turner, the crazed slightly psychotic Robohack, had to start limiting his caffeine intake when he started getting headaches before AND after drinking coffee. After being lured to a Twin Cities Robotics meeting, Rob has maintained affiliation and continually draws on its members for suggestions and support. His current projects include ARBi the biped (no ARBi doesnt walk yet, but he does stand on one foot), a Hexapod, and a 3-D maze for the potential Twin Cities Robotics thing in 1998. His email address is ROBT612@aol.com.