I am installing a simple non prototype signal sytem using the atlas products.
I started out planning to use BD20. I am now rethinking that as I would need to add a lot of resistors or resistance paint to rolling stock. I am wondering if anybody has experience with Arduino and could tell me if i could build a Detector using arduino and photo cell that would sent a 5 volt signal to my atlas Control board. Basicly I want to replace the BD 20 with photo cells. and if Possibel I would like to have multiple photo cells in a block, so if any one is tripped or covered it would send the 5 volts for that zone.
Yes it is quite easy to do. There are several types of sensors you can use including IR and Photo. Each has it’s advantages and disadvantages. The problem with photo sensors is they don’t work when you want to do dark running (night time)
I built up a 14 block signal controller using a Arduino MEGA and IR optical detection. It has been in and operating for a little over two years and I’m very happy with it.
I have several posts on my Blog about signaling. I have tried all kinds of detection systems and I now prefer IR optical over current detection.
Thanks group. I have not been able to access my account. I was locked out when I changed my email. I am not familiar with Blogs. I would like to read more of Mel’s stuff. How do Blogs work?
I am an N scale person and one of my concerns in using I/R is drilling between the ties. But was actually looking at I/R. I have started to use the Atlas signal system so all I need is to decide on what type of detection to use. I/R or even Photo cell may be tricky as I have 3/4 ply with 1" foam on top.
I’ve tinkered around with hall effect sensors and they do work very reliably, the SEN14709 is priced right at about $1. I just found using the pre made IR modules much easier to use as I model HO scale. Size does make a difference. I can easily hide a 3mm sensor or emitter in HO goodies.
All of my across the track IR beams are at coupler height.
Tiny optical sensors are indeed available! I use them between the ties (no need to drill at all) on my HO scale layout but they’re so small that I expect they could be hidden in N scale track too. They’re about 2mm long, 1mm wide, and 1mm thick. IMO an optical sensor between the ties is the best way of detecting a train… They’re basically invisible when surrounded by ballast and you can place them anywhere you want.
I was so pleased with these things that I posted about them a while ago but to my dismay no one shared my enthusiasm at that time… However my previous post may still be of interest in this matter
I used photoresistors to work on my signal lights.
I was able to drill small holes in my N scale track. The holes were visible, but were not noticeable.
The downside of the photo sensors is that room light affects the results. I have a south facing window in the layout room, and my adjustments were made for the signals when the sun was out.
The issue was that on a cloudy day, if I happened to cast a shadow on the track, the signals were activated.
I spent a lot of time adjusting the sensors, and got them to a satisfactory level so the ambient light didn’t cause too much of a problem.
However, if I build any more signals, I am going to switch to IR sensors.
Just the ambient room light works fine. Although the sensitivity does peak in the IR range, the sensors work across a wide spectrum, still performing somewhat all the way to UV. I pull them up to 5V with a pull-up resistor and read the voltage on them with the Arduino’s analog input, and simply comparing the reading to a threshold value reliably indicates whether the track is blocked or not.
There does need to be some light in the room, but it’s ok whether dim or bright
This might also suit your needs. One piece. Bury it below the track, pointing upwards, or hide it on the backside of a tower building. It’s infrared, so it will work in the dark. They all work on a similar principal. Some just have more bells and whistles like adjustability. You should be able to safely trim back the dome. It acts like a collector lens to measure over a wide angle. As you only care what’s going on above the track, you only need the upward lens.
I’ve looked at the HC-SR501 its super slick but too big for model railroading at a 1” square and both are PIR looking for ambient IR not a pin point source for reflective or break beam detection.
The FC-51 works great except for sensor size, the SMD sensors might work and the 0603 size would be perfect.
have you used this to detect a loco/rolling stock?
my understanding is a PIR sensor actually detects the movement of some IR source across its field. it relies on the heat (IR) of the object such as an animal. i can see how it might detect the heat of a loco, but not sure about rolling stock.
doubt a PIR detector is an inexpensive ($$) as a paired IR emitter/detector. while the emitter requires a series resistor like any other LED, the detector, a transistor can be connected directly between an Arduino digital pin with a pullup resistor and ground
not sure this thread’s title, "Block Detector is accurate since it’s considering optical dectection which monitor specific locations on a track and not a “block” determined electrically
This might also suit your needs. One piece. Bury it below the track, pointing upwards, or hide it on the backside of a tower building. It’s infrared, so it will work in the dark. They all work on a similar principal. Some just have more bells and whistles like adjustability. You should be able to safely trim back the dome. It acts like a collector lens to measure over a wide angle. As you only care what’s going on above the track, you only need the upward lens.
have you used this to detect a loco/rolling stock?
my understanding is a PIR sensor actually detects the movement of some IR source across its field. it relies on the heat (IR) of the object such as an animal. i can see how it might detect the heat of a loco, but not sure about rolling stock.
doubt a PIR detector is an inexpensive ($$) as a paired IR emitter/detector. while the emitter requires a series resistor like any other LED, the detector, a transistor can be connected directly between an Arduino digital pin with a pullup resistor and ground
not sure this thread’s title, "Block Detector is accurate since it&#
For your entertainment you may view this video showing a wheel counting BOD in action. It is connected to JMRI via MQTT over wifi and is configurable via Bluetooth using any tablet or phone. This requires the use of ESP32 as a controller rather than Arduino. More details and discussion are on the MRH forum under “BOD using axle detection - demo”. It’s experimental of course but has worked well in testing.
Fair enough… A single overhead IR source would do the trick, but if your emitter/receiver pairs in reflective mode work, great.
When I tried that a few years ago I found them unreliable. The room at the time had a lot of windows letting sunlight in and tricking the sensors into thinking there is a train there. And on the other hand, some of my rolling stock was a poor reflector of IR, and the detectors didn’t see them at all.
Overall, I had better results with a simple single receiver between the rails that is lit by ambient light when the track is clear and cast into darkness when there’s a train atop it.
Point is, there’s more than one way to skin a figurative cat
Re: the PIR sensor though, I don’t see that being a good solution. It’s bulkier and more expensive and has no advantage that I can see. And since it’s designed to detect motion, what happens when there’s a stationary train on it? Won’t it incorrectly report that the track is clear?