Introduction: Tiny Optointerrupter Photointerrupter
Surely, some of you have had the pleasure of ripping into an old printer or scanner to harvest some really cool components? Some of you have run across some nice stepper motors, power supplies, small DC motors, solenoids, and -- of course-- optointerrupters in various sizes, shapes, and forms.
Not too long ago, I was building a robotic controller with an old CDROM stepper. I and wanted to have a way to safeguard the very end of the travel path on the lead screw. I used an optointerrupter. I found another optointerrupter and used it on the other end of the lead screw. I wanted one more to show the home/reset position. I dug through all of my printer supplies and found this (depicted above with question mark) little "doo-dad!" It's another optointerrupter, but it's wired a little differently. What the Heck? I found many of these on HP printers. They aren't marked. Most optointerrupters that are shown in diagrams have An "E" for the emitter, and have an "S" for the sensor. HP usually has a small breadboard form-factor with three wire leads extending from the board just like the picture above. Some have been used as rotary encoder sensors.
Fear Not, for I have figured the "little booger" out, and it's just another optointerrupter, just smaller.
This instructable will demonstrate how to use the tiny optointerrupter it to switch an LED on and off.
- salvaged "little booger", optointerrupter
- 2M Ohm Resistor
- 180 Ohm Resistor
- A Breadboard
- 330 Ohm Resistor
- LED Light
- A handful of Male-Male Cables
Step 1: The Wiring Is a Little Different
Understand that this optointerrupter is slightly different.
Once again, a standard optointerrupter will have a simple LED, "E", on one end and a sensor, "S", on the other.
The Standard Optointerrupter
The LED, "E" end, is just like any other LED -- it needs a resistor. I like to use a 220 Ohm resistor on that end of the standard optointerrupter. Most common IR LEDs use lots of amperage-- nearly twice as much as a common white LED. A 180 Ohm resistor is also adequate on a 5v current.
The "S" side (sensor) is hooked up to ground and the arduino data pin to collect the input. To make sure the data pin is not triggered and remaining in the ground state, a leak is created on the arduino side with a 10k Ohm resistor to bring the arduino pin back to "+" (HIGH).
The Tiny Optointerrupter
But wait, The little optointerrupter on the board only has three wires coming from the small indepentent breadboard. ...and it doesn't have any "E" or "S" printed on it. Yes, you can desolder the little optointerrupter from the board-- but you should do this instead.
Look at the first picture in my series of pictures above. This is the easiest way to use the optointerrupter for an arduino. I tried a number of resistors between the collector and arduino and the best performance seems to be with this set of resistors, a Two Mega-Ohm, and a One Hundred-eighty Ohm , on a 5v circuit.
Step 2: Wiring Up
Wire up the Optointerrupter and the LED as shown above. If it's wired correctly, you should be able to see the little infra-red light from the optointerrupter's LED side with a phone camera.
Now upload the code to your Arduino.
This is a standard Optointerrupter code from the Arduino library-- nothing extraordinary.
Once uploaded, you should be able to trigger the light.
Oh yeah, you can see your serial bus feedback at a rate of 115200 baud.