Lego train level crossing automated by Arduino Micro video
This Lego train level crossing is automated using a sensor before and a sensor after...

This Lego train level crossing is automated using a sensor before and a sensor after the crossing. When a train activates the first sensor, the bars are lowered. Once the last wagon of the train activates the second sensor, the bars will go up again. The program automatically detects which sensor is activated first, so the crossing can be used in both directions.
I wanted to draw power from the rails to power the system. Unfortunately the lego train motors produce too much electric noise which disturbed the microcontroller. I wasn't able to filter out the noise sufficiently.
I wanted to draw power from the rails to power the system. Unfortunately the lego train motors produce too much electric noise which disturbed the microcontroller. I wasn't able to filter out the noise sufficiently.