My Märklin – digital rail layout

HO UK model rail

DIY – Occupancy Detection Track

In just under two hours I removed, modified and returned seven contact tracks to the layout and they all worked, first time! 

Here’s How:

At the outset I wholeheartedly acknowledge the fine work done already on this subject:


without which I would be still trying to use a variety of reed switches, infra red emitters and detectors, and then disguising them around my layout. I also acknowledge, from the Netherlands: Rudysmodelrailway – Arduino used as an S88 occupancy detector board .

The beauty of the ‘Cook’ detection track is that nothing is visible as no outer rails are needed to be cut, and (unlike the infra-red detectors I’ve played with) only one wire (not three), needs to be routed back to the Arduino Mega acting as an S88 occupancy detector. As Rudy Boer states the Arduino clones cost only a few Euros.

I bought my Arduino Mega for €6.60, compared to the dedicated Märklin S88 at €43.

Where I deviate slightly from Stephen Cook is the process rather than the outcome.

  1. Isolate a piece of Märklin C-track to be used as a contact track.
  2. On the rear I use a Dremel 3000 (set to one level above the slowest speed) with a 32mm cutting disc (Cutting: 426 Fiberglass Reinforced Cut-off Wheel) to cut the centre ‘Bahnstrom’ rail at two places 3 studs apart. See photo. In this way I don’t have to remove entirely the whole of the centre rail as in Stephen Cook’s example.
  3. I then use the edge of the cutting disk to roughen the top surface of the centre rail section. This makes it easier to solder the wire, which will run back to the Arduino. See photo
  4. I then remove the 3 stud piece of track
  5. Insert this section of track in a small vice, or in my case, held fast with pliers
  6. Using a 12watt fine tipped soldering iron I tin the surface of the middle rail on the area roughened. When this is done the solder and wire adheres better to the piece of track.
  7. Measure out a piece of blue wire from the track back to the position of the Arduino. Leave some slack –  better to long than too short. Cut to length and strip both ends of the wire.
  8. Solder a blue wire to the section of track. This is the trickiest part of the whole operation, to get correct.
  9. Reinsert the cut track with the soldiers wire into the track by push and clicking into place. (I’ve found this can be done ‘in situ’ if you wish, as it also has the added advantage that the soldered joint doesn’t pop of when reinserting into the track
  10. In addition to the process described by Stephen Cook, I use another piece of wire to cross connect the opposite B = Bahnstrom contacts on the track piece. This ensures continuous electrical connectivity to the other side of the circuit, as the centre track is now cut and isolated from the rest of the rail layout circuit.
  11. Test the continuity of the wired sections with a continuity detector/multimeter
  12. Test the centre track in its entirety to ensure the Barnstorm completes along the full length of track.
  13. Reinsert the contact track into the layout and route the blue wire back to the Arduino acting as a S88 detector.

Initially I noticed a slight stutter of the locomotives running over the contacts, at low speeds however in normal running speeds there were no problems, even when the contact wire is unconnected to the Arduino. By readjusting the height of the studs, I’ve since overcome the stutter issue.


Tools used Dremel 3000, multimeter, fine nose pliers cutter/stripper, soldering iron. On the floor my trusty Makita with my longest masonry drill bit for making wiring ‘tunnels’ in the foam base board.


The track with the three stud strip removed, ready for tinning and adding the wire


The wires now firmly soldered across the top of the 3 stud middle rail, ready for reintroducing back into the track bed.


The track with the centre rail added and the continuity wire in place

My first batch of making the occupancy detector tracks was hampered by the erratic behaviour of my soldering iron which had a dodgy connection, leading to some messy joints. Thanks to my local Maplins store I was able to exchange it for a fully function iron which made my second batch of tracks a doddle to complete.

25 August 2020

It’s been a while since I first wrote this page and I thought I’d better produce an update.

Up to today I have made 30 contact rails for my layout, and all using the centre rail. By judicious use of the Dremel, I can now add a soldered cable without removing the rail, by first scouring the centre rail surface to give sufficient bite for the tinning of the solder to the rail to take place.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: