[kodera2t] discovered the VL53L0X Time of Flight sensor and thought it would make a great way to control the operation of a model train without touching it.
The sensor was small enough for an N-gauge train, which translates to 1:148 scale or about 9mm from rail to rail. His idea was to build a tiny control board that could fit inside the locomotive: 10mm by 40mm. His board consists of the ToF sensor, an ATMega328P-MMH, USB-serial, and a Texas Instruments DRV8830 motor driver. he powers the board via the 6V running through the track.
Right now [kodera2t]’s using the ToF as sort of a gestural controller to get the train to start rolling, but one could imagine the sensor could be incorporated into more advanced programming, like having the train speed up on straightaways and slow down on a curve, based on the height of the bridge over it.