Sending SMS to the Raspberry Pi using Twilio, Azure & UWP

Microsoft Edge Case

Recently I got involved with a really cool project based around the Microsoft Edge Case. You can check it out here #microsoftedgecase. Martin Beeby & Martin Kearn (a.k.a. M&M) built a machine to make checking if your website has passed the edge case a lot more interesting than using the website. The machine allows you to enter your website via keyboard input, then it gets your score out of 5 based on whether your website has passed the edge case test and prints it out as a receipt.

There was light, there was smoke, there was a lot of buttons and it was a lot of fun!

The Edge Case
The Microsoft Edge Case

Micro Edge Case

So in preparation for the IoT talk at Stacked 2015, we decided to make a Micro Edge Case! Essentially we wanted to take this huge monster machine and make a mini version of it using a Raspberry Pi with Windows 10 IoT core. There were a few things to think about such has how to get the input, how do we inform the user of the result, how can we fit it all into an orange carton!? (we ended up using wood in the end). It was challenging, but we did it – and more importantly, it works!

Input: We decided to use Twilio. Users would be given a mobile number that they can text their website’s URL to.

Process: A UWP application that gets the latest text message using the Twilio API, then does a call to the Edge Case API to get the test results. Test results are then processed into a format appropriate for the device that it is being run on. And this is a beauty of making this application a UWP application: it runs on computers, mobile devices, tablets and on the IoT core. We used the power of tailored views to change the way users could see the results based on their device i.e. Raspberry Pi = display on LCD screen, computer = display in a table format, and so on.

Output: We didn’t have a printer attachment to the Pi so we decided to display the result on a small LCD screen in the format ” : 3/5″.

So where does Azure come in?

Twilio does not yet support an SDK for windows 10 apps, therefore I made a web app in Azure to use the Twilio API services (using PHP).

So in reality the architecture looks more like this:

SMS -> Twilio -> UWP -> Web App (using Twilio API) -> UWP -> Edge Case API -> UWP -> Display results

And here is the final Micro Edge Case:

Micro Edge Case
Micro Edge Case

My next course of action is to replace my SMS queueing logic (that is currently in the web app using PHP) to a better FIFO system using Azure queues, as this will be more efficient. Watch this space!

If anyone is interested, I am more than happy to write a more detailed blog explaining the code behind all of this.

What to check out this project’s code? Here’s our GitHub repo: https://github.com/thebeebs/microedgecase

A bunch of cool people that were involved and you should follow:

Martin Beeby – https://twitter.com/thebeebs

Martin Kearn – https://twitter.com/MartinKearn

Joni Collinge – https://twitter.com/dotjson