This series of posts is going to cover what it takes to write a simple application for the Pebble smartwatch. It will start from the absolute basics, and end with a working application written using JavaScript that can fetch information from the web.
Because it’s going to be fairly wordy, have a table of contents:
Part 1 - Introduction - Why write a Pebble app in 2020 - An explanation of the different Pebble devices & platforms - An introduction to Pebble apps Part 2 - Pebble SDK options - Installing the SDK Part 3 (Coming soon) - Introduction to PebbleJS - Writing your first app - Calling an API for data Part 4 (Coming soon) - Writing an App configuration page - Advanced PebbleJS concepts
The only thing assumed about the reader in this series is that you have some programming experience. It doesn’t have to be much but some is required. If you don’t have any, consider learning some Javascript first.
Why write a Pebble app in 2020?
…and beyond. I’ll tell you!
Pebble Technology Corp filed for administration in 2016, and Fitbit acquired most of their assets, so you may be wondering why you’d want to write an app for a Pebble smartwatch in 2020+. I feel like if you’re reading this post then you probably already have your own reasons, but the short version is that thanks to an awesome group of people Pebble watches live on, with 99% feature parity with how they functioned before collapse.
The Pebble smartwatches are special for their always-on e-paper display, multi-day battery life (up to 10! days), and huge selection of free apps and faces produced by die-hard fans. As such they are still a delight to write apps for, and have an active developer community.
A prompt pebble primer
Before get to actual programming, you should know what model Pebbles there are, and what the differences between them are.
Over the course of Pebble Technology Corp.’s lifetime, they produced 6 different watches across 3 different Kickstarter campaigns. They are:
The ‘OG’ Pebble
The OG Pebble was the first Pebble ever made, and arguably the first modern smartwatch. Kickstarting the smartwatch revolution that seems almost mundane today. With a 144 × 168 black and white memory LCD screen, magnetometer, accelerometer, vibration motor and more, it was quite the concept in 2012.
Pebble Steel
The Pebble Steel was the more refined follow-up to the OG Pebble. Launched outside Kickstarter it offered more internal storage and a premium construction. Like the OG it is waterproof and, thanks to it’s screw-based rather than glue-based construction, it’s the easiest Pebble to repair. The Steel also introduced a multicolor LED on the front, but due to the hit to the battery life it caused, the LED only ever saw use as a charging indicator.
Pebble Time and Time Steel
Launched through a second Kickstarter, the Pebble Time (left) and Time Steel (right) were the next-gen Pebbles. They introduced a colour screen, as well as a microphone, larger batteries, and smartstraps – an accessory port on the back for straps with additional hardware. The only difference between the Time and Time Steel is the construction and battery, with the Steel being having a more premium BOM and a 10-day battery vs the Time’s 7.
Pebble Time Round
Shortly after the second Kickstarter, Pebble announced the Pebble Time Round. The thinnest smartwatch in the world. It’s a got a 180px circular screen and is the only Pebble that isn’t waterproof. The battery life is much less than other models as well, at only 2 days.
Pebble 2
The last watch Pebble shipped before their bankruptcy, the Pebble 2 was launched through a third Kickstarter along with the Pebble Time 2 (which never shipped). It was touted as a more affordable option, at only $99. It maintains feature parity with the Time series watches, but with a black and white display. The Pebble 2 HR also has a heart rate monitor, whilst the Pebble 2 SE does not.
Profusion of Pebble Platforms
These 6 watches make up the 4 distinct platforms that you can write apps for. Watches with the same feature set, such at the Time and Time Steel are part of a single platform. Each platform has slightly different capabilities, and as such it’s important to consider which models you want to support when writing your app. The biggest issue tends to be Pebble round support, as any custom layouts will need to be re-done for the round display. PebbleJS handles layouts automatically in a lot of cases, so it is possible to write code that doesn’t need any per-platform logic.
Watch Name | Platform Codename | Colour Display? | Microphone? | Display Resolution |
OG | Aplite | N | N | 144 x 168 |
Steel | Aplite | N | N | 144 x 168 |
Time | Basalt | Y | Y | 144 x 168 |
Time Steel | Basalt | Y | Y | 144 x 168 |
Round | Chalk | Y | Y | 180d (circular) |
Pebble 2 | Diorite | N | Y | 144 x 168 |
Preparing to Pebble
Okay. That was a lot of words. By this point you’re probably raring to get started. Well we still have a few things to do before we can write code, but we’re almost there!
When writing an app for the Pebble, there are two options: Javascript or C. Each has it’s own benefits and drawbacks, and there are important differences between the two, so lets understand them first.
Pebble apps written in C run on the watch itself, so they can function when the watch isn’t connected to the phone. They can’t technically talk to the internet themselves, instead they send ‘appMessages’ to a runtime called PebbleKitJS which runs on the phone. This Javascript runtime can then make calls to the internet, and send data to the watchapp again through appmessages. Writing Pebble apps in C is more performant, and more flexible. However the barrier to entry is much higher, and you’ll be expected to do tricky things like memory management. And writing C code. Therefore for this tutorial we won’t be covering it.
The alternative to writing Pebble apps in C is to write them in Javascript. PebbleJS (a totally different thing to the aforementioned PebbleKitJS, confusing I know) is a Javascript runtime for writing Pebble apps. Technically the app is running on a Javascript runtime on your phone, then sending information to the watch to be rendered etc. This means Javascript apps won’t run if the Pebble isn’t connected to your watch, but seeing as most apps get data from the internet, this isn’t a new limitation anyway. For this tutorial we’ll be using PebbleJS.
Now that that’s been explained, we’re ready to get cracking. Part two of this four part series will cover installing the Pebble software development kit (SDK), which is required to build our Pebble apps.