Model train IR detector

John’s been in touch with a very clever Model train IR detector:

“Hi Al,

Your website and the products you offer are great for any level of model railroading, and recently I saw a few folks missives on signals, so I thought I’d send you my updated cheap train detection article.

I’ve been trying to get some way to detect trains as they pass, and drop signals to red when they go by.

There are some good detectors out there, but I wanted to see what I could figure out on my own. I’ve been fooling around with the little sensors used in manufacturing mostly made to send a signal for something, like a light being on, or to turn on lights when dark, or objects passing by on an assembly line.

How about people sensors? Both types had some utility, well the turn on the lights did just that, but not when I wanted to run trains.

The people sensors… well OK… sensed people, not HO trains, and when I adjusted the sensitivity they detected everything but trains.

Back to research, and success!

I found little IR detectors on eBay for $2.00 each. A lot less than that from China (just ordered 20 more for a total of $10.33!) but it takes a few months mail, and customs, and red tape to get here from there.

They are called Arduino PIC AVR IR Infrared Obstacle Avoidance Sensor Module Object Detector, and eBay has a ton of vendors selling them.

Size is about 16 mm by 50mm with a plug attached. They run on 3.3 to 5 volts DC, and will detect anything directly in front of the sensor diodes.

They work by sending an InfraRed beam out of the dark diode which is supposed to bounce off the detected item back to the detector Diode, which changes state when InfraRed comes in the front of it.

Out of the package, they will detect from as little as 8 mm and, with playing with the on the board potentiometer, out to about 40 mm.

They react fast, and in a few tests actually picked up the space between the passing HO cars. Not good. So I decided I would modify the detector, but quickly determined that connecting everything with jumpers and alligator clips was tedious and confusing.

So I made a little test board. It has a place to connect my power supply, a common cathode, type “D” 2 color signal, and a relay to get the trigger from the detector and change the signal. I use a relay, also from eBay, 1 Channel Relay Module 5V Optocoupler LED for Arduino Pic ARM AVR (also on eBay) note that it has the same plug as the detectors.

These are single pole – double throw relay that work with the same voltage as the little detectors. By having several in tandem I can control all sorts of stuff, like killing track power if a switch is set in the wrong direction (called trailing a turnout, by the way) and a train is approaching the error set switch.

Obviously I can turn on road crossing signals, and by leap-frogging the relays, can have a real signal system – where operators go on green only.

As I got into the detectors, I realized that not only the range was a problem, but putting them in some kind of structure so they could “see” a train going by would also be difficult.

As we see in the pictures, the wires and little IR and Detector diodes are really small, and can easily be hidden in a trackside trash-can and maybe a tree stump on the other side of the tracks.

Since I’m planning on having a dozen or so of these detector/relay/signal sets, I also bought some 3 conductor Arduino plugs/connector sets that plug into the board and relay.

The circuit design is:

circuit wiring diagram

I found that the relay below is just what I needed to make a tester, but decided for the layout I’d get a bunch on one board, they come up to 16 relays on a board but I ordered a few with 8 relays.

1 Channel Relay Module 5V Optocoupler LED for Arduino Pic ARM AVR:

1 channel relay Model train IR detector

8 Channel Relay Module 5V Optocoupler LED for Arduino PiC ARM AVR

8 channel relay Model train IR detector

I wondered if I could remove the IR LED and Detector LED, and if they needed to have a specific wire lead length.

I decided to try to un-solder the IR-LED and Detector LED and extend them on longer wires, this allows for them to be hidden in most anything on the railroad, like in cars waiting at a grade
crossing, or in a little signal box next to a switch.

Some care needs to be taken as the little IR Led and Detector are unsoldered, wires extended, and shrink tubing applied.

Be careful not the lose the polarity. I added about a foot of wire, and 6” to each LED, like below.

Since they face each other now, their mode switched and they send a detect signal until the space between them is blocked, out of the box and mounted side-by-side, they look for reflected IR so they are normally not detecting.

So, how to detect the trains without blinking as the detector “sees” the spaces between the cars?

Decided to shoot the beam on an angle like below:

train signal detector

My signals, most from China, are LED common cathode, so the schematic shown above is how to wire them with that configuration.

If common anode, reverse the + common to the relay and connect the negative to the LED’s.



What I found is that when the IR and Detector are facing each other, the range is really increased. I easily detected a card blocking the beam from more than 6”.

When my test railcar even gets close, the detector hits it and the detector will report “track occupied” to the relay, which turns the signal red.

I’m planning on also having a parallel LED on my control board to also see where my trains are, and what tracks are occupied.

Humm, maybe a detector to see when someone opens my beer fridge would be an ancillary use?

Take care,

John From Baltimore”

model train detector

Model train IR detector

Model train IR detector

Model train IR detector

A huge big thanks to John for sharing his Model train IR detector.

Here’s his last post if you want to get up to speed with his layout: Model railroad quarry.

model railroad quarry

That’s all for today folks.

Please do keep ’em coming.

And if today is the day you get started on your layout, the Beginner’s Guide is here.

Best

Al

PS Latest ebay cheat sheet is here.





HO scale railroad signals

Henry’s been back in touch with an update on his HO scale railroad signals:

“Hello Alastair

After seeing the post on my signal system, I thought I need to update you and our community on the developments that has taken place since that signal system was used.

As my layout and operating sessions progressed, so did the need for a more realistic signal system.

This lead to some new designs and more electronics being employed.

I needed the following from the signal system, interlocking and tracking.

Interlocking means that only one signal at a time can be green, and the rest stays red, till the green one changes to red, then any of the other signals can change to green.

Tracking is the term used here in South Africa for automatic return of the signal to red once a train passes it.

To accomplish the interlocking, I made use of self locking relays.

In order for the relay to make a positive switch over, a small electrolytic capacitor was added to the circuit.

It works on a simple switching principle. Once a signal is activated by a pushbutton being pushed to turn it to green, it disconnects all the other switches that none of them can switch a signal to green.

This is accomplished by using a double pole relay, one pole being used for the signal itself, green or red, the other pole being used for self locking and interlocking.

When there is no power applied to the relay the contacts are in the normally closed position.

I wired the red signal to normally closed side of the relay, so if there is a power loss for the relays all the signals automatically turn to danger.

The normally open side connects to the signal’s green LED.

This solved the interlocking problem, but I still had to accomplish “tracking”. Switching the signal back to red once a train has passed it.

I tried different methods, current sensing, optical detection and infra red detection.

I found that for me the optical detection worked best in this application. I could use one optical sensor to control a few signals.

At my main passenger station, one optical sensor tracks 4 signals.

The optical sensor disconnects the negative supply wire to the self ocking relays, so then they all return to the danger position.

For block signals, I opted to go fully automatic, using a current sensor to switch the signal to red once the block is occupied.

I also used this system with my Semaphore signals, which are powered by a small drone motor and propellor, creating a vacuum which activates the semaphore blade.

I include a video of the block signal system and a circuit diagram of the signal system, without the optical sensor.

Henry”

HO scale railroad signals

HO scale railroad signals

HO scale railroad signals



signal system wiring diagram



A huge big thank you to Henry for sharing his HO scale railroad signals update.

It reminded me of Gary’s post on HO scale signals.

That’s all for today folks.

Please do keep ’em coming.

And if today is the day you get started on your layout, the Beginner’s Guide is here.

Best

Al

PS Latest ebay cheat sheet is here.

PPS More HO scale train layouts here if that’s your thing.





Denny’s layout

Denny’s been in touch.

It’s a joy to post his layout because it’s easy to see he’s had fun.

And frankly, that’s all that matters:

“Good Morning Alastair,

Spent two years during the pandemic and fighting an incurable cancer and my amateur train platform doesn’t come close to the professional looking job that others have posted but thought, what the heck, here are some evening pics of my platform.

Denny”

model railroad

model train loco

model train curve

model train football field

model train LED lights

model train LED lights



Now on to Arnie:

“HI Al,

Arnie here from across the pond in hot sunny Florida working on starting again on a layout.

Fell 2 yrs ago and broke my femur and using a walker. Makes it hard to get close to the table. Anyway decided to downsize from 60 x 72 to 30 x 72 and work on a new layout.

Enclosed is a copy of the plans with pictures to come in the future.

The layout is done on SCARM and is 69×31.

Have several different routes on the layout and can go from the outer to the inner and back again. The table is 30 x 72. I have foam on it and it extends the table a bit.

The track is Bachmann N scale e-z track and it has 15 points of which several move depending on the path of the trains. We can run two trains around and switch them back and forth between routes.

Based on no era I decided to just put it together. The switches are wired and powered up and the engines do run over the layout over different routes.

The control is Digitrax DCC.

I want to thank you and all your readers for being there and sharing tips and tricks for your blog.

I do belong to a club in the community I live in and we run both N and HO scale.

Please keep up the good work as I look forward to your blog each morning as I read my E-Mails.

Attached are two different versions of the layout. I haven’t decided which way to go yet. Maybe your readers can help.

Arnie”

model railroad track plan

model railroad track plan

“Hi Al…

Been back up in North Yorkshire again, with a visit to Goathlands better knows as Aidensfield in Heartbeat, with of course a ride on the Railway, being hauled along by the Big 9 F Steam Loco, and at last it had cooled down enough to just spend a bit of time in the loft and run a few of my own Trains for a change.

Regards

Dave”

daves model railway

daves modelrailway



A big thanks to Denny, Arnie and Dave.

And please do comment below on which track plan Arnie should use.

That’s all for today folks.

Keep ’em coming.

And if today is the day you stop dreaming and start doing, the Beginner’s Guide is here.

Best

Al

PS Latest ebay cheat sheet is here.