Eef1668f 3465 4cbc b2ab 5ec2cfea622c


LEGO track switch using LittleBits

by cfsl

Published on March 7, 2018

An automated track switch for LEGO trains.  Trains choose one track 4 times in a row, then switch once to the other track.

Duration: 1 day

How To Make It


Build the circuit The circuit starts with a power bit connected to a long LED. The LED illuminates a light sensor. The long LED's output is connected to the light sensor's input to power the sensor. The light sensor is in DARK mode. When the light is blocked, the sensor's output goes high, triggering the number bit to count up. The output of the number bit is connected to a threshold. As soon as the threshold is reached, two things happen (via a split wire).

The first thing is that the number bit is reset to zero using the reset input on top of the number bit. This way you can have the number bit count up until a certain number, then reset, then start counting up again. Over and over.

The second thing that happens is that a timeout is triggered. The timeout is in OFF-ON mode, meaning that it turns off for a certain time, then turns on again.

This causes the servo to move to its OFF position, flipping the track switch. After a delay, the servo moves back to its ON position. The ON position of the servo is determined by the slider. The number bit after the slider is set to "read value" to show the servo position.

The above is the essence of the circuit. However, sometimes when the servo moves, there is interference on the signal line causing the servo to move back and forth a few times before settling. I solved this by decoupling the servo from the rest of the circuit with a wireless transmitter/receiver. The output of the number bit goes into the wireless transmitter, and the servo is connected to the wireless receiver. This obviously requires an extra power bit and power source.
E934688a 86b8 4b7a 9bd0 41609dbde712


Adjust all the knobs This is the tricky part. There are 4 settings to adjust.

1. Light sensor. Adjust the sensitivity to the ambient light. The sensor should trigger just once for the entire train. If it is slightly too sensitive, it will trigger with each wagon.

2. Threshold. This determines how many rounds the train does on one track before moving to the other track.

3. Timeout. The timeout should switch the servo long enough so that the train has fully passed the track switch, but before it reaches the track switch again. Unless you want to train your LEGO rescue team. The timeout is VERY difficult to adjust for short time spans. Move it by fractions of a millimeter...

4. Slider. The slider determines how far the servo moves. It should move far enough to trigger a track switch (the LEGO switches require quite some force!).


Enjoy your automated LEGO train control system Marvel at your creation. You may want to demo this with less than 4 rounds on the first track, otherwise your audience may get impatient :-)
A7849511 dc74 444d a4ed 854ba9514ef8

Related Projects

Cake delivery by Nairo Quintana

Nairo Quintana, a national cyclyst hero in the history of Colombia makes a special delivery for the LitteBits´ birthday...

TheEasiestWayToChargeYourPhone #ChainReaction Contraption

We created a super complicated way to charge your phone. It starts with you touching a domino. In this Rube GoldBerg project there...

Shopping Delivery, Imagined 50 Years From Now

Our Product Design and Design-Thinking Course 13 y.o. students made this project to take part in MAKE IT MOVE design-challenge. In...