Detecting IR

Hi,

I’m trying to use an IR LED and a Phototransistor Detector to detect a break in the light between them. This will act as an optical sensor on a home built SkeeBall game. When the ball drops through it breaks the light, is detect by the Arduino, and the score is adjusted accordingly.

I’m trying to use the “Matched Infrared Emitter and Phototransistor Detector” from Radio Shack:

I setup the circuit according to the instructions here:
http://www.instructables.com/id/SLEX4JEF6B7T1V2/

I can see that the IR LED is working because I can see it glowing using my digital cameras viewfinder.

But I can’t get any predictable readings from the phototransistor detector.

I tried the code on the site where I got the schematic, but that didn’t work.

I’ve also tried this code and switching the wire from analog pin 2 to digital pin 2, trying to get down to just getting a reading from the sensor:

int val = 0;
int val2 = 0;

void setup()
 {
   Serial.begin(9600);
   pinMode(2, INPUT);
 }


 void loop()
 {
   delay(500);
  
  val = digitalRead(2);
  Serial.println(val);
  
  val2 = analogRead(2);
  Serial.println(val2);
}

If nothing is connected to analog pin 2 it reads somewhere around 360, when I’m plugging in or removing the wire it jumps to as much as 600 or as low as 200, but stays at 0 when the sensor is plugged in. I’ve tried reversing the polarity of the sensor, and I’ve tried it with and without the 10k resistor. I’ve used multiple sensors to make sure I didn’t fry the first one.

Any suggestions? Or a better alternative for trying to sense a ball dropping through a hole (a single pin solution is preferred since I’ll have 6 or 7 holes to monitor, each with its own point value).

Thanks!

Try this. http://www.instructables.com/id/Protect-Your-Home-with-Laserbeams/ instead of infrared you could use a more direct way by using a laser. hope this helps.

Funny you mention that. After posting I did quite a bit more reading and found a bunch of places showing how to easily interface with photoresistors (which is what that video shows), so I had decided to give those a run.

http://www.markroland.com/physical-DOM/ http://www.wiring.org.co/reference/electronics/photoresistor.html

Just for cost (since I'll need at least 6 or 7 of them) I'll still use LED's, but they should work great with the photoresistors.

Thanks!

Just for cost (since I'll need at least 6 or 7 of them) I'll still use LED's, but they should work great with the photoresistors. Thanks!

Laser pointers on ebay: http://cgi.ebay.com/Lot-of-5-Red-Laser-Pointer-Set-with-12-Head_W0QQitemZ110278851526QQihZ001QQcategoryZ14886QQssPageNameZWDVWQQrdZ1QQcmdZViewItem

5 for $10 shipped. The same seller has 48 for $50 shipped.