Appcelerator Blog

The Leading Resource for All Things Mobile

How Titanium & Arrow aided in winning TNW’s IoT Hack Battle

35 Flares 35 Flares ×

On a last minute invite, I joined The Next Web’s Hack Battle last week in Amsterdam. I thought it would be a good excuse to play with IoT and The Things Network in particular in relation to Titanium and Arrow.

As the rest of my team wanted to focus on Uber, I decided to give it a go on my own. One sleepless night later, ComeEmpty.Me was awarded with 3 partner prizes and overall winner 🏆 of the Hack Battle.

Hack Battle Award

Since I joined to play rather than win, I have decided to donate the €2000 that came with the first prize to Compassion. This Friday I will travel to Rwanda to see how they provide education & care to over 80,000 children.

So, what did I build? And what role did Titanium & Arrow play?

Brainstorming use cases for TTN

The challenge in thinking of a good use case for TTN is to find a situation where its strengths and limitations excel.

The LoraWAN technology TTN uses can reach up to 10 miles and requires low power. This is also comes with the price of low bandwidth, but since IoT is mostly about small sets of (sensor) data this shouldn’t be a limitation in most cases.

TTN Venn Diagram

A lot of ideas I thought of while brainstorming for the Hack Battle didn’t make sense because there was power and WiFi or 3G available to use in those contexts. Although with 3 or more Gateways in reach you could also determine location, it wouldn’t be very accurate, so I had to drop ideas that involve location tracking as well.

So where to use TTN?

You’ll want to use TTN to monitor and/or interact with an known location where you have no power or WiFi and 3G to communicate.


The problem I decided to solve for the Hack Battle was knowing when you have snail mail when you live in a condo or remote area where your (physical) mailbox might be some stairs or good walk away.


I used a The Things Uno and Ultrasonic Sensor HC-SR04 made available by TTN to monitor the mailbox. In production, this would be a small device with multiple sensor to drop in your mailbox. On a certain interval it scans the environment and sends the measurements to TTN.

An Arrow Builder/Web app uses the TTN Node Client to receive the data from TTN via MQTT and store it in ArrowDB. If it comes from a configured device it will determine if the measurements fit an empty or full mailbox and use Arrow Push to send a push notification to the app if that state has changed.

A Titanium app serves as the client for the end-user. Using Arrow Builder APIs it registers the user and device. It also trains the device. The user is asked to empty and later fill the mailbox and give the device some time to send several measurements to later use as comparison for the current state of the mailbox.

How Arrow helped

Since Arrow runs on Node.js I could simply drop in the TTN Node Client to begin receiving messages. Creating the APIs to register and train the device was dead-simple using Arrow API definitions. And since it comes with Arrow Web I could even use the last few hours to set up the landing page that I used to present the hack. And finally Arrow Push took care of notifying the app. Overall, Arrow helped me to communicate with TTN, expose APIs and send push notifications for the app and serve a website with minimal code and time.

How Titanium & Alloy helped

The app I presented was iOS only, but with some minor modifications it would function just as well on Android thanks to Titanium’s cross-platform APIs. The Alloy MVC framework helped me to quickly create the different screens and style them using Global Styles. I also dropped in Manuel’s fancy Circular Progress Widget for the training screens and Mike’s SquareCamera Module for linking the device using a QR-code. All this helped me to build a viable, fully-working app as the jury called it, in just a few hours (12pm to 5am to be precise 😴).

TNW’s Hack Battle was a lot of fun. Next time you join one, consider using Arrow and Titanium to make the most of your time!

Code strong! 🚀

35 Flares Twitter 0 Facebook 0 Google+ 2 LinkedIn 33 Email -- 35 Flares ×

1 Comment

  1. Nothing to say technically about the project, but your donation and your next travel to Rwanda makes me still believe in humankind :)

Comments are closed.

Sign up for updates!

Become a mobile leader. Take the first step to scale mobile innovation throughout your enterprise.
Get in touch
computer and tablet showing Appcelerator software
Start free, grow from there.
35 Flares Twitter 0 Facebook 0 Google+ 2 LinkedIn 33 Email -- 35 Flares ×