Main content

Using Twitter to control a slot-car race - MistaJam vs Scott Mills

Patrick Sinclair

Editor's note: engineers in radio used to concern themselves with balancing audio and locating transmission towers but they now have a whole set of rather more pressing concerns - like how to stop slot cars spinning off the track when too many people tweet Scott Mills. Patrick Sinclair - a software engineer in the Interactive team - explains how connecting social networks with physical things (Using the volume of tweets from listeners to control a slot car race, to be specific) makes for good drivetime entertainment - SB.

Behind the scenes, we used:

  • The .
  • A Ruby script using the TweetStream gem to fetch tweets in realtime.
  • The Ruby script posted to written in C.
  • The Velleman K8055 USB board connected to a .

We built a computer-controlled 'fake controller' that plugged into the track, just like a normal manual controller. Slot car controllers are basically just variable resistors. We varied the resistance by connecting relays across resistive load. As we turned the relays on and off, it enabled and disabled the resistors, varying the speed of the cars. Each of the resistors were potentiometers, which allowed us to calibrate the speed of the cars ahead of the race.

The relay board was connected to a USB interface board, which was then plugged into a laptop. We wrote a custom HTTP-to-USB server to make it easy for the Ruby script to turn the relays on and off.

The hardware allowed for a range of seven speeds: from 'slowest' through to 'fastest' and then 'eleven' where the car would spin off the track and finally 'out of this world' where the car would literally spin off into orbit!

We timed how long the car would take to track for each of the speeds so in theory each tweet would make the car go around the track once. Each car would have a queue of outstanding laps based on the number of tweets received, and the size of this queue would affect the speed the car ran at.

Compared to our previous efforts, using SMS messages, Twitter's was amazing because we could get real-time feedback - within seconds of users tweeting, the car would respond. With the SMS feed, there was a delay of a couple of minutes between a message being sent and us receiving it.

The lessons were:

  • It was incredibly difficult to calibrate the system. There were too many variables - from variations between the cars, how the brushes on the cars were set up and how the resistors performed. It also performed very differently once the cars and resistors had warmed up.
  • It's hard to anticipate the volume of tweets. We received 82 tweets in one second at the start of the race while we were anticipating a few hundred during the course of the race. So we had to tweak how the system was set up a couple of times during the race, causing the cars to stop whilst the system rebooted.

For next time:

  • We'll allow the configuration to be changed without having to restart the system.
  • Be more accurate by measuring when the cars actually cross the finish line as opposed to guessing how long it took the cars to go around the track.

Patrick Sinclair is a software engineer at 主播大秀 Radio1

  • Watch the Twitter race or listen to the whole programme .
  • More pictures from the race .
  • The 主播大秀's staff magazine Arial about Radio 1's recent social media experiments.

More Posts

Previous

Peter Horrocks' somewhat smaller world

Next

Daily live concerts on 主播大秀 Radio 3