Raspberry Pi Detects Trains in Stockholm Subway

Imagine waiting for a train in a subway. As the train arrives, a nearby poster of a woman has hair blowing all over her face, as if in response to the wind from the incoming train. As the train stops, the woman in the poster clears her hair from her face and resumes her smile, until the next train arrives. The Stopp Family, a Stockholm production company and Akestam Holst, an ad agency, have joined forces for modifying one of the play screens of Clear Channel in the Stockholm subway. The idea was to simulate the effect of turbulence from the train catching the model’s hair as it arrives at the platform.

This required a device that could sense the arrival of the train without reacting to the passing passengers. After studying several possible solutions such as wind sensors and sound detection the team came to settle on an ultrasonic sensor for measuring the distance.

The team connected the ultrasonic sensor to the popular single board computer, the Raspberry Pi or RBPi, which was running a Python socketserver. The RBPi sent the measured distance to a connected client at predefined intervals. The client, a flash application, received the measured distance and when this reached a predefined value, triggered a video of the model’s hair blowing in the wind.

The most critical factor was in deciding when to trigger the video. The distance measured by the sensor was about 4 meters when the train was on the platform, which increased to 7 meters when there was no train. To prevent false triggering, the team had to set up some rules for the video to trigger to play. They found that best results were obtained when the video was triggered with distance readings between 3.9 and 4.1 meters. Moreover, once the video had played, it could be triggered again only after the client received three readings with distances greater than 6.9 meters. With these two rules, they were able to prevent the same train triggering the video more than once, while also preventing the video from being triggered by nearby people.

With this simple but stunning project, the team is able to extend the existing and create new technical solutions further. They can now define new interactive platforms. Rather than simply changing advertisements to fit the technology, they are now in a position to adapt technology to fit ideas that are more creative for advertising.

Ultrasonic sensors work by sending out bursts of ultrasound – sound that is beyond the range of human hearing – at about 40 KHz. The RBPi generates the timing for the bursts and waits for an echo. The sound travels until it meets an obstacle that can reflect it back to the transmitter, in the form of an echo. A receiving sensor, placed close to the transmitter, senses the echo and informs the RBPi. By multiplying the speed of sound with the measured time elapsed between the original burst and its returning echo, the RBPi calculates the distance travelled by the burst and hence, the distance of the obstacle from the unit.