Go Down

Topic: Slot Sensor with Arduino (Read 3 times) previous topic - next topic

LavenderSmile

Hi I am trying to use an optical slot sensor with the Arduino to sense a coin drop and I can't find any schematics for the part. It is this part from digikey http://www.digikey.com/scripts/DkSearch/dksus.dll?KeywordSearch, from the opb800series. Has anyone used this part before? Does anyone have any idea how to set it up. Thanks!


jims

You have an LED and a phototransistor. When the LED is powered and nothing is blocking the light the phototransistor will conduct in one direction. If the LED is not powered or something is blocking the light then it will not conduct.

Take a look at the wikipedia article on Opto-isolators, that is basically what you have except something can block it.

I little Ohm's Law work will tell you to use a 220 ohm resistor for R1 to keep the LED current to about 20mA, safely inside the pin capacity of the Arduino and the capacity of the LED. R2 is a little trickier. I think I'd size that for a 1mA current flow, no need to get crazy with the power use, maybe a 4.7k ohm resistor. You might need to play with that a bit to balance out the sensitivity with varying ambient light levels.

So to continue, if you connect an input pin between R2 and the phototransistor then it will be low until a coin slides by when it will blip high.

You must poll very fast to catch it or use an interrupt pin.

wandrson

Another possibility (instead of an interrupt or fast polling) is to use something like a 555 in one shot mode to trigger a fixed duration pulse.  This pulse could be 100-200 milliseconds long.  Depending on your preference you could trade software complexity for hardware complexity.

Joseph Duchesne

I would suggest a simple mechanical device such as a really weak leaver that would just break connection while the coin goes through.

kg4wsv

I hada couple of mice (old ball mice, not new optical style) apart yesterday, and they both use slotted a encoder wheel, LED, and phototransistor for each axis.  Maybe you could get some ideas (or even some parts) from an old mouse.

As far as the interface goes, I'd use an interrupt; the arduino handles interrupts easily, and you won't have to worry about missing events if you poll.

-j

Go Up