Tiny Sensors for location detection
by
, 11th Sep 2023 at 07:28 PM (450 Views)
So, one problem I don't like about N scale, is that to get reasonable sized sensors for things like location, you don't have as many options. I wanted a way to put a notification sensor to tell me when a train passes a location. Use IR or Hall, right? Well, they are big and clunky really. I did find a Youtube of a guy who did something clever. He put an IR and Photodiode into a tiny package to fit in between the tracks. Well, that would work for me, so I tried the same thing, and it works.
I have a sensor design that when shaved down, fits in between two ties of my Code 80 Atlas rail. Using 30ga wire, I can get reliable activation of a reflected IR bean from a train rolling over. See below.
I'm still doing some work, so I'll share the design later. Currently, this sensor version is active high, but it requires more work than I would like for the detection to make it safe for the micro. I'm redoing it active low so you can use the micro's weak pullups meaning you can just wire all three into any 3v3 micro you would like. The IR LED resistor is sized for 5V, but I use it at 3v3, so either type of micro is just fine.
I have no idea how to cut these safely to be small. The image above fits length wise, but is a bit wider than the ties without shaving it down. I'm not sure that's a problem I can fix honestly, and it's OK to just use some sandpaper, which seems to work but is clumsy and time consuming. If anyone knows how to work around that, I'd love to hear it.
When ready, each PCBA comes with 8 sensors. Each sensor has 3 pads, one for 3v3, GND, and the signal line which are very easy to solder I have found (very nice). For crossing gates, you really want 4, so this works out well. I'll post more pics when I get the next design back.
![]()