Beacon Scavenger Game

IMG_5049_s

Today’s Understanding Networks class was a Beacon scavenger hunt. Tom and Maria Paula hid a group of Beacons (Arduinos and Raspberry Pi) around the floor. These Beacons share the same service UUID and characteristic UUID. The assignment and challenge was to build an app that would scan, connect and read the values of these characteristics and earn points. The first team to earn 50 points unlocks the golden egg, which is the last Beacon to discover.

The game rule was to get close enough to each Beacon to claim them. Since the server that was checking this had no way of knowing the actual RSSI value any Beacon was sending to my phone, I cheated a bit by hardcoding the RSSI into my app, so I can scan and claim Beacons even if I’m not close enough. My team earned the most points but lost the golden egg, because another team had connected to it with the LightBlue app. Just shows how sometimes using readymade technology and manual labor can beat out hours of coding something automated from scratch.

The code for my app is here.

Here’s how the app worked. We didn’t have time to make an UI for the app, so I just added some alerts and appended responses in JSON to the html to understand what’s going on.

After login and retrieving a token from the server, I tap the scan button to scan all Beacons with a specific service UUID and list them out.

After login and retrieving a token from the server, I tap the scan button to scan all Beacons with a specific service UUID and list them out.

I tap on any of the listed Beacons to connect, read the value, package its data into an object, and post it to the server to claim points.

I tap on any of the listed Beacons to connect, read the value, package its data into an object, and post it to the server to claim points.

So close to claiming the golden egg!

So close to claiming the golden egg!

Most importantly, we all got cupcakes in the end.

IMG_5045