Model train IR detection in hidden sidings

Hi,

I am totally new to Arduino so please excuse if what I am trying to achieve is very simple! I am looking to detect OO gauge trains on hidden sidings using an IR beam. When a train breaks the beam I want a LED to illuminate on a mimic panel to show the presence of the train.

As there will be around 30 IR beams I was wondering if it would be possible with a Mega R3 Board (ATmega 2560) and a Mega Sensor Shield V2.0. I can sort of see how the sensors would connect to the Shield, but not sure how I would get an output to illuminate a LED.

If anybody is aware of any similar projects and could point me in that direction, that would be great.

Thanks in anticipation.

Should be doable. How is your hardware, the sensors and led-panel?
ps. if you just need the break beam sensor to turn on a LED, you likely don't need arduino for that.

You could use an IO expander. MCP23008, SX1508B/SX1509B. They can both read the IR sensors and drive LED.

Can you sketch out how you’re planning to hook it all up ?

On an envelope, draw a single input circuit.
Take a photo and post it here in a new message. We can imagine the other 29.

For LEDs, you simply wire from an output pin to the LED anode, then wire from the cathode to a current- limiting resistor, and then from the other end of the resistor to GND. Times 30.

Hello cliff007

Welcome to the best Arduino forum ever :slight_smile:

Simply use the I/O monster Arduino Mega to eliminate other hardware as possible sources of error in the operation of the model railway.

Learn to use arrays to manage your inputs and outputs, makes your code so much simpler.

That depends on how many LEDs could be on at one time.

Agreed, it seems a waste of an Arduino.

Or... wire from an output pin to the LED cathode, then wire from the anode to a current- limiting resistor, and then from the other end of the resistor to Vcc.

This would be the way to do it if using a PCF857x I/O extender.

You mean when the train arrives in the siding it breaks the beam?

You could also consider mounting the IR LED and sensor (phototransistor) together under the track, pointing up, or at one side of the track pointing across. When the train arrives it will reflect the IR light back to the sensor.

Of course; although, many beginners seem confused by low-is-on configurations; many ways to deal with that.

Bigger issues with 30 LEDs will involve total current loads, as he's also powering the emitters.
And as others observed, if there's no follow-on logic no Arduino is needed at all.