13 June 2010

Dealing with a scavenged P1241 / P1242 optical switch

The general historical considerations will have to wait.

As of lately, we have been feeding on a steady diet of computer carrion, and especially used printers. Actually, I have found that, for a 6 year old, methodically dismantling a printer is a quite powerful incentive to concentrate on something other than TV, pokemons or whatever is fashionable in the sinister gloom of schoolyards. So I make sure the pipeline of stuff-to-dismantle stays filled.

Printers -the older, the better- do yield many useful components. Among them, stepper motors, cabling, springs, steel rods, and several opto-switches.

Early Epson impact and inkjet printers feature fine stuff. The more recent the printer, the less decent components you may expect. The nadir of this trend might have been reached with recent HP inkjets, all DC motors combined with linear encoders on a flimsy thin strip, and no fun.

But at the very least the HP's left us with several "slotted optical switches", labeled P1241 C5 88 (or P1242). Useful to make our own brand of opto-endstops and taking over the world schemes. If only we had some data on them.

This lad must have an IR diode in one side, a phototransistor on the other, and three identical wires coming out of it.
We can guess: +VCC (presumably 5V), GND and DETECT.
So we did some conduction testing with the multimeter. Only one combination conduces. Let us label the wires: +VCC for the one connected to the multimeter's red wire, and GND for the other.
The remaining wire must be DETECT.

We attempt some connexions. After some trial-and-error with the resistance values and a fried opto-switch, we settled on this one:

R2 is a current-limiting resistor (1/4 W). 1 K works OK!
R1 is a pull-up resistor, 100K is more than enough. We found this stabilizes the signal.

The opto-switch's outputs:

No slot obstruction = 0v (+/- 0.2V)
Close = 9V

Why 9v? if only we had the data sheet... But ok, it works.

(BTW: anyone got a better idea?)

Let us fetch that Arduino!


  1. Thanks a lot. This was helpful for my own plotter I'm making ( also from epson parts). One thing that helped me was when I realized why this statement was true: "+VCC for the one connected to the multimeter's red wire, and GND for the other." It is because the Infred LED is ... well.. and LED. A diode. Which only lets electrons pass one direction. If you switch the test leads, you won't get a reading.

    1. Thanks! I am also making a plotter from an old HP printer. Did you manage to use the printer's plastic position strip to determine the position?

  2. Dude, you have to use the diode function in your multimeter to measure the forward current. Using the ohm-meter won't work. You have 9V because you supplied +5V to the detect line(5V+4V=9V). Instead of connecting the detect line to the 5V you should connect it to a LED so you can tell when the device malfunctions.