Software

Desktop apps, eLearning and more.

Database

Database driven sites, applications, knowledge

Mobile

iPhone and Android get apps that travel

Web

Creating online businesses since 2003

Matt Clark, CTO at GORGES, wins best-of-August for Pebble Watch programming

Published 11/10-2013

Image of watch by Matt Clark, CTO at GORGES, a weather station for your wrist in a Pebble Watch.

In my last post I discussed developing my first app for the Pebble Watch.  My family and I were driving to Maine for summer vacation last week, and I wanted my watch to display the times of the next low and high tides.  A survey of the existing Pebble apps showed me that no one had created a solution.  I now had a hackathon project for my vacation week!

The first step was to develop a plan of attack.  To create a Pebble tide and weather app, I needed an online provider of tide and weather information, and then figure out how to get that information through a smart phone to the Pebble.

There are several online weather API’s, and both HAMstation.com and wunderground.com looked promising.  However these are commercial services, and I did not know if my needs would exceed the pricing of their minimal-use developer license.  A bit more searching and I ended up at the National Oceanic and Atmospheric Administration website, specifically their tide monitoring and prediction products.  They offer a free service for accessing their tide prediction data for several hundred locations in the continental US.

The next hurdle was figuring out which monitoring station from the NOAA list to use.  I was able to obtain a list of the monitoring stations with latitude and longitude.  The GPS location of the smart phone could be used in a Haversine formula calculation to find the closest station.  I created a simple MySQL database to store the station list, and added a web service page that finds the closest station, and placed these on one of our GORGES servers.  With the station identified, I could obtain a list of the high and low tides from the NOAA service.  I had to cull the list by checking each of the stations with an automated script – some of these stations are inland and supply no tidal information.

I chose to use httPebble to communicate with the Internet from the Pebble.  The httPebble app is available freely in the App store, and contains functionality to access the Internet, get GPS location information from the smart phone, and store information on the phone for data persistence (which is missing in the standalone Pebble operating system).  One limitation of the httPebble app is that only up to 124 characters of information can be transmitted at a time;  therefore I had to strip unnecessary information and compress the tidal information in order to conform to this limit.

I added a graphic to the display that shows the tidal direction and current relative tide level.  Since I thought current weather conditions would also be useful, I wrote a similar web service that receives GPS coordinates and returns the temperature and weather icon.  I used the freely-available OpenWeatherMap.org web service for this information.

Regarding developing for the Pebble watch, it feels like the early versions of iOS development for the iPhone.  The debugging tools are minimal, and the cycle of save-edit-compile-link-download-test is slower than modern web development, where quick cycles of save-refresh can be used to test during software development.  My Pebble watch had to be restarted many times during development, and the lack of being able to store information on the watch itself (data persistence) means that each watchface and app has to reset from scratch when switching between watchfaces/apps.  For users, the Pebble has to be paired via Bluetooth with a smart phone and also have the httPebble app launched and working, and there are many steps that can go wrong while trying to retrieve the data.  I had to spend a good deal of effort properly handling the possible exceptions.

Regarding the future of the smart watch, it is definitely promising.  I can see how future versions will have color screens, audio support, and of course an improved operating system and development tools.  Give technology advancements a few years, and pairing with a smart phone won’t be necessary since the watch will have voice, data, and WiFi features included.

If you are a Pebble watch owner, you can download the Tide and Weather Watch app at either of these two URLs:

In the week since I wrote and posted this watch app, I see from server log records that there are hundreds of users trying it out, from locations all over the coastal US.

Author

Matthew Clark Chief Technical Officer
Matthew Clark

Chief Technical Officer

comments powered by Disqus

Related Projects

Tell us your idea! ×