dweet.io paired with Arduino gives table game a live scoreboard

Guest Post by Thomas Amberg (@tamberg)

We used dweet to connect a foosball table to the Internet during an IoT workshop at Hyperwerk Basel. The main advantage of the service is that it also works without authentication, that it’s trivial to use for everyone who can send a simple Web request, that it’s based on the open JSON standard and that it adds timestamps to entries. As we used Arduinos with either an Ethernet shield or CC3000 WiFi modules, SSL encryption was not an option for us. When we found that dweet enforces SSL through redirects and contacted support, the nice folks at Bug Labs immediately adapted their service to enable our use case.

image

[Arduino with CC3000 WiFi module and PIR sensor, CC BY-SA tamberg.org]


image

[Arduino mounted to goal bay, CC BY-SA tamberg.org]


Here’s how it works: Each goal bay is equipped with an Internet-connected Arduino, a PIR sensor to detect goals, and a button to “undo” goals that do not count under the local foosball rules. On startup or reset, the goal counter is set to 0. If a goal is detected, the counter is incremented. If the “undo” button is pressed, the counter is decreased by one. Upon every change, the counter value of the receiving team is submitted to dweet with a POST request sent to http://dweet.io/dweet/for/hyperwerk_{team}?count={value}
image

[Screenshot of the Javascript code, CC BY-SA tamberg.org


The score is displayed on a simple Web page. A small Javascript fetches both team’s goal counters and displays them, using jQuery’s “getJSON” function and Javascript’s “setInterval” for polling. As the page works right from any computer’s desktop, no additional hosting is necessary. In Chrome you can use the “View > Presentation Mode” setting to hide the browser menu. Add a beamer, and you’ve got a great score display. A nice side effect of the time-stamp that dweet.io adds to each post is that you could even extract a timeline of the game, for free.

image

[Internet of Toeggelikaste at Hyperwerk Basel, CC BY-SA tamberg.org]

It was a fun project, and we would love to hear from you.

- Thomas (@tamberg)