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:
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:
8 Channel Relay Module 5V Optocoupler LED for Arduino PiC ARM AVR
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:
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”
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.
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”
A huge big thank you to Henry for sharing his HO scale railroad signals update.