Many of you already know that Iowa Scaled makes both kinds of detectors – an optical detector known as the CKT-IRSENSE, and a current detector known as the CKT-BD1. When discussing detectors a few months back, Michael and I thought it would be interesting to compare ours with the various other products on the market and figure out who really has the best stuff. In this installment, we’ll look at six of the most popular optical sensors on the market, comparing and testing them, and try to give you a fair and honest comparison between all your options. We’re a weird company, and just to prove it again we’re going to say some nice things about other peoples’ products, and some bad things about ours. Read on…
Model railroad occupancy detectors fall in generally two categories – optical detectors, which detect light either reflecting or being blocked by model railroad equipment at a specific spot; and current detectors, which detect equipment within a block of track by sensing the current being drawn. Optical detectors are great for answering the question “is there something on the track at this exact spot” and require no modifications to equipment, but it takes a lot of them to cover any real length of track to make sure you don’t miss something. Current detectors are great at finding anything on the rails in a given block, but can’t tell you exactly where it is and require resistors added to the axles of cars to provide a small current draw that can be sensed.
How Optical Detectors Work
Most optical detectors fall in three categories – ambient light, constant infrared, or modulated infrared.
Ambient light detectors use the natural light found in your layout room, assuming that a train above them will block most of it. These are by far the oldest type, going back to the days of cadmium sulfide photocells. The disadvantage of most of these is that you have to set the trip point manually, and if your lighting ever changes, you may have to reset all of your detectors. They also (obviously) don’t work in the dark.
While Logic Rail offers a version of their detector that works this way, we chose to test the IR version instead. The only ambient light detector we tested is Geoff Bunza’s DIY design known as the SMA23, or the Differential Absolute Position Detector. This DIY detector has a unique solution of using two sensors – one to sense where a train might be, and one to sense the ambient light nearby. That essentially allows it to self-calibrate to room light and adapt to changing conditions, as long as the light falling on both sensors without a train is relatively equal.
Constant infrared detectors use a constant infrared LED light – much like any other LED, except mostly invisible to humans – that shines on a sensor that’s good at detecting infrared (and often filters most visible light). They sense the amount of IR light that hits the detectors, and based on whether the light is present or not determine if there’s a train. These can work either by sensing when light is blocked (like an ambient detector) or sensing if light is present (such as if you’re bouncing it off the underside of a rail car). The downside of these is that the detectors are almost always not immune to changes in visible light, and that they can be confused by other infrared light sources, such as room lights or TV remotes. The Logic Rail OD1-IR and the Chinese eBay sensors in our lineup are of a constant infrared type. The Logic Rail unit can either be used across the tracks (detecting when light is blocked) or beneath the tracks (detecting when light reaches the sensor by bouncing off the car). The Chinese units, as configured, can only be used to sense reflection.
Modulated infrared detectors put out pulses of infrared light (known as modulation), and looks for that same pulse stream to be received. Because they’re looking for a specific pulse pattern coming back, this allows them to be very immune to interference. They’re not just looking to see infrared light, but they’re checking that the correct signal is being received on that light. The downside of this is often internal complexity, because the circuit needs to both pulse the light and decode the pulses coming back. Fortunately, due to the fact that this scheme is used for infrared remote controls and for sensing how close your face is to your smartphone, the integrated circuits to do this have become very small, tightly integrated, and quite inexpensive given their complexity. The Iowa Scaled CKT-IRSENSE, Boulder Creek Nightscope, and Azatrax MRD1-V are all based on variations of this idea.
Detector Output Types
Nobody buys an optical detector just to say their layout has one. They buy them to connect to other items and solve problems. Therefore other than understanding how detectors sense things, the second-most important thing to understand is how they can switch external circuits in response to detecting something.
Relay – A relay is just a switch, except rather than a lever you toggle back and forth, the contacts are pulled together by a magnetic field. This allows a small circuit like an optical detector to drive a much larger load and do it in a way where you need not worry how the circuits interact electrically. This is known as isolation, and allows you to switch arbitrary things (up to the relay’s contact ratings) without concern. The only detector in our roundup with this style output is the Azatrax.
Open Collector / Open Drain (OC) – This sounds scary to those not familiar with the electronics field, but basically this means the output is connected to the negative supply (ground) side of the circuit via a transistor. When the transistor turns on, current can flow from the output to ground. When the transistor turns off, no current flows. It’s much like a switch, except that it’s completely solid state. These are sometimes called “open drain” as well, when the output transistor is a MOSFET. It’s the same thing. They will have a maximum voltage that they can withstand, and a maximum amount of current that can flow between the output line and the negative / ground side of the power supply.
A handy trick is that you can connect a resistor from an open collector output to a positive voltage. When the transistor is off, the voltage on the output will rise to the positive voltage level. When the transistor is on, all the current goes through the transistor and the signal looks “low”. This is an easy way to use an open collector output to connect to a microcontroller, such as an Arduino. Sometimes this resistor is included.
Most of the detectors in our roundup use open collector style outputs. Iowa Scaled, Bolder Creek, Logic Rail, the Bunza SMA23 DAPD, and the Chinese eBay sensor all have at least one open collector output.
Positive Open Collector (OE) – These are the same as open collector, except that they uses PNP or PMOS transistors to switch current from the positive supply line to your load rather than switching current to the negative line. When they’re on, current flows from the positive supply to the output, through your load, and then back to the negative supply / ground. You can do the same resistor trick here as with OC, except the resistor would go to the negative supply / ground. The only detector in our roundup with one of these is the Boulder Creek unit, which has both an OC and OE output. (The Boulder Creek OE output has a 4.7k resistor to negative/ground, so the collector isn’t really, truly open, but this allows some clever uses.)
Active – These outputs are actively driven to some positive or negative voltage depending on the state of the detector. The only unit in our lineup with this style output is the Logic Rail unit, which has a pair of LED output lines that can actively drive up to 25 milliamps.
The Contenders
- Azatrax MRD1-V
- Boulder Creek Engineering Nightscope NS-352
- Geoff Bunza’s SMA23 Differential Absolute Position Detector (DAPD)
- The Iowa Scaled Engineering CKT-IRSENSE, of course…
- Logic Rail OD1-IR
- Chinese IR sensors from eBay (not show in picture)
You’ll notice this isn’t every sensor on the market. Notably, we eliminated two that were just timing option variants on the ones we tested – the Azatrax MRD1-NV, which has a fixed 1 second drop out as opposed to the variable drop out on the model we tested, and the Boulder Creek NS-350, which again has no drop out delay compared with the 2 second version tested. These two are otherwise identical to the units tested, and we’re not made of money to buy every variant of everything. The other notable option we omitted was the Logic Rail OD1 (non-infrared, ambient light) version, as we felt that the infrared “works in most lighting conditions” version was the best comparison with the other contenders.
Let’s look at each detector in a bit more detail, highlighting any unique features and drawbacks that we found during the testing.
The Azatrax MRD1-V
The Azatrax MRD1-V is the more flexible big brother to the MRD1-NV. The -V stands for “variable” (as opposed to “not variable”), meaning you can configure what it does and how long it waits after it detects something, and costs a couple bucks more as it has more components. Otherwise, the two units appear to be identical.
If you turn the adjustment potentiometer counter-clockwise of center, you get a unique feature of the MRD1-V that nobody else offers – a “one shot” mode. The “one shot” mode turns on the detection output for a variable amount of time when something triggers the detector. After that time elapses, it shuts off the output, even if the train is still there. The sensor must clear for at least two seconds before it will detect again.
If you turn the adjustment potentiometer clockwise past center, you get continuous mode, where the output is active as long as something is detected by the sensor. The adjustment on this side is the “drop out delay” – how long the MRD1-V waits after the train clears the sensor before it stops “detecting” something. Adjustment ranges from 0.3 – 14 seconds.
The other unique feature of the MRD1-V is that it features a relay style output. This allows it to switch far larger loads than any of the detectors in the comparison – up to 3 amps at 28 volts. It’s a single pole, single throw relay, though, so it works like a simple switch – it conducts when the detector senses something, and is an open circuit otherwise.
The manual shows that the MRD1-V sensors can be installed pointing across the tracks, so that they sense when the beam is interrupted, or can be mounted under the track and used in reflective mode. Given that most modelers will probably not want IR sensors sticking up on the sides of the track, we went for the reflective mounting. Personally, I found that having to drill two holes at 45 degree angles through the track is a pain in the rear, and we wound up chewing through the ties more than we’d like. However, at that angle, it’s almost impossible to not have to mill the ties a bit to get a good optical path.
Here’s what the MRD1-V looks like installed into the test track and beneath the rails:
The MRD1-V is available from Azatrax’s website for $19.50 + shipping.
The Boulder Creek Nightscope NS-352
The Boulder Creek Nightscope NS-350 and NS-352 are the most similar to the Iowa Scaled sensors, so needless to say we were anxious to actually try one out. They’re a single stick type detector with an infrared LED and sensor at the top and four wires coming out the bottom. You can mount them through a single 3/8″ hole, or you can drill most of the way through your roadbed with a 3/8″ bit and then drill two smaller holes at the top for the LED and sensor.
The Nightscope comes in two variants – the NS-350 (black heatshrink jacket) and NS-352 (red heatshrink jacket). The only difference between the two is that the NS-350 stops detecting immediately when it no longer sees a reflection, and the NS-352 has a fixed 2 second drop out delay for handling things like gaps between cars.
The NS-352 had the longest detection range of any of the reflective sensors, by far. This is both a blessing and a curse. It means it should work flawlessly on larger scales, such as G, where the gap between the ties and the bottom of the cars is much larger. However, it can just as easily pick up an errant elbow half a foot over the rails.
One interesting feature that Boulder Creek included is the positive open collector (OE) output that has a 4.7k pull-down to ground. Since the Nightscopes will operate at 5V, this is a ready-made logic level output that can feed digitial circuits like a CMRI input board or an Arduino with no additional components.
Here’s what the Nightscope looks like installed into the test track and beneath the rails:
I’ve always wanted to open one of these up, just to see what’s under the wrap. (The manual warns you this voids the warranty, which seems reasonable but doesn’t serve as a deterrent to folks like myself…) Internally, the Nightscope appears to be based on a fairly standard IR remote control receiver – that’s what’s shrouded in black heatshrink at the top. It then uses a small microcontroller of some sort to send out an IR pulse stream and read it back, make the detection decision, and drive a couple of output MOSFETs. This combination makes its detection essentially bulletproof, as we tried with many sources and could not get any false detections out of it.
Here’s a photo of the Nightscope with its protective heatshrink removed, for those curious:
One curious thing, though – while working with the sensor, I didn’t notice it having an on-board LED to indicate whether it’s detecting or not. However, once we opened it up, there’s a small yellow LED at the bottom that lights when it’s detecting. This isn’t readily visible with the heatshrink on the sensor. Once I found it, though, I went back to the manual and sure enough, it’s mentioned right up at the top: “Onboard LED lights when train is detected – easy to verify installation” I guess you might have to look up the main heatshrink to see it.
The Nightscopes are available from Boulder Creek’s website for $19.95 each plus shipping.
Dr. Geoff Bunza’s SMA23 Differential Absolute Position Detector
Geoff’s SMA23 is an open hardware, do it yourself project, that was published on the Model Railroad Hobbyist forums. It’s a whole different critter from the other candidates in this roundup because it’s an ambient light detector that attempts to eliminate the worst drawback of this style – its sensitivity to room lighting conditions. Dr. Bunza did this by including two sensors. One senses the ambient light conditions, and the other senses the light on the track at the point you want to detect. When the track sensor is darker than the ambient, the circuit “detects”. Thus, no adjustment should be needed.
The through-hole version of the SMA23 is very easy to build. We downloaded the Eagle PCB file from the MRH post, sent it to OSHPark for fabrication (~$3 for three boards), and ordered the exact parts on the bill of materials from Digikey. (Well, aside from the resistors, which we just pulled from our bins.) Overall cost per board came to $3.09 and each board can do two detectors.
(We tried to also evaluate the surface mount version, but OSHPark had problems fabricating the PCB with the long, narrow sensor arm on it. On the first batch, the PCB milling process broke the arm off, and OSH had to re-make the PCBs. Unfortunately they did not arrive in time for testing.)
The downside is that it’s touchy. You really have to make sure that the ambient and track sensors are getting exactly the same light. Anything casting a shadow, even waving your arm between the light source and the detector will set it off, as it casts a shadow unevenly across the sensors for a split second. This is the reason that we put “n/a” in the detection distance column, as it’s not relevant to this style of detector. Anything that casts a shadow on the track detector, from any distance, will trip it.
We also had some issues in low light conditions (overhead room lights off, bench light across the room on). It would appear that we got into a region where the output was partially conducting, likely due to both sensor inputs being near the positive rail and some input offset in the comparator. I’ve included video of this odd behaviour below. Note that the “detect” LED attached to the output only dims, but never goes out. This behaviour was never seen with adequate light.
The circuit has a single open collector-style output from the LM2903 comparator itself. It’s only rated at 20 milliamps, but up to 36V.
It’s an interesting, inexpensive design that mostly solves the main problems with ambient light sensors. As strong open hardware advocates ourselves, we’d like to thank Geoff for making his design available to the model railroading community, and for writing very clear documentation about it that even novices can easily follow.
Iowa Scaled CKT-IRSENSE
The CKT-IRSENSE is our entry to this field. It’s a single PCB stick with a modulated infrared emitter/sensor pair on the top and connecting wires coming out the bottom. Unique amongst the detectors evaluated, the CKT-IRSENSE uses a small infrared proximity sensor designed for use in smartphones (to tell if the phone is up against your head). That means, amongst other benefits, the part of the sensor that needs to be exposed is very, very tiny – the entire sensor at the top is rectangular and the same width of a N scale tie, and the only parts that need to be exposed are two tiny lenses, each 0.04 inches in diameter.
Our most unique feature is our very flexible delay options. Our standard CKT-IRSENSE can be configured for a drop-out delay of 0.1-23 seconds, but there’s a second long delay option which allows 6 seconds to 23 minutes. What on earth do you need a 23 minute drop out for? Glad you asked… Amongst other uses, you can use it to build an automatic interchange track that shoves out more cars some time after your local crew has picked up the previous cut. The delay is adjusted by connecting a resistor (several values included) between the yellow wire and the negative/ground (black) lead. For the normal (shortest) delay, you don’t need to connect anything at all.
The CKT-IRSENSE also has an open collector “not detecting” output, which can be used to switch a load on when the track is clear.
Like the Boulder Creek, Chinese eBay, and Bunza SMA23 sensors, the CKT-IRSENSE will run down at 5VDC. This makes these sensors great choices if the outputs are going directly into a logic circuit, such as a CMRI system or Arduino.
Now the downsides. I told you I’d say something bad about our own products. You ready? Here it comes…
Mounting the CKT-IRSENSE can be a bit tricky, as it just fits up through a hole in the benchwork and grabbing it (or similar sensors, like the Nightscope) can be a challenge. For permanent installations, I’ve been known to just shoot a glob of hot glue up in behind it to hold it in the hole, but for those scenarios where adjustment or removal might be necessary, Michael worked out a method using metal L-brackets and plastic wire clamps. You can find it about halfway down in the “Infrared Proximity Sensor” article that introduced the CKT-IRSENSE. However, one of our customers came up with an ingenious laser-cut acrylic mount. We hope to test market a few shortly to see if other people like them, too.
The other issue is while we can run at 5V to feed a logic-level system, there’s no pull-up resistor on either output line to provide a ready-to-use logic level signal. So, unlike Boulder Creek, you would need to add an external resistor to pull up whichever output line you want to use. We have a 2-piece version available – the CKT-IRSENSE-2PC – where we’ve added a place to solder a resistor on to the board, but on the stick version there simply isn’t room.
Like all Iowa Scaled Engineering products, the CKT-IRSENSE is open source, both in terms of software and hardware. This allows you to customize ours to your specific need or even build your own if you’re so inclined. Full schematics, PCB files, and firmware source code are available in our Github repository.
Here’s what the CKT-IRSENSE looks like installed into the test track and beneath the rails:
The CKT-IRSENSE is available right here for $19.
Logic Rail OD-1-IR
The Logic Rail OD-1-IR is one of two models that Logic Rail offers. The other – the OD-1, which appears to use the same PCB – has only a photoresistor instead of the infrared LED / sensor pair. That means it uses ambient light. Given that an IR sensor should be more reliable in all conditions, we chose the OD-1-IR version to evaluate.
Like the Azatrax unit, the IR LED and IR phototransistor are separate 3mm elements, and the recommended installation is in two 45-60 degree holes under the track, spaced “one tie apart”, presumably in HO. The IR LED also requires a large external current resistor to be connected in-line. I’ll repeat my criticism of this from the Azatrax review – drilling these holes in already-mounted track is pain to do without damaging anything.
The Logic Rail has a unique set of outputs. They offer an open collector output like most of the others, but they also have two LED output pins for driving bi-polar LEDs. These pins are actively driven, and include current limiting so that with a 2-pin red/green LED, no external parts are needed. Through slightly different wiring and potentially changing the “SIG” jumper, it can also drive two separate LEDs wired common cathode or common anode.
The unit has two settings for its “drop out” delay – the time from when the train is no longer detected to when the detection output changes. By changing the “DLY” jumper, you can choose between 2 seconds and 4 seconds (though in testing, Michael and I found these a bit short, at 1.5s and 3s, respectively).
The Logic Rail unit is a constant IR type detector, and as would be expected had some problems with light interference. Our fluorescent overhead (two F32T8 bulbs driven by an electronic ballast) caused issues at 11 inches away, and an infrared remote caused false triggers at 8 inches. Normally this shouldn’t be an issue, but something to watch out for if you have other nearby sensors or if your layout lighting is particularly strong or close to your track surface. The unit also had the shortest detection distances, and had some issues picking up the flat black boxcar bottom at all until we messed with the sensor angle and placement a bit.
Here’s what the OD-1-IR looks like installed into the test track and beneath the rails:
The OD-1-IR is available from Logic Rail’s website for $27.95 + shipping.
Chinese eBay Sensors
I’ve put these last just because it’s hard to even know where to start on these… They’re main selling point is that they’re cheap. Like really freakishly cheap. If you buy them 5 at a time, you can get them for roughly $1.40 each shipped to the US from China. How do they do it? Lose money on every part, but we make it up in volume! *smirk* However, every time the subject of IR sensors comes up, people inevitably bring up these things.
It was hard to put specifications for these in the spreadsheet, as there is no identifiable manufacturer or data sheet for them. So, rather than reverse engineer the board, I did what any lazy person would do – searched Google for “FC-51 schematic”. FC-51 is the only possible part number on the board. Somewhat unsurprisingly, somebody had actually drawn a schematic for it. I’ve included the schematic here.
The sensors are a small PCB stick with two 5mm devices (an IR LED and an IR phototransistor) sticking out one end. These are a “constant IR” type circuit, but they do have an adjustment potentiometer to set where the limit of detection is. At the other end is a three 0.1″ pin header connector that takes power and ground on two pins. One of the outer pins is the comparator output, but it is not a fully open collector output. There is a 10k pull-up resistor, and the “detect” LED is also powered off the output. So, given 20mA maximum current on the output of the LM393 at the heart of the circuit, you’ve probably got 15mA left available on the output.
Given the lack of the datasheet, some things like maximum voltage in the results spreadsheet were determined by, erm… “destructive testing”. My first attempt to power them at 12V melted the solder holding the ballast resistor (100 ohms) to the IR LED in place. Oops. I mean, now that I found a schematic, I was running a 1/8W resistor at almost 10 times it rated power. Best I can tell, 5V is the maximum for these things. It puts the LED power resistor right at its limit (0.1225W, right up against the 0.125 W limit). They seem to operate down to 3.5V or so, but again, no spec sheet, so no promises.
Mounting it was a terrible experience. The LED and phototransistor on top are huge, barely fitting between two ties on old Atlas Code 100 black tie flex track. On more accurate track or in N scale, you’re definitely going to have to cut out a tie or two. If you mount them completely below the ties, there’s enough reflection off the ties they trigger. Plus, the board is so wide and the components tall enough that I would up drilling two 3/8″ holes side-by-side and reaming the web out between them so that I had a square hole in which to mount it. Then it needed to be adjusted, so I kept pulling it out, adjusting sensitivity,and putting it back in to try it. Took 2-3 tries to get it just right.
Here’s what one looks like with those big old 5mm devices between the ties:
Honestly, for what they are, they’re not the worst thing ever. Once installed through the track bed, they’re going to be a bloody pain if you ever have to change the sensitivity. They’re a bit touchy to IR and fluorescent interference. The hole needed for the emitter/sensor pair is huge. You have to feed them 5VDC power, when most model railroad accessories will work on 12. But they do, for the most part, work. At least most of them. Four of the five I received tested out okay, the fifth was dead for unknown reasons I didn’t bother to diagnose.
How We Tested
Installation and detection tests were performed using a piece of board with a section of HO flex track mounted to it, suspended between two boxes. There were two sets of holes drilled – a pair of 45-degree angled 3/16″ holes for mounting sensors with separate emitters and detectors (Azatrax, Logic Rail), and a single 3/8″ hole for testing detectors with a single sensor element (Boulder Creek, Bunza, and Iowa Scaled).
We tested each sensor for sensitivity using two targets – one dark that would reflect a minimum of light, and one bright that would reflect the most. Our dark test vehicle was an Athearn 50′ FMC Box Car – ABOX 51106 – which had a great flat black bottom. For the light target, we used a piece of white 4×6 inch card stock. Both targets were bought down vertically above the detector until the detector sensed the object, and that distance was recorded. Measurements were repeated multiple times to make sure we were getting consistent answers.
We also tested two other important characteristics – interference from adjacent objects (such as trains on the next track over) and interference from light sources. Interference from adjacent objects was again tested with the white card, as this provided the maximum reflection. The card was set with one edge against the edge of the ties with the detector mounted near the center of the card, and the card was then slowly brought up to vertical to test if an object just beyond the rails would detect. Interference from stray light sources was tested first with a pair of fluorescent F32T8 5000K bulbs (the light above the bench we were working on), again with a bright infrared light source (a remote control for a stereo), and then finally with a bright LED light.
All tests were conducted powering each detector with a 12 volt DC power supply – except for the Chinese eBay sensors, which melted at 12V – as all of the models tested could handle this within their rated ranges. Current measurements were taken in both the detecting and non-detecting states, with any LEDs attached to outputs disconnected to eliminate them from the numbers.
Behold, the Spreadsheet of Reckoning!
Yup, this is what you’ve read all the way through just to find – it’s the spreadsheet comparing and contrasting the different features of each detector, along with the testing results from each.
Conclusions
There really isn’t a “best” detector. As you can see in the details above, each has a unique feature or two which may make it the right detector for your application – be that cost, sensing distance, types of outputs, or immunity to interference. While obviously we’re pretty darn proud of the CKT-IRSENSE and think it’s a versatile mix of features and value, the other manufacturers out there make some darn good products as well. Hopefully this guide will help you pick which vendor’s products match up with your needs the best.
Next time, we’ll round up the current-based block detectors on the market and put them through similar paces.
Since mounting seems to be an issue with many of these devises why not disconnect the light sources from the logic devise using 6 to 10 inch wires so only the light devise is used in the mounting and the logic part is just mounted below? I’m not an electrical or mechanical engineer but only a systems engineer. I’ve been a computer programmer for 40+ years and have always prided myself in coming up with the most sensible approach to solve issues. I know this only addresses one minor issue but I have only thought about this for a short time.
We do have a 2 piece version:
https://www.iascaled.com/store/CKT-IRSENSE-2PC
I just found this information on the web. This being 2020, I wonder if I will get an answer to my question as this post dates back a few years, but here it goes:
I midel in O scale, and have a Logic Rail crossing circuit that turns on the lights and bell on my crossbucks. This system uses some type of photocell room light detection, with two detectors for each direction of a train movement. It often does not work, either it does not turn on, and when it does, it does not turn off. I can’t do any night time ooerations either because of these photocells.
I need to replace this detection with something that is compatible, that will work with O scale and in any room light situation. Having a bit of a delay would be great to eliminate false reset due to longer or higher cars at slow speeds. Which one of these fabulous detectors would be the best?
Thanks!
Serge Lebel
Serge – Our TrainSpotter detectors should work in place of the photocells and give you much more reliable operation. They’ll work in any lighting conditions and have some delay built in to deal with the gaps between cars, but if it isn’t enough we can always modify the firmware to increase it a bit. Based on the instruction manual you should be able to connect the sensor power (red) and ground (black) to the DC and GND terminals of the module. The blue wires can then be connected to the sensor inputs (PWF, PWN, PEN, PEF) as appropriate based on where each sensor is installed.