Sensors are an important part in train automation, because they provide information that a train has reached a certain position on the layout. When reaching a sensor, the automation software is triggered to do different things depending on the specific situation, e.g. stopping the train, allocating a block ahead, releasing the last block, and many other things.

Traditional sensors for the LEGO train systems are based on infrared technology. They have a couple of severe drawbacks:

  • They are heavily subject to the light situation and other environmental influences.
  • They have severe problems of detecting dark vehicles with complicated, stealth-like shapes – especially steam locomotives.
  • They are ugly and comsume a lot of space on the layout.
  • They are difficult to install in curves.
  • They are based on optical, analogue technology, with requires relatively complex and costly controllers to support them.

To overcome these problems, we have built new sensors that are based on a completely different technology: reed sensors!

Reed sensors have the following advantages over infrared sensors:

  • 100% reliable.
  • Respond immediately.
  • Independent of light situation and environmental influences.
  • Can be built into curved without a problem.
  • Small footprint on the layout – can even be installed invisibly.
  • Work digital and require less costly controllers.
  • Cheap to build.

Check out our video on sensors:

Video: reed sensors for the LEGO train layout.

In the video, we explain the design of the sensors and go for a testride with the V200 diesel engine and the Emerald Express.

Implementing the magnets into the trains as shown in the video is supposed to be the best and most reliable version of triggering the reed sensor. Anyway, there is also another solution, which is triggering the sensors with the couplings of the vehicles. This is a bit tricky, because you need to turn the reed sensor by 90°, and it does not work as reliable as the neodyme magnet option shown in the video.

The reed sensor is turned vertically by 90° and must be placed in curves a bit on the outer side of the curve. This is because the couplings of longer vehicles swivel out to the outer side in sharp curves, and are no longer precisely overhead the middle of the track. Nevertheless, a single coupling alone does not trigger the sensor yet (see following picture). The reason is not the strength of the magnetic field, but the lack of defined orientation of the magnetic field. This is because the magnet turns freely inside the holder if uncoupled.

Reed sensor with single coupling: no contact

This change when you attach a 10mm neodyme magnet on the coupling. The magnet strengthens the magnet field of the coupling magnet and aligns it correctly, so that the reed sensors is triggered.

Reed sensor with single coupling and attached 10mm neodyme magnet: contact!

This even works when the coupling is turned away from the centerline of the track.

Even works when couplings is turned away from centerline.

Joint couplings trigger the reed sensor without additional neodyme magnet. Their magnetic fields are supporting each other, and the direction of the magnetic is correctly aligned as required for triggered the reed sensor.

Reed sensor with joint coupling: contact!

The couplings option is in total a bit shaky, and, if at all, only advisable for small layouts. Without additional magnets, the reed sensor will be triggered not until the rear of the loco and front of the first waggon – the first joint pair of couplings pass the sensor.

In the following video, the couplings magnet option can be seen in real life:

Video: reed sensors part II

When operating larger layouts with 20, 30 different trains, of which 10 run concurrently, you will also opt for maximum operational security, and choose the more reliable option shown in the video.

One more thing regarding train motors: a train motor will only trigger a reed sensor if it actively operates, i.e. if current is going through the motor. Only then the magnetic field in the motor is strong enough to trigger the sensor. This should usually be no problem, but when you exhibit your layout on Brickworld, you don’t want to take any risks.

If you want to build the sensors yourself, you need reed sensors type GPS-14A, size 2,5x14mm. The neodyme magnets shown in the video have a diameter of 5mm, height 3mm. You use other magnets if that fits your situation better. Something it is necessary to place two or more magnets in a row, which enlarges and strengthens their magnetic field. If in doubt, better use a magnet too much than too few.

To control the reed sensors, you need a MattzoSensorController. Check out this page to find out how to build it!


9 thoughts on “Sensors

  1. Super Artikel und ich stimme dir zu, bei dem Aufwand den man hier betreibt sollte man nicht an den Magnete sparen und die die Zuverlässigkeit des Systems gefährden.

    Ggf. kannst du den Artikel ja noch um ein Bild vom Schaltplan und eine Erläuterung, wie das Sensorsignal an Rocrail weitergeleitet wird, erweitern (oder kommt das später noch in einem Extra-Artikel?)

  2. Es gibt noch die omnipolaren Hallsensoren bei welchen die Richtung der Magneten keine Rolle spielt. Da ja auch der Reedkontakt einen Neodym Magneten benötigt, ginge dies auch für den Hallsensor.

    1. Stimmt, aber leider sind die auch entsprechend teuer. Da wir fast 100 Sensoren benötigen, ist die Lösung mit den Reed-Schaltern aus unserer Sicht besser. Zu Hall-Sensoren werde ich aber vielleicht auch noch mal etwas bringen.

  3. I’d like to suggest adding amazon affiliate links for the equipment your are using. I would like to start playing around with this, but I have very little experience with micro controllers. Affiliate links would help lower the barrier to entry because i know I’m at least buying the right equipment.

    1. Hi Andrew,
      sounds like a good idea. I hesitated at first, because I wanted to keep the project private and didn’t want to give it a commercial touch. But I believe you are right, it might help in the end.

      When I have more time, I could shoot a video showing how to wire and solder the controller. Would you be interested in that as well?


Leave a Reply

Your email address will not be published. Required fields are marked *