Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Hack Dads came to Pebble Rocks Boulder with the intention of making a fully functional Pebble Smartstrap that runs without the need for an external power supply. We have achieved this goal with the Hack Dads Pebble Altimeter Smartstrap. The Hack Dads Pebble Altimeter Smartstrap uses a small microprocessor and altimeter sensor to feed elevation data to a Pebble Time watchface. The watchface processes this data and creates an informational view that shows current altitude with ascent or decent status. By flicking your wrist, a real-time graph can be viewed. The Hack Dads Pebble Altimeter Smartstrap creates a complete example of how a low-power smartstrap can be achieved using just a few external components.
Our project consists of two main parts:
Hack Dads Pebble Altimeter Watchface
The Hack Dads Pebble Altimeter Watchface allows our smartstrap users to track their current altitude and relative change over time. In addition to the time and altitude (in feet), we display an indication of current altitude as compared to prior via color-coded arrows:
If the user taps or shakes the watch, they can view a real-time, animated graph of their altitude over the last number of
SAMPLES (currently 10):
We chose to make a watchface, rather than watchapp, so that the user can continually view the Altimeter while still being able to move between Timeline Pins. The app uses the
Smartstraps API to retrive the current altitude from the Teensy each second. We used the Pebble Graphics framework to animate the arrows and altitude graph. We also use
AppTimers to trigger the altitude data read, hide the graph window, and enable the splash screen.
The complete GPL3-licensed Hack Dads Pebble Altimeter Watchface source can be found in on GitHub.
Hack Dads Pebble Altimeter Smartstrap
The hardware for the Hack Dads Pebble Altimeter Smartstrap consists of just two main components:
- Teensy 3 Series microcontroller that uses the Freescale Kinetis K20 Family of microcontrollers
- Sparkfun Altimeter sensor that uses a Freescale MPL3115A2 precision altitude sensor
The firmware for the Hack Dads Pebble Altimeter Smartstrap was created using the Teensyduino add on for the Arduino IDE. Two external libraries were used in conjuction with the Teensy libraries.
At the request of the Hack Dads Pebble Altimeter Watchface, the Teensy sends an I2C message to the altimeter sensor, reads back the data, and then sends the requested data through the smartstrap connection to be handled by the watchface as necessary. The watchface currently queries the smartstrap for data once per second.
Reducing the current consumption of the Teensy is an integral part of allowing the smartstrap to run using only the Pebble Time for power. The overall current consumption of the smartstrap needs to be below the 20mA at 3.3 volts that the Pebble Time can source. To achieve this power goal the Teensy needs to be converted to run at 3.3V by cutting the VBUS to VIN trace. This decouples the 5V USB input from the VIN rail that feeds the 3.3V regulator. We then power the board directly from 3.3V pin. With this modification, the Teensy will run at about 25mA at the full clock speed. To further reduce the current consumption, we lower the system clock to 24MHz. This brings the current consumption down to the 16mA range without using any of the advanced low power features that the K20 provides. Further reduction of current consumption can be achieved with sleep and hibernate modes (1.4mA and 900uA respectively).
The complete OSHW Hack Dads Pebble Altimeter Smartstrap source can be found in on GitHub.