I've built the first, very ugly rotary encoder on the left motor. It consists of a sheet of copper PC board with a basic circuit of a infrared LED, an infrared detector, and a transistor. Three resistors are included, each one feeding from the +5 volt power line to the device.
I attached a modified cat food can on the end of the motor shaft. It attaches nicely where the previous brake material was and is held in place with that mounting hardware. I trimmed down the sides and punched 16 holes around the sides. I'll spray it black before the final assembly.
Here's how it works : the motor spins the cat food can with holes. On one side, the infrared LED shines, and inside the infrared detector sees this flashing on and off as the holes spin in between. The output from IR detector is fed into the base of the 2N2222A transistor. This acts as a switch, conducting and changing the voltage across the collector and emitter. This voltage is fed up the cable to the Arduino microcontroller, where it will be counted and thus tell how much the wheel is moving.
The IR LED shines from the outside into the center and hits the detector.
The circuit construction is hideously rough, and I should have a much nicer looking second one when I make it. I first tried a NJ Island pad cutter but didn't lay things out very well, so reverted to Manhattan style islands clipped from bits of PC board. It's rough, and I still need to glue down some parts.
The circuit board is resting on a felt furniture pad - a small chunk of adhesive backed felt that's used under table legs and such to protect your floor. It's sandwiched between the board and motor case by machine screws in the holes that previously mounted the brake.
A three wire cable will hook this up to an Arduino ... one wire for +5 volts power, one for the signal coming back from the detector and 2N2222A transistor, plus the ground shield.
(The copper wire coil on the left is completely useless and is not wired into anything. I added it as artistic eye candy.)
As rough as this looks, it works and should be rugged once I reinforce it with some epoxy.
I'll get a parts list, schematic and hopefully a nicer looking second encoder for the next time ...
Tuesday, May 4, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment