Detection with a reed switch and a magnet. Experiences? is a free Model Railroad Discussion Forum and photo gallery. We cover all scales and sizes of model railroads. Whether you're a master model railroader or just getting started, you'll find something of interest here.


Today I tried occupancy detection with a reed switch and a small magnet under the loc. Results seemed OK.

Link to the video.

Although current sensing probably is the most used detection method, I like to try some other methods too before I make up my mind what to use with my near-future layout.

At this moment chances are 80% That I'm going to use an Arduino for S88 sensor feedback, simply because of its low cost. In that case current sensing is not the most easy, because some additional current detection PCB's will be needed, which will also raise cost again. Optical or magnetic detection are easier and more cost efficient.

The drawback is that there will always be a sensor in view, somewhere besides or between the rails. Some will not like the view or will find it non-realistic. To me this is not a big factor though, since I'm not that much of a 'prototypical purist' ... more a 'technical tinkerer'. :) Both the optical sensor as well s a reed switch (10 x 2 mm) will fit neatly between the rails, not really that much noticeable.

A reed switch needs only 2 wires, while an IR sensor needs 3. So, that might make me turn to the reed switches as train detection method.

Chances are that (many?) forum members also tried these detection methods, or even use them in practice? I'm curious about experiences ... good or bad ... and if there are any tips ... or any pitfalls?

Mark R.

Custom Painter
I signalled my entire layout (25 X 13) using reed switches and magnets under the engines. It's been in operation for nearly twenty years. It was built back when the layout was DC, but the conversion to DCC made no difference as it is totally independant of track power. If I switch the layout back to DC, the signal system still works just fine. The only drawback is that it only detects where the engines are and not the rolling stock, but that hasn't proven to be an issue after all these years of operating as the blocks are long enough trains aren't that close to each other from block to block.



Well-Known Member
I use IR detectors to actuate grade crossing signals and gates, and like them fine. Where I can hide the detectors between the rails, I do so. Where the layout structure prohibits this, I use above-ground sensor/emitters, sometimes hidden behind folliage, buildings, or disguised some other way. Don't have to worry about gluing magnets to the underside of locomotives and rolling stock, or operating day or night. Just MHO.

Mark R.

Custom Painter
I use tiny rare earth magnets and they attach themselves easily to the metal screw holding the coupler pocket. If somebody brings an engine over to run, stick a magnet on the screw and go. When finished, just pull off the magnet. Sometimes, stacks of two ore three magnets may be necessary to get them down low enough. The magnet is also a perfect fit in the opening of an Athearn truck, adhering itself to the truck screw.



Active Member
The biggest issue with reed switches, Hall Effect devices, IR detectors is they are "point detection" devices, they only tell you when something is at their location.

Current sensors however tell you when anything drawing current is in the stretch of track that the current sensor is connected to.

To my way of thinking they are very different in their application as current sensors provide occupancy information while the others provide location information.

With reed switches and Hall Effect devices you have to attach a magnet to each piece of rolling stock you wish to detect.

IR devices detect most ever thing as long as the piece of rolling stock blocks/reflects the beam.

Current sensors require the the piece of rolling stock draw current, so engines and lighted cars work with no changes while other cars, etc need resistor wheel sets or equivalent.

In terms of cost (low to high) its reed switches, hall effect (I think), current sensors, IR detectors.

On my layout I use RR-CirKits current sensing occupancy detectors for occupancy sensing.

I use Azatrax IR detectors when I want to know that the engine/train has reached a certain point on the track.

In fact the MRD8 unit was designed specifically for me.

I went with IR detectors because I did not want to have to equip rolling stock with magnets along with the resistor wheel sets I would need for the current sensors. The downside was the cost.

Every block has a current sensor to indicate with the block is occupied.

Every block also has an IR detector near each end to indicate when the engine/train has reached the end of the block.

There are also IR detectors at other important locations, such as the electro-magnetic uncoupling devices.

If you simply want occupancy detection you want to go with current sensors.
Last edited by a moderator:


Go make something!
I used reed switches and magnets to automate my coal loadout. The switches need to be activated when the car is in a precise point or it make a mess, dumping coal all over the place. I just built another loadout and am considering changing the magnet from the center of the car to one side of each truck. Where do you get reed switches now?


Does anyone make a latching reed switch? In other words it would flip over center when triggered, and flip back the other way when triggered the next time. That way your engine would activate the device, and your caboose could deactivate it.


Active Member
Does anyone make a latching reed switch? In other words it would flip over center when triggered, and flip back the other way when triggered the next time. That way your engine would activate the device, and your caboose could deactivate it.
There are bi-stable reed switches which could do what you are thinking. You would have to equip all locos with a magnet oriented one way to set the switch and cabooses with a magnet oriented the other way to reset the switch.

But what about more modern layouts where cabooses are no longer in use?

What happens when you a drop a car off at a siding? If the loco sets the switch how do you reset it? Push a caboose into the siding?

These are just a few of the problems that can arise from using location sensors for occupancy sensing.

Mark R.

Custom Painter
I used latching DPDT relays for my reed switches to activate. They, along with switch point contacts are all interlocked through a rather elaborate wiring diagram. It works flawlessly and accurately, but it rather archaic in comparison to today's electronic PNP modules.

The entry / exit point of each block has two reed switches in an on / off configuration to the relay. As it activates the block it enters, it releases the block behind it. The same two reeds feed another relay wired in reverse for bi-directional control. Contacts on turnouts interlock with the relays to also give the correct signal indications.

It can get very complex in a hurry making sure everything works as expected. IF I were to build another layout today, I dont think I would go the same route just due to the complxity and miles of wire involved. It was dirt cheap to build, but very labor intensive. I would go with the current sensing modules that are available today to greatly simplify the whole process. Wish they were available way back when I designed my wiring night-mare.


Affiliate Disclosure: We may receive a commision from some of the links and ads shown on this website (Learn More Here) is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to - An online railroad bookstore featuring a curated selection of new and used railroad books. Railroad pictorials, railroad history, steam locomotives, passenger trains, modern railroading. Hundreds of titles available, most at discount prices! We also have a video and children's book section. - An online model railroad bookstore featuring a curated selection of new and used books. Layout design, track plans, scenery and structure building, wiring, DCC, Tinplate, Toy Trains, Price Guides and more.