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.
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.)
I'll get a parts list, schematic and hopefully a nicer looking second encoder for the next time ...
No comments:
Post a Comment