What is Pebble talking about?

The Pebble smartwatch is one of the most popular smartwatches. Sofar 1 million smartwatches  have been sold, which made the Pebble the second best selling smartwatch of 2014 according to the Smartwatch Group. Probably due to the relative low price point of the Pebble, and their tech oriented user/developer community,  the company seems to stay a bit under the rader in terms of market share. At this moment Pebble has started a new chapter in their story with a new kickstarter campaign for the Pebble Time, a smartwatch with a color display. With their second Kickstarter campaign they recaptured the position as most funded project with more than $18 million dollars in pledges.

Due to the availability of SDK’s, a large developer community, onlin development environments, lots of samples, the Pebble smartwatch is a very developer friendly smartwatch. But it’s always interesting to explore the possibilities and inner workings of the Pebble even further.  For example, the wireless communication between Pebble and your telephone. How does it work?

When a Pebble is coupled to a smartphone, they communicate via an emulated serial port (RFCOMM) where both the watch and phone exchange binary encoded messages with each other. The innner workings of this protocol was disclosed by Hexxeh (Liam McLoughlin) with his release of the LibPebble library, a Pebble communication library written in Python. While most of the data communication between Pebble and Smartphone is known, the communication pattern i.e. ‘when to say what’ is not completely clear.

Messages sent from phone or Pebble have a variable length and make use of the same encoding. All messages start with a four byte header that specify length and endpoint. The first two bytes contain the length (unsigned integer) of the encapsulated message. The total message length is thus, this length specified in the header plus, the four bytes of the header itself. The last two bytes of the header contain the endpoint (unsigned int) of the communication, and specify the communication type of the encapsulated message. Examples of endpoints are: application messages, logs, and time. And each endpoint makes use of its own message structure.


Pebble message structure
Pebble message structure


While LibPebble is great, it seems that it does not implement the complete Pebble bluetooth protocol. For instance DATA_LOG type messages (endpoint 6778) are not described. And that is where Android developer mode, and Wireshark come to the rescue. With an android phone, all bluetooth traffic can be captured in a logfile. This logfile can be loaded by the Wireshark network sniffer and protocol analyser. And on top of that we can add a custom dissector for the Pebble protocol so that we can closely follow what the Pebble is talking about!

In order to get it all working, you need to have an Android smartphone with developer mode enabled. If you don’t know how to do that, It is probably better to stop reading this post, and find your luck elsewhere.  The Developer options contain an option to enable logging of all bluetooth traffic. When this option is checked, a file (located at: /sdcard/btsnoop_hci.log) is created that traces all bluetooth traffic.

enabling bluetooth logging on Android

When you think you have traced enough, transfer the btsnoop_hci.log file to your PC and open the file in Wireshark.

The only thing we need to do is create a dissector for Pebblish, the protocol spoken by the Pebble, and make this dissector available for Wireshark. For this purpose I wrote a minimalistic dissector in Lua that extracts the length, endpoint of each message, and the start of application messages.  The code for this dissector is available on Github

I’m not going to explain how to add the dissector to Wireshark. There are more than enough good tutorials available on the web that explain how to do this (for example here).

When the  dissector is enabled and the btsnoop_hci.log is loaded in Wireshark, use ‘pebble’ (without quotes) as the filter expression to show only the messages sent/received by the Pebble smartwatch. The result is shown below in the screenshot that displays the conversation between Pebble and smartphone.

Wireshark showing a Pebble conversation

Although the dissector is far from complete, it already gives a lot of insight in the conversation between the Pebble and Smartphone.

Google MyTracks drops support for third party access

Update: The latest version of PebbleMyTracks, that checked the correct MyTracks version, and initiated the installation of the correct version is abandoned from the Play store. In the mean time, PebbleMyTracks is available for download from Dropbox.


The last update of Google MyTracks dropped support for third party access, and instead of that added support for Google Wear devices. Also Google is planning to remove the source code of MyTracks from the repository. This is, politely speaking, an unpleasant event.

From a commercial perspective, I can understand the decision of Google: stimulate the  acceptance of the Google Wear platform, by blocking all paths to may lead to other alternatives.

It is my opinion that it is much better to take a more positive decision: Put your effort in creating the best platform for wearable apps, instead of this negative choice. This decision only stimulates developers and users to turn their back on the Android platform.

As the developer of PebbleMyTracks. I’ll do my best to get a workaround for this ‘inconvenience’ as soon as possible. Therefore I created a version of the app, that checked for the correct version of MyTracks, and if needed, initiated a downgrade so that all requirements were met.

Unfortunately, this version was abandoned by Google from the Play store because the app uninstalled/installed other apps (which is true). So the app is not available from the Play store for the moment. While I’m working on a new version (without the uninstallation) the latest version can be download from dropbox.



Saying goodbye Pebble style

The two primary schools in our little village are getting too small, and so both schools are joining forces and start a new school the next school season. The birth of a new school also means end-of-life for the two primary schools. A sad moment, which I wanted to give some attention by honouring the nice art work that was used by one of the schools ‘De Molshoop’  (The Molehill). The drawings, which were used to lighten up the school newspaper, feature a curious little mole, that’s always busy doing something (reading, walking, etc.).

My way to say goodbye was to write a dedicated watchface for the Pebble smartwatch, that randomly displays a mole while counting down to the end. To get an idea of what it looks like, a screenshot of the watchapp


The source code is available on github (link), and the watchface can be downloaded from the Pebble appstore (link).



OBS de Molshoop

Het ziet er nu echt naar uit dat OBS de Molshoop, de openbare school in Noordhorn, gaat verdwijnen. Woensdag 28 mei hebben de schoolbesturen van Pentaprimair en Westerwijs het besluit voorgenomen om de twee scholen in Noordhorn (het Kompas en de Molshoop) te laten samengaan in een nieuwe samenwerkingsschool. Als alles gaat zoals het is geplanned, begint de nieuwe samenwerkingschool met ingang van het volgende schooljaar.

Tot zover het zakelijke gedeelte, nu word het tijd voor afscheid nemen van een lange periode openbare school in Noordhorn. Een van de dingen waar ik met veel plezier aan terugdenk zijn de ‘molletjesranden’. Dit zijn tekeningen van een klein molletje voor bovenaan de pagina van de schoolkrant. Deze zijn ooit gemaakt door een artistieke ouder. Het molletje is steeds iets anders aan het doen, meestal passend bij het onderwerp van de betreffende pagina van de schoolkrant.

mollenkop lees L

Mijn relatie met het molletje was best intensief, al is het alweer even geleden. Bij het layout-en van schoolkrant, en lustrumboek heb ik ook heel wat tijd besteed aan het precies plaatsen van deze molletjes.

Maar nu komt ook de tijd om ook van het molletje afscheid te nemen, en dat doe ik op mijn eigen, gepaste wijze, in de vorm van een app voor de Pebble smartwatch. Het is een klokje geworden waarin de resterende tijd tot de laatste schooldag wordt teruggeteld, waarbij steeds een ander molletje is te bewonderen. Dan ziet het er als volgt uit:


pebble-screenshot_2014-06-01_21-01-49 pebble-screenshot_2014-06-01_21-06-41



  • De broncode voor de watchapp staat op mijn github account (link)
  • De watchface zelf staat in de Pebble appstore, en wel (link)
  • Directe installatie link voor de Pebble (moet je wel een Pebble hebben, uiteraard)  (link)



Pebble My Tracks

The killer-app for the smartwatch has arrived!

This post is to announce the release of Pebble My Tracks, a watchapp for the Pebble smartwatch that puts Google MyTracks right on your wrist. The watchapp consists of a Pebble watchapp (of course), and an Android companion app which can be downloaded from the google play store (here) and from the Pebble appstore (here).

Cover artWith this app you can start/stop/pause/resume a MyTracks recording while keeping your smartphone safely tucked in your pocket (or ziploc during rain), and you can configure what parameters (speed, distance, heartrate, and much, much, more) are displayed on the Pebble.

Screenshot of the configuration screen of the companion app. Here you can choose which parameter is displayed on the Pebble.

This app is the successor and evolved version of the Pebble MyTracks app that was developed earlier this year and documented on this blog. Please note that this watchapp only works on a Pebble with firmware 2.X installed. At this time of writing this firmware is in beta. I expect (and hope) the 2.X firmware will be released very soon. At that moment I’ll plan to remove the Beta phase of this app as well.

Constructive feedback on errors, enhancements (for example missing parameters) or photos from the app in action (see below) are very welcome. Please send a mail to pieter@meulenhoff.org

2014-02-23 12.38.28
Here’s a nice screenshot (thanks Patrick) of the watchapp in action. The upper number is not speed. It’s heart rate.

Is een smartwatch nuttig?

Op tweakers stond in het kader van de jaaroverzichten een reportage over de smartwatch ontwikkellingen van het afgelopen jaar (link). In de terugblik gaven de verschillende redacteuren van tweakers hun mening over de smartwatch, en verwachtingen voor de toekomst: is het een voorbijgaande hype of een niet te ontkennen ontwikkeling?

Wat me opviel in de terugblik was dat de belangrijkste toepassing voor de smartwatch het snel bekijken van notificaties is: zonder je telefoon uit de broekzak halen kunnen zien dat je een nieuwe mail, tweet, whatsapp hebt. Vanuit dit perspectief is de meerwaarde van een smartwatch naar mijn indruk dan vrij minimaal. In die zin vond ik de blik van de redacteuren van tweakers vrij beperkt. Er wordt heel erg geredeneerd vanuit de toepassingen die je nu al kan op een telefoon, en dan gaat doen op een smartwatch. Dat wordt altijd een moeilijke zaak.

De meerwaarde van een smartwatch zit hem voor mij juist in toepassingen die je niet op je telefoon kan doen, of waar het onverstandig is om het met je telefoon te doen. Een van de momenten waar dit juist naar voren komt is tijdens het sporten.

Met het sporten kan je telefoon veilig (en waterdicht) in je zak/tas blijven zitten, terwijl je via een smartwatch (in  een houder op je stuur) toch volledig toegang hebt tot je sport-app.

Ook op de schaats is hierdoor het gebruik van een smartwatch interessant geworden. Tijdens het schaatsen is het prima mogelijk om even op je horloge te kijken wat de laatste rondetijd was. Smartphone tijdens het schaatsen erbij pakken lijkt mij ronduit gevaarlijk.



Op het schaatsforum (een aanrader) is een discussie gestart over hoe de smartphone goed kan worden gebruikt tijdens het schaatsen (link). In dit soort omgevingen lijkt mij een smartwatch ideaal.

Smartphone mee tijdens het schaatsen

Nu het schaatsseizoen (op de binnenbanen) in volle gang is, en de temperatuur langzamerhand gaat dalen wordt er steeds meer over schaatsen gesproken. Recent op het schaatsforum (www.schaatsforum.nl) een discussie over hoe een smartphone is te gebruiken tijdens het schaatsen.

Buiten (op natuurijs) is dat op zich niet zo’n probleem. Met de bekende apps (Google MyTracks, RunKeeper) is het prima mogelijk om de afgelegde route vast te leggen, en later te bekijken. Wel is het zeer beperkt mogelijk om onderweg te kijken naar de status (Hoe hard ga ik nu? Hoeveel kilometer heb ik nu afgelegd?). Hoewel de eerder genoemde apps de mogelijkheid om de snelheid uit te spreken komt me dit toch wat apart over.

Binnen (op een kunstijsbaan) zijjn bestaande apps minder goed te gebruiken, simpelweg omdat de GPS dekking grotendeels weg is. Uit de disussie op het schaatsforum maak ik wel op dat er toch sommige banen zijn (half overdekt?) waar een app met GPS het toch nog doet. Op de binnenbanen ook dezelfde situatie als buiten. Alleen directe feedback mogelijk door smartphone tijdens het schaatsen uit de zak te halen, of een headsetje. Gezien de drukte (lawaai), en hogere snelheid op de meeste binnenbanen lijkt mij dit ten zeerste af te raden.

In deze situatie is ook het reclamespotje (hier op youtube) van Mark Tuitert leuk. Voor welk product de reclame was, ben ik vergeten. Ik zag alleen die smartphone in z’n schaatspak zitten.

Het probleem van de directe feedback, of het onderweg de voortgang bekijken is op te lossen. Sinds ik een Smartwatch (de Pebble) tot mijn beschikking heb, ben ik van mening dat het anders kan. Een smartwatch, en met name de Pebble, kan prima gebruikt worden om snelheid, rondetijden, afgelegde afstand op weer te geven. Op de binnenbaan kan dit gekoppeld worden de MYLAPS transponders. Buiten kan de ‘sharing’ optie van MyTracks worden gebruikt. In beide gevallen kan de smartphone rustig in de achterzak/broekzak blijven zitten, zo nodig in een schokbestendig en waterdicht zakje.

In de praktijk bevalt het mij enorm goed. Tijdens racefietsen, skeeleren en schaatsen (binnen en buiten) heb ik de Pebble gebruikt. Eindelijk weet ik nu tijdens het schaatsen wat mijn rondetijd is en hoeveel rondes ik heb gereden. Ook mijn smartphone is er blij mee. Die kan rustig een zakje (waterdicht) in de achterzak blijven zitten. Mijn huidige smartphone ziet er daardoor nog als nieuw uit, terwijl mijn vorige ruggedized telefoon door de vele krassen, stoten en butsen is overleden.

Hieronder een screenshot van de Pebble app zoals ik die nu gebruik tijdens het schaatsen. Een screenshot maken tijdens het schaatsen is helemaal niet verstandig, dus even met het horloge op een tafeltje. De getallen zijn van boven naar beneden: het aantal rondes, de laatste rondetijd, en daaronder de snelste rondetijd.



Update: A beta version of Pebble My Tracks for the Pebble smartwatch with SDK 2 is available in the google play store here

Earlier this year, I released an android application to connect the Pebble smartwatch to google MyTracks. Most important feature from my perspective is that a whole session can be controlled from the Pebble watch so that the phone can be packaged in a safe (watertight) bag.

In the last months I tried to get the application stable enough to release it in the google play store. Sofar I did not reach that goal. i repeatedly run into problems with the bridge connection between MyTracks and my app. This is one of the reasons for making the source code of PebbleMyTracks available for everyone.

The source is available on github: https://github.com/pieterjm/PebbleMyTracks

Please send me your comments and improvements.



The new Pebble SDK!

Recently Pebble SDK version 2 was released for the Pebble smartwatch. One of the most interesting new features of the new SDK is the addition of JavaScript code. In practice this means that a part of a watch app is coded in JavaScript, runs on the phone, and is still included in the watch app distribution.

In the previous SDK, the standard pattern for a watch-app often required a smartphone specific app running on the smartphone e.g. for doing HTTP calls, getting location etc. This makes the development process more complicated because apps have to be developed for multiple platforms (e.g. android, IOS). Furthermore the release of applications may be slowed down by the acceptance procedure of Apple.

With the addition of JavaScript in the new SDK it has now become possible to implement the majority of required features in JavaScript (e.g. doing HTTP calls, getting location) instead of a native OS specific application.

I think the Pebble team made a great improvement with the addition of this feature. It will dramatically lower development speed, and thus enable better, and more feature rich watch apps for the Pebble. In the end I would expect that features like this lower the entry level for Pebble watch app development.

In practice

Recently I published my experiments with a watch app, which keeps track of lap times,  for ice skating. The watchapp works with the transponder based service from MYLAPS. A new laptime is recorded and published on the MYLAPS website each time the finish line is passed. The idea is that the laptime is grabbed from the MYLAPS website and presented on the Pebble so that direct feedback on achieved skating performance is achieved.

With the previous SDK, the structure of the application would look something like plotted below. The dedicated app on the smartphone requests data from the MYLAPS website, does some screen scraping, to extra the laptime data and pushes data to the Pebble (number of laps, last laptime, average laptime, fastest laptime, etc.). I never built the app, but in android terms it should be something like a background service coupled to a configuration activity.

With the new SDK the dedicated app on the smartphone can completely be replaced by JavaScript (a HTTP call to the MYLAPS service, document parsing to extract laptimes, and pushing data to the Pebble). Both the JavaScript code and the Watch App are bundled in the same installation package.

Before starting to code a dedicated app for android (in my case) I upgraded my Pebble smartwatch to SDK2 and created a JavaScript file for communicating with MYLAPS.

What’s next

This change in the SDK makes me hungry for more features.

  • Visual IDE (a next step for CloudPebble?) for developing watch apps, and direct linking to JavaScript code
  • Support for websockets. I tested socket.io, and it works, but seems to fall back to long-polling instead of websockets.



Pebble MyLaps

I always thought  it was not possible to have a speedometer like device while speed skating on indoor tracks for several reasons. Especially lack of GPS coverage and no wearable device for viewing speed and lap times. The MYLAPS (http://www.mylaps.com) service, a transponder based timing system, solves only part of the equation. The MYLAPS service provides a website with close to real time data of the transponder. The website or even smartphone app (only for iphone) type of data presentation may be suitable for bystanders or coaches. It does not provide a solution for skater itself.

But times have changed. With the arrival of the Pebble SmartWatch (http://www.getpebble.com) a usable speedometer to be used by the skater has become available.

The only required part to make it work is something that ties the Pebble and the MYLAPS service together. And that something is a program that:

  • Polls and scrapes the MYLAPS practice results pages. Unfortunately MYLAPS does not provide some kind of data API which means that the webpages presented to the user are scraped to extract data.
  • Send an event to a Pebble notification service. For instance Notify My Android  and Notify My Pebble.

A minimal implementation in perl (very handy for screen scraping) is not attached to this post, but is availble on request. The script starts and endless loop in which the practice results page for a specific track and transponder are polled each five minutes. When activity has been detected (a new laptime entry for the transponder), the polling frequency is increased to each 10 seconds. Each new laptime entry is sent to the Notify My Android notification service, and shortly after that arrives at the Pebble. In practice this means that approximately five to ten seconds after passing the finish-line (which contains the MYLAPS detector), a notifcation with the latest laptime is received at the Pebble.

A sample output display (low quality picture alert) is shown below (it is not possible and very unwise to take a screenshot while skating). 2013-10-22 21.32.00Today I did my weekly skating training with the speedometer enabled. The experience was very cool. I could almost instantly see the last laptime after passing the finishline.

Next time I think I try to wear my pebble on my right arm instead of left arm. When track skating, the left arm is mostly lying on your back, and the right arm swings at least during corners, providing a good opportunity to readout the results.

Good improvements are a dedicated watch-app on the pebble that provides larger digits and additional notifications through vibration (fastest lap sofar, number of seconds slower/faster than goal), etc. And in theory the polling app could run on the smartphone itself instead of a remote server. On the other hand, a remote server reduces that amount of wireless data being transferred.

I would assume that the number of Pebbler that own a MYLAPS tracker ID is very, very low. This means that my motivation for building a public version of a Pebble MyLAPS bridge app is purely based on my own needs. So, please let me know if you happen to own a Pebble and a MYLAPS