FoosBlog: Using the AtHoc SDK for Foosball

While we were investigating use cases for BlackBerry SDKs, a lot of fun ideas started to come up. This got me thinking about some of the ways BlackBerry AtHoc might increase efficiency in the office – and possibly a use case related to my work hobby: Foosball!

Situated in our lunchroom is an official tournament-grade foosball table, and here at BlackBerry we take our foosball very seriously. However, a large inefficiency in our office hobby is the inability to quickly organize groups of four to play a game. When you have some free time and want to play foosball, but all your colleagues are busy, what do you do? Foosball is a four-person sport and we have heartbreakingly witnessed groups of three at the foosball table, asking every passer-by whether they would like to join their game. To address this problem, we iterated on several different versions of our solution over the course of our work term at BlackBerry.

Version 1

The Raspberry Pi contraption that we initially developed was crude. We used buttons on a breadboard to send a BlackBerry AtHoc alert to a predefined distribution list of foosball players in the office. The contraption would be placed near the foosball table and if anyone was ever in need of additional players to start a game, all they had to do was press the button. Then, foosball lovers across the office would be notified by an AtHoc SMS that there was a spot available to play a game. We decided to name our contraption FoosPi.

Version 2

After setting up the FoosPi v.1 by the foosball table, it was not long before we got feedback for improvements. It was exciting for users to feel like our solution was genuinely satisfying a need in the office – and that with some more improvements, there could be mass adoption of FoosPi. One major issue reported by our users was the inability to recognize how many people were required to fill the open foosball spots when the alert was sent out. At this stage, the AtHoc alert was quite general: “Somebody at Foosball Table A is looking for players!”.

So, our next iteration of FoosPi included buttons and lights on the breadboard corresponding to how many people were available to play. We started by adding 4 different LEDs with corresponding buttons. The buttons worked as on/off switches for the lights and represented the foosball players already available at the table. For example, if there was a group of 3 foosball players ready to play, the group would click buttons to turn on 3 of the 4 lights on the breadboard. A Python program running on the Pi would count the number of lights that were switched off and send an AtHoc alert with the following message: “Somebody at Foosball Table A is looking for 1 player!” And just like that, FoosPi v.2 was born! 

Version 3

We initially had planned to stop at FoosPi v.2 – we never thought that we would need a sophisticated application for a Foosball AtHoc alert system. However, while showing off our project, we joked about how the next step would be for us to attach a camera to see who was sending out the AtHoc alerts. With this feature, there was a way for the people receiving the AtHoc alert to decide whether they would like to play with who was at the table. The joke slowly snowballed into tinkering, and once again, we were back working on FoosPi v.3.

We grabbed a Raspberry Pi camera and started by configuring the same button that sent out the AtHoc alert to also take a picture and upload it to blob storage in the Azure cloud. Our Python program would also insert the URL of the cloud image in the payload of the AtHoc alert before the alert was sent out. The final product is pictured below:

A sample SMS sent using our Fossball AtHoc Alert System looks like:

And after you opened the link in the alert, you would see something like this: 

The final product was an AtHoc SMS that not only told foosball players across BlackBerry that players were needed, it also told them how many players were needed and gave them a picture of the players at the table.

Here is the project’s high-level architecture diagram:

Future Functionality

And of course, we are always looking for ways to improve this project.  Some other ideas that we would hope to implement in the future are as follows:

1.     Be able to respond to the Athoc SMS to say that you are on the way
2.     Run face identification on the image using Azure FACE API to identify players
3.     Ability for the requesting player(s) to approve or decline a request to play
4.     A screen to see yourself when sending out the picture

This application can be found on the BlackBerry community projects GitHub repo. For more in-depth technical information please refer to the README file included. For all other questions and comments, check out the BlackBerry Forums.

Azin Taqizadeh

About Azin Taqizadeh

Enterprise Solutions Development Student - IoT

Denis Po

About Denis Po

Business Analyst Student (IoT)