TrainSense is a novel infrastructure that uses model trains to support mobility in wireless sensor networks. It adjusts the hardware and software of a model train controller to provide real-time train control, precise positioning of trains via detectors on the tracks, and energy management. Wireless sensor nodes are integrated with model trains. This allows practical applications like self-deployment of nodes to repair network routes and data muling to collect and upload data from static nodes as a train passes by. Related work on mobility in wireless sensor networks uses robots or robotic vacuums rather than taking advantage of an existing model train infrastructure.