Infrared detectors for model trains

John has been in touch with how to put together the infrared detectors for model trains.

“Hi Al,

It’s been awhile, been busy working on some real railroads since many of the folks who normally do the work are locked down and can’t travel, but I’ve been reading the posts every day.

Your website and the products you offer are great for any level of model railroading.

Now to my latest project. 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 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, but the turn on the lights did just that, but not when I wanted to run trains.

The people sensors… well… 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 less than $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.

infrared detectors for model trains

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.

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

They react fast, and in a few tests actually picked up the space between the 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 note that it has the same plug as the detectors. This is a single pole – double throw relay that would work with the same voltage as the little detectors.

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

The circuit design is:

infrared detectors for model trains

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.

infrared detectors for model trains

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

infrared detectors for model trains

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.

infrared detectors for model trains



Here is my little test board with a detector not detecting anything.

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.

model train detector

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:

model train 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 reallly increased. I easily detected a card blocking the beam from more than 6”

model train detector

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.

Next project is rebuilding a roundhouse turn-table! Everyone be safe, and happy modeling!

John from Baltimore.”

Lastly for today, Cassio has sent this video in.

He’s never a man of many words – or any come to think of it – but I enjoy his videos:

A big thanks to John for sharing his infrared detectors for model trains ‘how to’. Thanks to Cassio also.

(John’s post reminded me of Mark’s: Model train block dectectors.)

That’s all for today folks.

Please do keep ’em coming.

And if you’d like to make that start on your layout, the Beginner’s Guide is here.

Best

Al

PS Don’t forget the latest ebay cheat sheet is here. Still updated daily.

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





N scale military layout

Phil’s been in touch with his N scale military layout:

“Hi Alastair

I have been following your posts for ages but this is my first response.

It was Andy’s WW2 railway that inspired me to post.

Just before I retired my wife gave me the Bachmann Ambulance Train set which recreated the ambulance trains of the First World War.

Like many I had an N gauge layout when I was a kid but nothing in-between. This gift allowed me to combine three of my interests railways, WW1 and with DCC the opportunity to use computer control.

Over the last 5 years I have created three layouts that have successively used 1/3 of the room, 2/3 of the room and finally the whole room.

The last version was my covid lockdown project and so far has not got much beyond baseboard construction track laying and testing.

Since I retired I am now on my third iteration of a railway based in southern England sometime in 1917/18.

The first half of the video is the second incarnation of the railway and the second of the third version very much work in progress.

Phil”

N scale military layout

N scale military layout

N scale military layout

N scale military layout

N scale military layout

N scale military layout

When it comes to militaty layouts, William’s Railroad to military base springs to mind.





And now on to Bob, who has been kind enough to answer your questions on his fab layout (which you can see here).

“Al… I just wanted to acknowledge all the folks who took the time to comment on my layout. I really appreciate their comments, suggestions and questions. For those who expressed an interest, I will send another post shortly describing the design, construction and operation of the layout. I also hope to include a video.

Thanks to Dan, Tony and William for their comments regarding the Durango & Silverton Narrow Gauge Railroad and the Cumbres & Toltec Scenic Railroad. My father was an avid fly fisherman and he took me trout fishing to Lemon Reservoir just north of Durango, Colorado, or to Red River, New Mexico at least once every summer. So, I had the privilege of riding both trains many times. The scenery is magnificent.

Dan also mentioned the resemblance of my layout to the Thomas Kincade Christmas tree sculpture. I had not thought about it until Dan’s comment, but it may have been a subconscious influence on my design since I do know the piece well. Thanks to Mal for sharing the information about Totnes Castle. I plan to put a 1:160 scale model of the castle atop my next N scale layout.

Will, your brother’s plan to build a terraced N scale layout with each level representing a different season of the year is inspired. I wish I had thought of it. I would love to see it when it is finished. He should post photographs on Al’s blog.

And, Frank, I am so glad your wife would approve of my layout. That is surely the most meaningful comment of all.

Al…thanks again,

Bob”

A big thanks to Bob and Phil for sharing his N scale military layout.

It’s still wonderful to see such variety in my inbox each morning.

Please do keep ’em coming.

And don’t forget the Beginner’s Guide is here if you want to make that very first step with your very own layout.

Best

Al

PS Latest ebay cheat sheet is here.





How to install ho scale turnouts

Jim’s been in touch again – this time with how to install HO scale turnouts.

(his last missive is here).

“Hello Alastair

Jim from across the big pond here in Buffalo NY, and it has been a long time since giving any update on Starrpoint Railroad.

I have been converting the layout from DC to DCC operation. It has required a huge rewiring undertaking.

There is over 500 feet, of new wiring on the layout and there is more to do. From wiring all of the track points, the 18 tortouise switches, signaling all of the buildings with new LED or SMD lights in them. The LED’s need a resistor to control the voltage going to them while the SMD’s have resistors built into the light strip.

There is a diesel and a separate steam area on the layout. The Diesel side has a Walthers Transfer Table. It is an old version that Walthers had some years ago.

The electronics for the table stop working, so I had to find a way to make it work. The Electronic board controlled the lights and the movement of the table deck. And since there is no way of replacing the board, I had to come up with one, so I built a board that will handle the lights.

Here is a picture of the board that I built for the light issues:

wiring board model train

The board has wiring for the lights, and tracks. Since the old board was able to work a blinking light on the table to notify movement, I had to build the board with transistors to handle that part, and a part to handle all of the other lights.

For the transfer table to operate I found that a DC transformer will work to move the table back and forth, but will not automatically stop at a given point. I can stop the table, at the proper spot for track alignment. So that took care of the Transfer table operation and light issues.

In the Diesel Transfer Table section, there are 12 tracks leading to various points.

Three of the tracks for the Diesel House, three for the Car Shop, one track for the Maintenance Shop, Three tracks for Diesel holding and two tracks for the Diesel Refueling Station. All of these tracks had to be converted to DCC and controlled separately.

There is a 6 position Rotary Switch controlling these tracks. The Rotary Switch has two separate power connections that allows for 12 power feeds. This is accomplished using a Double Pole Toggle Switch ( position A and position B ) There are indicator LED’s showing which track is operating.

Here is a picture of the top of the main panel showing the rotary switch and control toggle. The left rotary switch is for the Diesel area. On the layout drawing I have placed LED’s to indicate which track is in use. The reason I did that, all of the Diesel Locomotives will have sound, and I did not want all of them to come on all at once, the noise level would be hard to handle.

control panel

I made a drawing of the layout to indicate all of the turnouts. Since there are 18 HO scale turnouts I need a way to show the turnout position either open or closed. So on the drawing I added a SWITCH INDICATOR for the turnouts and numbered each turnout on the layout drawing.

Each one is a Bi-Colour LED ( RED / GREEN ). I installed 18 light tubes to hold the LED in place. Each of the indicator light centre’s had to be carefully cut out for the LED to show through. The Layout Drawing was LAMINATED to protect the drawing and to enhance the LED Light.

HO scale track plan

In order to have the Bi-Colour LED’s work correctly, they must be wired a specific way. Below are the items you need to complete this project.

wiring diagram

On the tortousie switch machine, there are 8 terminal points, 1 and 8 control the switch only. Terminal points 2 and 3 plus 6 and 7 are auxiliary terminal points.

Terminal points 4 and 5 are auxiliary power points. These two points can be used to supply power to signals, or track usage.

Here is how to wire the BI-COLOUR LED.

wiring diagram

Take a DC power wire to power point 4

Take a wire from #3 to the resistor that will control the Red side and from the other end of the resistor to the Red side of the LED

Take a wire from #2 to the resistor that will control the Green Side and from the other end of the resistor to the Green side of the LED

The Ground part of the LED can be wired in series with other BI-COLOUR LED’s.

HO scale turnout wiring

Below is a picture of the NCE SWITCH 8 MK 2 DCC boards. There are three of them that control the 18 turnouts. The boards are located in the upper left hand corner. The arrow below points to their location

HO scale turnout wiring

Here is a picture of the top of the Main Panel with the Switch Indicators

HO scale turnouts control

At the time when this picture was taken, turnout 108 had not been wired as yet. It is not wired for the panel. Turnout 108 has four functions: Control the turnout points, Indicate on the Main Panel, control the Signal Tower and Track Power.

The Signal Tower indicates which track is in operation beyond the turnout. All trains can enter the area that is controlled by the Signal Tower and will not continue past if the turnout is not aligned correctly.

Below is a picture of the Signal Tower.

signal tower

As you will notice, the track that has the Green Signal the train on that track can proceed past turnout 108, while a train entering on the outside track will stop at turnout 108 to prevent an accident. Once the turnout is set to the correct position on the outside track, then that train can proceed.

All of the above wiring took a long time to complete, but the work involved was worth it.

Most of the buildings have lights in them. On the panel that contains the two Rotary Switches, there are four toggles that control the Building lights. The one marked VIL controls all of the village and future city building lights.

The Toggles marked DSHOP control the Diesel house lights, C SHOP the car shop lights, and MAINT the maintenance shop lights. These lights can either be on all of the time or on only when being used.

I will be sending an update showing all of the building lights when they are lit. I want to complete the city portion of the layout first that will take some time.

I hope you enjoyed what has been completed so far.

Jim.”

A big thanks to Jim for taking the time to show us how to install HO scale turnouts.

In fact, there is another very good post on HO scale turnouts by Cameron:

Model railroad turnouts.

And if your trains stop on the turnouts, and it’s driving you mad, this post will help:

Capacitor for model trains.

It’s always good to see a layout morph from a tangle of wires and plastercast to a scenic railroad scene (His first post is here).

That’s all for today folks.

Please do keep ’em coming.

And don’t forget the Beginner’s Guide is here if today is the day leap out of your armchair and start planning your masterpiece.

Best

Al

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