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.
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:
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
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.
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.
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 reallly 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.
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:
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.
PS Don’t forget the latest ebay cheat sheet is here. Still updated daily.