Finding a good IR sensor for a arcade basketball machine

I brought a IR sensor for my basketball machine. (This is the one I brought: http://www.newegg.com/Product/Product.aspx?Item=9SIA2C518A7490&nm_mc=KNC-GoogleMKP&cm_mmc=KNC-GoogleMKP-_-pla-_-Automation+%26+Process+Control-_-9SIA2C518A7490&ef_id=U975oQAABAqYexKt:20140804031025:s)

But it turned out that most of the time the count was missed. I guess it is because the ball went through to quick or it is too far from the sensor when it got through, or both. Does anyone know if there is a nicer IR sensor model that can sense quick motion. Or is there a better way to do the sensing using a different sensor or multiple sensors?

Also, it kept counting while the ball was looping around the rim, is there a way to avoid that?

Thank you :slight_smile:

This may sound like a silly question but did you remember to put opaque tubes around the led and sensor so only the top of the devices is exposed ? (and they are optically isolated from each other)

raschemmel:
This may sound like a silly question but did you remember to put opaque tubes around the led and sensor so only the top of the devices is exposed ? (and they are optically isolated from each other)

I didn't know that the led and sensor have to be cover. It works without putting anything around. But I can try to see if it works better that way. Thank you!! :slight_smile:

There is supposed to be an opaque tube over the led and the phototransistor so the light travels out of the tube , hits an object and reflects back to the tube with the photo-transistor in it traveling into the tube where it is detected by the photo transistor. This prevents the photo transistor from receiving light directly from the led. If you say it works as is that means the led case must be blocking the light from escaping from the sides allowing the light to leave only from the top of the led. Otherwise it wouldn't be working. I saw tutorial where they put tubes around them. Maybe it is unnecessary.

S_sneeze:
I brought a IR sensor for my basketball machine. (This is the one I brought: http://www.newegg.com/Product/Product.aspx?Item=9SIA2C518A7490&nm_mc=KNC-GoogleMKP&cm_mmc=KNC-GoogleMKP-_-pla-_-Automation+%26+Process+Control-_-9SIA2C518A7490&ef_id=U975oQAABAqYexKt:20140804031025:s)

But it turned out that most of the time the count was missed. I guess it is because the ball went through to quick or it is too far from the sensor when it got through, or both. Does anyone know if there is a nicer IR sensor model that can sense quick motion. Or is there a better way to do the sensing using a different sensor or multiple sensors?

Also, it kept counting while the ball was looping around the rim, is there a way to avoid that?

Thank you :slight_smile:

Looking at the description, it sounds like that sensor is meant to detect reflective objects nearby. If you want to make a photo sensor that detects a basketball going through a hoop you will probably need a reflective surface on the far side of the hoop that the IR light can bounce off of. When the ball falls through the hoop it will block the beam.

If you are already detecting balls if they fall slowly, it might be that your hardware is ok and you have a software problem.

You might want to use an interrupt, tied to a falling state on the input line, to detect balls. In the interrupt code increment a count global and set a "count_changed" flag. Then in your main loop, if count_changed== true, update the score display.