NOTE: This is a previously unpublished post from 2015
When you think of Australia day what would normally come to mind? Celebrating with mates? A BBQ and (often too many) beers? All of these things are pretty standard when it comes to celebrating Australia’s national holiday… but one thing that probably doesn’t come to mind is Salesforce.
For those of you outside of Australia, Australia Day is a national holiday celebrating the foundation of Australia. Like most things here, it’s a pretty relaxed affair. A newer tradition is to listen to the Triple J Hottest 100, a crowd sourced music countdown on Australia’s national alternative radio station. Something else a lot of Aussies do, is setup a backyard slip-n-slide.
So, what does this have to do with Salesforce, you ask. Well… every year a couple of my mates who are electrical engineers host an Australia day party… and being engineers, they couldn’t just settle for any old backyard slip-n-slide… No, their slip-n-slide had a full timing system, leaderboards and a drag racing style Christmas tree! The previous iterations of the slide lacked analytics and a way to track who performed each ride… enter Salesforce.
This year I jumped in on the project and using Salesforce, provided a way to track each person’s runs, display all run-times easily and allow for data from other sources (e.g. the currently playing song on the Triple J Hottest 100) to merge with our data.
Every time a person wanted to use the slide, they’d scan their unique barcode, wait for the traffic light to go green, and then do their run. The christmas tree would not go green until the course was clear. A series of 6 sensors, placed along the slide run would report data back to a microcontroller (in this case, a teensy 3.0). This data was calculated into times and pushed into Salesforce by a processing sketch. The processing sketch also handled scanning of barcodes and control of the Christmas tree.
Each run down the slide was recorded inside Salesforce, including sector times, total time and speed, with each run being related to the current rider’s contract record as well as the currently playing song on Triple J.
So how did we achieve this? Each time a person scanned their barcode the data was recorded by the processing sketch, and once a run had been completed the barcode number, along with all of the timing data, was pushed in to Salesforce via the processing sketch. As processing is derived from java, It was easy to write a Salesforce connector using existing libraries leveraging the salesforce REST API. This connector created a slide run record in a custom object from this data each time a run was completed.
Upon creation of this record a trigger would fire that called a custom web service class. This web service made a callout to retrieve an XML file that Triple J updated each time a song is played. The class retrieves the file, parses it and stores the currently playing song information against the record.
To tie this all together, a custom app appropriately called ‘Straya Day was created, which consisted of the object tabs and several visualforce tabs to serve as leader boards. This resulted in three main visualforce pages;
- Last 10 Runs – Displays the last 10 runs down the slide, with the last run in a larger font at the top of the page, as well as the currently playing track on Triple J
- Top 10 Runs – Displays two tables, the 10 fastest runs by ET and the 10 fastest runs by total time. Also displays the last run and currently playing track in large font at the top of the page.
- Top 10 by Gender – Displays two tables, 10 fastest runs by girls sorted by total time, and 10 fastest runs by guys sorted by total time. Also displays the last run and currently playing track in large font at the top of the page.
The ‘Straya Day app was then displayed on a laptop, with the page set to refresh every 10 seconds, so that when a rider had completed their run, they could view their time and the currently playing song on the laptop.
Now for some photos.
The slip and slide itself, running down the side of the house and round into a
catchment area at the end. You can see the yellow timing beams beside the slide.
The VisualForce page and people checking their recent runs.
The big mess-o-wires (teensy3, etc) collecting data from the sensors and reporting back to the processing sketch.
If you are keen to get started on something like this yourself? I have placed some example code for the processing sketch, as well as the JJJ fetch web service on my github.