Amplify photogate signal

I have extended a slottet optical switch (the kind used in endstop detection, paper in path and so on) by swaing it in two halves and now it detects accross a gap of 25mm (an inch or so). Unfortunatly the signal when the path is clear (no obstruction) is not really enough to give a reliable signal to the Arduino input pin.

So I twiddled with a transistor and twirled with a few resistors and after some while I got it to work (to my own amazment and delight). The device sits inside a tube (little external light to confuse) and the obstruction is a steel ball (definitly opaque!)

I strongly suspect though that this is not "optimal" it may be sheer luck, the values of resistors might be better and so on. So dear circuit experts, the thread is open for constructive comments :).

Attached the screen shot of the Fritzing image (where I have shown an optisolator instead of the real photogate - which is a SFH 9315; the transistor is MPS42G) in breadboard and circuit format. I have the same in Eagle, have indeed etched a PCB from it but it failed for other reasons. Before I do a new one, I just want your input, please.

OptoAmp_BB.gif

OptoAmp_CS.gif

What is your LED? If you make it an IR one you can get a lot more light out of it by dropping the resistor value. That would increase the range and reliability.

I've bought a bunch of these "Slotted Interrupter" and saw in two halves. That way I am sure(?) light emmiter and reciever are matched wavelength wise. (And I even gave the link to the datasheet :wink: ) Its is 950nm and max 40mA and it will be always on while the machine is running. Well, so I can use 150Ohm there. Thanks.