What's my best option for a sensor in this situation?

Greetings all, I posted another thread and got some great advice about a prototype I'm working on for a model railroad project I'm working on with my dad. Essentially we'll be using an Arduino to do certain things when it detects a train in a certain spot on the track. But what I'm looking for is advice on the best "sensor" option I have.

I do a lot of work with pinball machines so my first thought was to use an IR transmitter and receiver and shoot the beam across the track. Pinball Life (the lowest cost pinball parts supplier) sells sets of them for $7 ( http://www.pinballlife.com/index.php?p=product&id=167 ). I even did some reading and made a simple Arduino sketch to test the opto setup and it works LED turns on when the beam is present and goes out when the beam is broken--I'd use this to trigger an event. The problem is that the optos aren't exactly small or nondescript so they would be hard to disguise on either side of the track. So I'm looking for some expert advice on if there's a better way to do this? Perhaps some kind of sensor under the track or something that shoots up through a hole in the track?

My concern is that something like a light sensor (while probably very inexpensive and easy to wire, which are both big pluses) would get tripped if we ran the trains in a "night scene" or if anyone turned out the lights!

Thoughts? Thanks!

Sounds like you've done some good work, congrats!

What about something like this? Infrared emitter and detector in one package. This is just one example, I'm sure there are dozens of similar devices. It may be necessary to put some reflective tape or something on the bottom of the train if that is permissible. Or maybe it would work without it. At any rate, some experimentation would be needed.

PS: Mouser stocks over 100 "optical switches" the one I linked above has a range of only a few mm which may not be enough. So some research is needed. Luckily, Mouser's parametric search includes sensing distance.

You may also be interested in this thread…

research proximity sensors, some of them com in really small packages.

+1 on the reflective tape or just kitchen foil.

[quote author=Jack Christensen link=topic=233796.msg1683538#msg1683538 date=1397689971]What about something like this? Infrared emitter and detector in one package. This is just one example, I'm sure there are dozens of similar devices. It may be necessary to put some reflective tape or something on the bottom of the train if that is permissible. Or maybe it would work without it. At any rate, some experimentation would be needed.[/quote]

You can blink the IR emitter and watch the change in value from the IR detector. If your detector is seeing ambient light then there will be a marginal change in reading between when the IR emitter is on or off, and if there is something reflecting the IR light then the change in reading will be much more pronounced.