How to make your Pebble smartwatch really tick

“Tick tock, goes the clock, And Now what shall we play?”.

Pebble smartwatch is an amazing piece of hardware with no less amazing software to support it. Pebble appstore boasts huge variety of watchfaces from intricately carved art pieces to simplicity personified. And the apps, my gods the apps! You want to track your sleep, count swimming stokes, automate your home – Pebble can do all those things and more. But something was missing. Something that ordinary mechanical clocks could do since the dawn of time.

Tick tock, goes the clock, And then what shall we see?

Yes, the lulling sound of tick. Pebble seemed to be missing the essential sound of time. “But Pebble doesn’t have mechanical parts! (or at least a speaker)” say you. “Who needs them”, say I.

Pebble has an excellent vibe motor, that is used to alert wearer of incoming notifications, serve as alarm wake up call and much more. But Pebble SDK also offers custom vibration pattern capability where you can set your own pattern of vibes and silences with millisecond precistion. And if you set vibe duration really short – it will be imperceptible by your wrist – and yet you can hear it.

Knowing this, here’s just the 2 pieces of code needed to make your Pebble tick:

// Vibe pattern: short 2ms vibe to imitate tick
static const uint32_t const segments[] = { 2 };
VibePattern pat = {
  .durations = segments,
  .num_segments = ARRAY_LENGTH(segments),
};

this will declare a custom vibe pattern with only one very short 2-millisecond vibe. Add it to your other constant and variables declaratins. Done that just add this line

// emittting 2ms vibe or "tick sound"
vibes_enqueue_custom_pattern(pat);

to place in your code that reacts to second change (timer tick etc.). Every second it will emit the 2ms vibe that would be perceived by ear as “tick”. To see, I mean, hear this in action play the video above and listen carefully. Or better yet – download the demo watchface and/or its source from links below.

DISCLAIMER: Since this code will start your vibe motor every second – it will wear your battery more quickly. Also even though the motor is designed to run hundreds of thousands of times, there’s a chance it will wear out more quickly. Run at your own risk.

Useful Links:

One reply

Leave a Reply

Your email address will not be published. Required fields are marked *