Difference between revisions of "PineTime"

From PINE64
Jump to navigation Jump to search
(grammar/spelling corrections)
(Update Amazfish links)
 
(271 intermediate revisions by 68 users not shown)
Line 1: Line 1:
= PINE64 SmartWatch "PineTime"  =
[[File:Pinetime.png|400px|thumb|right|The PineTime]]


The PINE64 SmartWatch, dubbed "PineTime", is used in the community effort for an open source smartwatch and collaboration with wearable RTOS and Linux app developers/communities.  
The '''PineTime''' is a free and open source smartwatch capable of running custom-built open operating systems. Some of the notable features include a heart rate monitor, a week-long battery, and a capacitive touch IPS display that is legible in direct sunlight. It is a fully community driven side-project which anyone can contribute to, allowing you to keep control of your device.


PineTime development has been broken down into two distinct phases:
== Getting started ==
* Phase One - PineTime Dev Kit Project on October 2019
* Phase Two - Introducing the PineTime smartwatch around Q1 2020, depending on development results in Phase 1.


'''Read these first!'''


* [[Upgrade PineTime to InfiniTime 1.0.0|Upgrading your new PineTime to InfiniTime 1.0.0]]
* [[PineTime Devkit Wiring]]
* [[Reprogramming the PineTime|Reprogramming the PineTime (development kit)]]
* [[Switching your PineTime between InfiniTime and Wasp-os]]


== '''PineTime Concept Photo''' ==
The frequently asked question can be found in the article [[PineTime FAQ]].


[[File:PineTime_leaflet.jpg]]
== Default OS ==


The current default operating system on the PineTime is called [[InfiniTime]], you can find more information about the firmware on its GitHub page. First devkits shipped with a proprietary custom firmware.


== '''PineTime Case and Charging Cradle Photos''' ==
You can find a list of available firmware and other software here: [[PineTime Development]]


[[File:PineTime_on_wrist_Photo.jpg]]
== Companion Apps ==
[[File:PineTime_PPG_Sensor_Photo.jpg]]
[[File:PineTime_Charging_Cradle_Photo.jpg]]


== '''Watch Information''' ==
PineTime/InfiniTime needs a companion app to e.g. upload a firmware, get notifications from a phone, or just get the date/time. 
* LAUNCH:
Here are some companion apps:
** Announced: Tweet on 13 September 2019
** Devkit Release: October, 2019
** Expected Release: Q1/Q2 2020, pending on development result
** Availability: at least 5 years


* BODY:
* [https://www.gadgetbridge.org Gadgetbridge] (Android >= 4.4) - Companion mobile app, supports updating firmware/bootloader, send notifications, etc.
** Dimensions: 37.5mm x 40mm x 11mm
* [https://github.com/piggz/harbour-amazfish/ Amazfish] ([https://sailfishos-chum.github.io/apps/harbour-amazfish/ SailfishOS], [https://open-store.io/app/uk.co.piggz.amazfish Ubuntu Touch] and [https://flathub.org/apps/uk.co.piggz.amazfish Linux]) - Companion mobile and desktop app, supports updating firmware/bootloader, send notifications, etc.
** Weight: 38 grams
* [https://github.com/alexr4535/siglo Siglo] (Linux) - Companion desktop app.
** Build: Zinc Alloy and Plastic
* [https://github.com/ZephyrLabs/PinetimeFlasher PinetimeFlasher] (Windows) - Companion desktop app, only supports flashing firmware.
* [https://apps.apple.com/us/app/nrf-connect-for-mobile/id1054362403 nRFConnect] (iOS) - Only supports flashing firmware.  The app is closed source and versions after 4.24.3 don't work for the PineTime anymore
* [https://github.com/xan-m/InfiniLink InfiniLink] (iOS) - Companion mobile app in development. Supports updating firmware/bootloader, setting date and time, Apple Music controls, and battery and heart rate data.
* [https://gitea.elara.ws/Elara6331/itd ITD] (Linux)


* DISPLAY:
== Specifications ==
** Type: IPS capacitive touchscreen, RGB 65K colors
* '''Dimensions:''' 37.5 x 40 x 11mm
** Size: 1.3 inches
* '''Weight:''' 38 grams
** Resolution: 240x240 pixels, 1:1 ratio
* '''IP Rating:''' IP67 (waterproof to 1 meter (sealed edition!))
* '''Display:'''
** '''Size:''' 1.3 inches (33mm) diagonal
** '''Type:''' IPS capacitive touchscreen, RGB 65K colors
** '''Display Controller:''' ST7789
** '''Resolution:''' 240x240 pixels
* '''System on Chip:''' Nordic Semiconductor nRF52832
* '''Flash:''' 512KB with additional 4MB SPI NOR
* '''RAM:''' 64KB
* '''Bluetooth:''' [[PineTime_Bluetooth|5.0 (including Bluetooth Low Energy)]]
* '''Sensors:''' Accelerometer, Heart rate sensor
* '''Feedback:''' Vibration motor
* '''Battery:''' 170-180mAh 3.8V LiPo


* PLATFORM:
== Community ==
** OS: Various open source RTOS such as Zephyr, FreeRTOS, Mbed or NuttX
** SoC: NORDIC Semiconductor nRF52832 (final product may use nRF52840)
** CPU: 64MHz ARM Cortex-M4F


* MEMORY:
=== Forum ===
** Internal: 512KB Flash, 64KB DRAM
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]
** Additional: SPI NOR 8MB Flash (final product may use 16MB Flash)


* COMMUNICATION:
=== Chat ===
** Bluetooth 5 (including Low Energy)
* [https://matrix.to/#/#pinetime:matrix.org Matrix Channel] (No login required to read)
* IRC Server: [ircs://irc.pine64.org#pinetime irc.pine64.org] Channel: PineTime
* [https://t.me/pinetime Telegram group]
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]


* FEATURES:
Developers and coding:
** Sensors: Accelerometer, PPG Heart Rate Sensor
* [https://matrix.to/#/#pinetime-dev:matrix.org Matrix Channel] (No login required to read)
** Actuator: Vibrator
* [https://t.me/pinetime_dev Telegram group]
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]


* BATTERY:
=== Development efforts ===
** Built-in LiPo 170-180mAh battery
** Charging: Proprietary 2pin 5V 500mA, USB type A plug


To read more about development on the PineTime, the projects available and more technical details, check out [[PineTime Development]]


* PRICE:
=== Useful articles and blog posts ===
** USD $22.99 (PineTime pebble and charging cradle, based on phone on PineTime devkit hardware configuration)
** USD $2 and up (20mm straight generic wrist band, in silicone, Milanese steel, leather, etc)


If you want to dive in to the ecosystem, here's a short list of various articles and blog posts that can help you set up your soft- or hardware development environment.


== PineTime Schematic and Certifications ==
* [https://www.ncartron.org/one-week-with-my-pinetime---a-feedback.html Using the PineTime in production (January 2021)]
* PineTime Main Board Schematic:
* [https://lupyuen.github.io/articles/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]
** not yet available
* [https://lupyuen.github.io/articles/building-a-rust-driver-for-pinetimes-touch-controller Building a Rust Driver for PineTime’s Touch Controller]
* PineTime Certifications:
* [https://lupyuen.github.io/articles/porting-druid-rust-widgets-to-pinetime-smart-watch Porting (druid) Rust Widgets to PineTime Smart Watch]
** not yet available
* [https://lupyuen.github.io/articles/optimising-pinetimes-display-driver-with-rust-and-mynewt Optimising PineTime’s Display Driver with Rust and Mynewt]
* [https://electronut.in/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]
* [https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html Removing the lock and installing another firmware on the nRF52832 using CMSIS-DAP dongle on Linux]
* [https://github.com/JF002/nrf52-baseproject/wiki/Build,-program-and-debug-NRF52-project-with-JLink,-CMake-and-CLion Build, program and debug NRF52 project with JLink, CMake and CLion]
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]
* [https://zephyrlabs.github.io/Watchfaces/ Zephyrlabs: just a bunch of watchfaces made for the pinetime]
* [https://pankajraghav.com/2021/04/03/PINETIME-STOPCLOCK.html Creating a stopwatch in Pinetime (with Infinitime)]
* [https://kj7rrv.com/fixing-a-pinetime-charging-cradle Fixing a broken charging cradle]
* [[PineTime Custom Watchface Tutorial]]
* [[PineTimeStyle]]


== Hardware ==


== Datasheets for Components ==
=== Display ===
* NORDIC SoC information:
 
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf NORDIC nRF52832 Product Brief]
Note: The factory-default software on the PineTime does not auto-detect the display being disconnected when it has already booted. That can cause garbled output, to fix it just restart the PineTime.
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52840%20product%20brief.pdf NORDIC nRF52840 Product Brief]
 
* PMU (Power Management Unit) information:
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:
** [http://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]
 
** [http://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]
{| class="wikitable"
* SPI Flash information:
|-
** [http://files.pine64.org/doc/datasheet/pinetime/MX25L6433F,%203V,%2064Mb,%20v1.6.pdf Macronix 64Mb(8MB) SPI NPR Flash]
! PineTime pin
** [http://files.pine64.org/doc/datasheet/pinetime/MX25L12835F,%203V,%20128Mb,%20v1.6.pdf Macronix 128Mb(16MB) SPI NPR Flash]
! ST7789 pin
* LCD Panel:
|-
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3" 240x240 IPS LCD Panel Specification for PineTime]
| LCD_SCK (P0.02)
** [http://files.pine64.org/doc/datasheet/pinetime/ST7789V.pdf 11.6" Sitronix LCD Driver/Controller Datasheet]
| SPI clock
* Touchpad information:
|-
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]
| LCD_SDI (P0.03)
** [http://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6" Nynitron CST816S Capacitive Touch Controller Datasheet in Chinese]
| SPI MOSI
* Sensor:
|-
** [http://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial VAcceleration Sensor Product Brief]
| LCD_RS (P0.18)
** [http://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Hear Rate Sensor Data Sheet]
| Command/Data pin (CD)
|-
| LCD_CS (P0.25)
| Chip select
|-
| LCD_RESET (P0.26)
| Display reset
|-
| LCD_BACKLIGHT_{LOW,MID,HIGH}
| Backlight (active low)
|}
 
Notes:
 
* Chip select must be held low while driving the display. It must be high when using other SPI devices on the same bus (such as external flash storage) so that the display controller won't respond to the wrong commands.
* SPI must be used in mode 3. Mode 0 (the default) won't work.
* LCD_BACKLIGHT_* is used to enable the backlight. Set at least one to low to see anything on the screen.
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.
 
'''References''':
 
[https://github.com/adafruit/Adafruit-ST7735-Library/ Adafruit ST7789 driver in cpp]
 
=== Battery measurement ===
 
Reading whether the PineTime has power attached is easy: simply read the charge indication pin (P0.12). When it is high it is running on battery, when it is low it is charging.
 
Reading the battery voltage is a bit harder. For that you can use the battery voltage pin on P0.31 (AIN7). The returned value is 12 bits, which means it is 0..4095. You can get the measured voltage with the following formula, assuming a reference voltage of 3.3V (this is configurable in the ADC):
 
adcVoltage = adcValue / (4095 / 3.3)
 
The measured voltage is actually half of the actual battery voltage, because the ADC is connected between a voltage divider where both resistors are 1MΩ. This can be corrected by multiplying the value:
 
batteryVoltage = adcValue * 2 / (4095 / 3.3)
 
It's often better to avoid floating point values on embedded systems and in this case there is no reason to use float at all, we can just represent the value in millivolts. Therefore the formula can be simplified to:
 
batteryVoltage = adcValue * 2000 / (4095 / 3.3)
batteryVoltage = adcValue * 2000 / 1241
 
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.
 
=== Button ===
 
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.
 
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.
 
Note that the button consumes around 34µA when P0.15 is left high. To reduce current consumption, set it to low most of the time and only set it to high shortly before reading it. The button needs a short time to give good outputs though, setting P0.15 high at least four times in a row seems to result in enough delay that P0.13 has a stable output.
 
=== Touch panel ===
 
The touch panel is controlled by a Hynitron CST816S chips. Unfortunately, there is not much information about this chip on the internet apart from the datasheet below and a [https://github.com/lupyuen/hynitron_i2c_cst0xxse/ reference driver]. This is enough to implement a basic driver, but crucial information needed to implement advanced functionalities are missing (I²C protocol and registers, timings, power modes,...).
 
==== Pins ====
 
* P0.10 : Reset
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)
* P0.06 : I²C SDA
* P0.07 : I²C SCL
 
==== I²C ====
 
* Device address : 0x15
* Frequency : from 10Khz to 400Khz
 
'''NOTE: ''' The controller goes to sleep when no event is detected. In sleep mode, the controller does not communicate on the I²C bus (it appears disconnected). So, for the communication to work, you need to tap on the screen so that the chip wakes-up.
 
'''NOTE: ''' The I²C bus, also known as TWI bus, has known issues, make sure to write your TWI driver with timeouts.
 
==== Touch events ====
 
Touch information is available from the 63 first registers of the controller. Remember: the device is in sleep mode when no touch event is detected. It means that you can read the register only when the touch controller detected an event. You can use the ''Interrupt'' pin to detect such event in the software.
 
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) :
 
{| class="wikitable"
! Byte
! Bit7
! Bit6
! Bit5
! Bit4
! Bit3
! Bit2
! Bit1
! Bit0
|-
|0
|colspan="8"|?
|-
|1
|colspan="8"|GestureID : (Gesture code ,
 
0x00: no gesture,
 
0x01: Slide down,
 
0x02: Slide up,
 
0x03: Slide left,
 
0x04: Slide right,
 
0x05: Single click,
 
0x0B: Double click,
 
0x0C: Long press)
|-
|2
|colspan="4"|?
|colspan="4"|Number of touch points
|-
|3
|colspan="2"|Event (0 = Down, 1 = Up, 2 = Contact)
|colspan="2"|?
|colspan="4"|X (MSB) coordinate
|-
|4
|colspan="8"|X (LSB) coordinate
|-
|5
|colspan="2"|?
|colspan="2"|Touch ID
|colspan="4"|Y (MSB) coordinate
|-
|6
|colspan="8"|Y (LSB) coordinate
|-
|7
|colspan="8"|Pressure (?)
|-
|8
|colspan="8"|Miscellaneous (?)
|}
 
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).
 
'''NOTES'''
 
* The touch controller seems to report only 1 touch point
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.
 
==== Registers ====
 
The reference driver specifies some registers and value, but there is no information about them:
 
{| class="wikitable"
 
!Register
!Address
!Description
|-
|HYN_REG_INT_CNT
|0x8F
|
|-
|HYN_REG_FLOW_WORK_CNT
|0x91
|
|-
|HYN_REG_WORKMODE
|0x00
|0 = WORK, 0x40 = FACTORY
|-
|HYN_REG_CHIP_ID
|0xA3
|
|-
|HYN_REG_CHIP_ID2
|0x9F
|-
|HYN_REG_POWER_MODE
|0xA5
|0x03 = SLEEP (reset the touchpanel using the reset pin before using this register : pin_low, delay 5ms, pin_high, delay 50ms then write 3 to register 0xA5)
|-
|HYN_REG_FW_VER
|0xA6
|
|-
|HYN_REG_VENDOR_ID
|0xA8
|
|-
|HYN_REG_LCD_BUSY_NUM
|0xAB
|
|-
|HYN_REG_FACE_DEC_MODE_EN
|0xB0
|
|-
|HYN_REG_GLOVE_MODE_EN
|0xC0
|
|-
|HYN_REG_COVER_MODE_EN
|0xC1
|
|-
|HYN_REG_CHARGER_MODE_EN
|0x8B
|
|-
|HYN_REG_GESTURE_EN
|0xD0
|
|-
|HYN_REG_GESTURE_OUTPUT_ADDRESS
|0xD3
|
|-
|HYN_REG_ESD_SATURATE 0xED
|0xED
|
|}
 
'''WARNING : ''' <del>Writing the SLEEP command (write 0x05 in HYN_REG_POWER_MODE) seems to freeze the controller (it returns only static values) until the battery is totally drained and the whole system reset. Analysis and debugging is more than welcome!</del>
 
=== Accelerometer ===
The on board accelerometer in devices shipped before July 2021 is a Bosch BMA421, connected to the I2C bus.
Devices shipped after July 2021 use a Bosch BMA425 accelerometer.
 
==== Pins ====
 
* P0.06 : I²C SDA
* P0.07 : I²C SCL
* P0.08 : Interrupt
 
I2C Device address : 0x18
 
=== Reducing power consumption ===
 
The PineTime appears to be able to sleep with a current consumption of [https://github.com/InfiniTimeOrg/InfiniTime/issues/53#issuecomment-783654321 only 66µA].
 
To investigate current consumption, it's a good idea to disable everything possible to get the lowest current consumption possible, and then re-enable things one by one. Here is one way to get a baseline current consumption of 60µA, as measured from the 3.3V pin with the battery disconnected:
 
* Enable the DC/DC regulator. This doesn't affect the current consumption while sleeping, but almost halves the runtime current consumption.
* Use the low-frequency (32.768kHz) oscillator.
* Leave all pins in their default state, except for P0.05 (SPI CS) and P0.25 (LCD CS) which should be configured as an output and set to high.
* Put the heart rate sensor in sleep mode by setting the PDRIVER (0x0C) register to 0, see [https://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf#page=12 the HRS3300 datasheet for details].
* Put the SPI flash in [https://datasheet.lcsc.com/szlcsc/2005251035_XTX-XT25F32BSOIGU-S_C558851.pdf#page=38 deep power-down mode] by setting flash CS high, then low, then writing the byte 0xb9 on the SPI bus, and then setting flash CS high again.
* Sleep in a loop, using WFE or WFI (if you're using the Nordic SoftDevice, call <code>sd_app_evt_wait</code> instead).
 
Here are some current consumption statistics (current consumed in addition to the baseline power), roughly ordered from large to small:
 
{| class="wikitable"
!Source
!Current
!Notes
|-
|SWD
|3.05mA
|Power cycle the chip after programming to avoid this, it can hide other inefficiencies.
|-
|LCD
|5.61mA
|Set the LCD to sleep mode when not used, using SLPIN.
|-
|Backlight high
|12.27mA
|-
|Backlight mid
|5.51mA
|-
|Backlight low
|1.83mA
|-
|ADC left enabled
|1.3mA
|Stopping SAADC brings the current back to the baseline. It seems that it doesn't need to be disabled entirely.
|-
|UART left enabled
|1.25mA
|Some bootloaders might leave the UART enabled after they start the application, leading to high current consumption.
|-
|Edge triggered pin interrupts
|0-0.47mA?
|It appears that under some configurations, edge triggered interrupts result in a large power drain. One way to avoid this is by using the pin sense mechanism.
|-
|Accelerometer
|0.15mA
|151µA in performance mode, 99µA with performance mode disabled but power saving disabled, 50µA while polling on a high interval (100Hz, average 4 samples), 14µA when running at the lowest possible setting that still counts steps (50Hz, no averaging).
|-
|HRS sensor is enabled
|0.1mA
|The HRS3300 sensor is enabled on power on. Write byte 0x00 to the PDRIVER register (0x0C) to set it in sleep mode.
|-
|BUTTON_OUT left high
|0.04mA
|See [[#Button|Button]] for how to avoid this.
|-
|SPI flash sleep mode
|0.014mA
|Sleep mode still consumes power. Put it in [https://datasheet.lcsc.com/szlcsc/2005251035_XTX-XT25F32BSOIGU-S_C558851.pdf#page=38 deep power down mode] to avoid this.
|-
|SPI, I2C
|(negligible)
|SPI and I2C appear to consume very little power when idle, around 1µA or less.
|}
 
== Accessory ==
 
The following accessory is compatible with the PineTime.
 
=== Watch band ===
 
The PineTime uses a standard 20mm watch band / strap. There is a [https://forum.pine64.org/showthread.php?tid=9392&pid=81902 thread] in the forum discussing this.
 
Due to the watches design. Retention for the spring bars are recessed into the watch. Not all 20mm bands / straps work. This is especially the case for Nato style bands / straps being too thick.
 
 
Known working bands:
 
* [https://www.bisonstrap.com/products/bisonstrap-waterproof-sport-silicone-watch-bands-black?variant=40103305543773 BISONSTRAP 20mm Quick Release Silicone Watch Band] / [https://www.amazon.com/dp/B08XTNKQSJ Amazon US]
* DMVEIMAL 20mm Quick Release Watch Band Metal Strap / [https://www.amazon.com/gp/product/B0BGJC8CXG Amazon US]
* Morsey 20mm Quick Release Watch Band / [https://www.amazon.com/dp/B08DD57SHV Amazon US]
* langley Milanese Watch Band Stainless Steel Wristband Replacement Strap Width 20mm / [https://www.aliexpress.com/item/4000935646261.html Aliexpress] Be sure to select 20mm!
* [https://www.horlogebanden.com/milanaise-mesh-horlogeband-staal/?classid=20+mm Milanese Horlogebandje Fijn Geweven Mesh Staal at horlogebanden.com] Ships to Netherlands and Belgium.
 
=== Cases ===
There are no cases for PineTime yet, but some cases for Fitbit are suitable for it. Cases for Fitbit have one microphone hole, which is unnecessary for the PineTime, but otherwise they fit perfectly.
 
* [https://www.aliexpress.com/item/1005003150606521.html Soft TPU case for Fitbit Versa 2/Versa Lite from AliExpress]
* [https://www.aliexpress.com/item/1005003329398933.html Screen Protector Soft Cover for Fitbit Versa 2 from AliExpress] rather loose fit and collects shower water under it. Also lets dust in, but protects against scratches.
 
The community designed the following cases:
* [https://www.thingiverse.com/thing:4172849 PineTime Smart Watch case by dara0s at thingiverse]
* [https://www.thingiverse.com/thing:4651462 PineTime dev kit back fix by joaquimorg at thingiverse]
* [https://www.thingiverse.com/thing:4763267 PineTime dev kit charging holder v4 by zevix81 at thingiverse]
* [https://www.prusaprinters.org/prints/88913-pinetime-charger-case PineTime Charger Travel Case by brett at PrusaPrinters]
 
== Datasheets, Schematics and Certifications ==
 
=== Schematics ===
* [https://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a]
* [https://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]
 
Note: The part number for the SPI FLASH in the schematic diagram is not correct, the PineTime features a larger external FLASH device, see below.
 
=== Chip Datasheets ===
 
NORDIC nRF52832 information:
* [https://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf nRF52832 Product Brief]
* [https://infocenter.nordicsemi.com/pdf/nRF52832_PS_v1.4.pdf nRF52832 Product Specification v1.4]
 
ARMv7-M information:
* [https://developer.arm.com/documentation/ddi0403/ee/?lang=en ARMv7-M Architecture Reference Manual]
 
=== Component Datasheets ===
 
PMU (Power Management Unit) information:
* [https://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]
* [https://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]
 
SPI Flash information:
* [https://www.elnec.com/en/device/XTX/XT25F32B+%28QuadSPI%29+%5BSOP8-200%5D/ XTX XT25F32B 32Mb(4MB) SPI NOR Flash] (data sheets for this part are hard to find but it acts similar to other QuadSPI SPI NOR Flash such as [https://www.macronix.com/Lists/Datasheet/Attachments/7426/MX25L3233F,%203V,%2032Mb,%20v1.6.pdf Macronix 32Mb(4MB) SPI NOR Flash])
* [https://datasheet.lcsc.com/szlcsc/2005251035_XTX-XT25F32BSOIGU-S_C558851.pdf XTX XT25F32B]
* IDs for XT25F32B are: manufacturer (0x0b), device (0x15), memory type (0x40), density (0x16)
 
LCD Panel:
* [https://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3" 240x240 IPS LCD Panel Specification for PineTime]
* [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6" Sitronix LCD Driver/Controller Datasheet]
 
Touchpad information:
* [https://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]
* [https://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6" Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]
* [https://wiki.pine64.org/images/2/2f/CST816S.zip Touch Controller Datasheet en]
 
Sensor:
* [https://datasheet.lcsc.com/lcsc/1912111437_Bosch-Sensortec-BMA425_C437656.pdf BOSCH BMA425 Triaxial Acceleration Sensor Datasheet on current PineTime device]
* [https://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial Acceleration Sensor Product Brief on early PineTime device]
* [https://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]
 
=== Certificates ===
* [https://files.pine64.org/doc/cert/FCC_Grant_PineTime_2AWAG-PINETIME_DTS.pdf PineTime FCC Certificate]
* [https://files.pine64.org/doc/cert/CTL2203033031-W%20RED%20Certificate.pdf PineTime CE Certificate]
 
=== Manuals ===
* [[:File:PineTime Quick Start Guide.pdf|PineTime Quick Start Guide]]
 
[[Category:PineTime]]

Latest revision as of 05:40, 19 September 2024

The PineTime

The PineTime is a free and open source smartwatch capable of running custom-built open operating systems. Some of the notable features include a heart rate monitor, a week-long battery, and a capacitive touch IPS display that is legible in direct sunlight. It is a fully community driven side-project which anyone can contribute to, allowing you to keep control of your device.

Getting started

Read these first!

The frequently asked question can be found in the article PineTime FAQ.

Default OS

The current default operating system on the PineTime is called InfiniTime, you can find more information about the firmware on its GitHub page. First devkits shipped with a proprietary custom firmware.

You can find a list of available firmware and other software here: PineTime Development

Companion Apps

PineTime/InfiniTime needs a companion app to e.g. upload a firmware, get notifications from a phone, or just get the date/time. Here are some companion apps:

  • Gadgetbridge (Android >= 4.4) - Companion mobile app, supports updating firmware/bootloader, send notifications, etc.
  • Amazfish (SailfishOS, Ubuntu Touch and Linux) - Companion mobile and desktop app, supports updating firmware/bootloader, send notifications, etc.
  • Siglo (Linux) - Companion desktop app.
  • PinetimeFlasher (Windows) - Companion desktop app, only supports flashing firmware.
  • nRFConnect (iOS) - Only supports flashing firmware. The app is closed source and versions after 4.24.3 don't work for the PineTime anymore
  • InfiniLink (iOS) - Companion mobile app in development. Supports updating firmware/bootloader, setting date and time, Apple Music controls, and battery and heart rate data.
  • ITD (Linux)

Specifications

  • Dimensions: 37.5 x 40 x 11mm
  • Weight: 38 grams
  • IP Rating: IP67 (waterproof to 1 meter (sealed edition!))
  • Display:
    • Size: 1.3 inches (33mm) diagonal
    • Type: IPS capacitive touchscreen, RGB 65K colors
    • Display Controller: ST7789
    • Resolution: 240x240 pixels
  • System on Chip: Nordic Semiconductor nRF52832
  • Flash: 512KB with additional 4MB SPI NOR
  • RAM: 64KB
  • Bluetooth: 5.0 (including Bluetooth Low Energy)
  • Sensors: Accelerometer, Heart rate sensor
  • Feedback: Vibration motor
  • Battery: 170-180mAh 3.8V LiPo

Community

Forum

Chat

Developers and coding:

Development efforts

To read more about development on the PineTime, the projects available and more technical details, check out PineTime Development

Useful articles and blog posts

If you want to dive in to the ecosystem, here's a short list of various articles and blog posts that can help you set up your soft- or hardware development environment.

Hardware

Display

Note: The factory-default software on the PineTime does not auto-detect the display being disconnected when it has already booted. That can cause garbled output, to fix it just restart the PineTime.

The display is driven using the ST7789 display controller. Use the following pins to drive the screen:

PineTime pin ST7789 pin
LCD_SCK (P0.02) SPI clock
LCD_SDI (P0.03) SPI MOSI
LCD_RS (P0.18) Command/Data pin (CD)
LCD_CS (P0.25) Chip select
LCD_RESET (P0.26) Display reset
LCD_BACKLIGHT_{LOW,MID,HIGH} Backlight (active low)

Notes:

  • Chip select must be held low while driving the display. It must be high when using other SPI devices on the same bus (such as external flash storage) so that the display controller won't respond to the wrong commands.
  • SPI must be used in mode 3. Mode 0 (the default) won't work.
  • LCD_BACKLIGHT_* is used to enable the backlight. Set at least one to low to see anything on the screen.
  • Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.

References:

Adafruit ST7789 driver in cpp

Battery measurement

Reading whether the PineTime has power attached is easy: simply read the charge indication pin (P0.12). When it is high it is running on battery, when it is low it is charging.

Reading the battery voltage is a bit harder. For that you can use the battery voltage pin on P0.31 (AIN7). The returned value is 12 bits, which means it is 0..4095. You can get the measured voltage with the following formula, assuming a reference voltage of 3.3V (this is configurable in the ADC):

adcVoltage = adcValue / (4095 / 3.3)

The measured voltage is actually half of the actual battery voltage, because the ADC is connected between a voltage divider where both resistors are 1MΩ. This can be corrected by multiplying the value:

batteryVoltage = adcValue * 2 / (4095 / 3.3)

It's often better to avoid floating point values on embedded systems and in this case there is no reason to use float at all, we can just represent the value in millivolts. Therefore the formula can be simplified to:

batteryVoltage = adcValue * 2000 / (4095 / 3.3)
batteryVoltage = adcValue * 2000 / 1241

Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.

Button

The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.

While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.

Note that the button consumes around 34µA when P0.15 is left high. To reduce current consumption, set it to low most of the time and only set it to high shortly before reading it. The button needs a short time to give good outputs though, setting P0.15 high at least four times in a row seems to result in enough delay that P0.13 has a stable output.

Touch panel

The touch panel is controlled by a Hynitron CST816S chips. Unfortunately, there is not much information about this chip on the internet apart from the datasheet below and a reference driver. This is enough to implement a basic driver, but crucial information needed to implement advanced functionalities are missing (I²C protocol and registers, timings, power modes,...).

Pins

  • P0.10 : Reset
  • P0.28 : Interrupt (signal to the CPU when a touch event is detected)
  • P0.06 : I²C SDA
  • P0.07 : I²C SCL

I²C

  • Device address : 0x15
  • Frequency : from 10Khz to 400Khz

NOTE: The controller goes to sleep when no event is detected. In sleep mode, the controller does not communicate on the I²C bus (it appears disconnected). So, for the communication to work, you need to tap on the screen so that the chip wakes-up.

NOTE: The I²C bus, also known as TWI bus, has known issues, make sure to write your TWI driver with timeouts.

Touch events

Touch information is available from the 63 first registers of the controller. Remember: the device is in sleep mode when no touch event is detected. It means that you can read the register only when the touch controller detected an event. You can use the Interrupt pin to detect such event in the software.

These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) :

Byte Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
0 ?
1 GestureID : (Gesture code ,

0x00: no gesture,

0x01: Slide down,

0x02: Slide up,

0x03: Slide left,

0x04: Slide right,

0x05: Single click,

0x0B: Double click,

0x0C: Long press)

2 ? Number of touch points
3 Event (0 = Down, 1 = Up, 2 = Contact) ? X (MSB) coordinate
4 X (LSB) coordinate
5 ? Touch ID Y (MSB) coordinate
6 Y (LSB) coordinate
7 Pressure (?)
8 Miscellaneous (?)

Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).

NOTES

  • The touch controller seems to report only 1 touch point
  • Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.

Registers

The reference driver specifies some registers and value, but there is no information about them:

Register Address Description
HYN_REG_INT_CNT 0x8F
HYN_REG_FLOW_WORK_CNT 0x91
HYN_REG_WORKMODE 0x00 0 = WORK, 0x40 = FACTORY
HYN_REG_CHIP_ID 0xA3
HYN_REG_CHIP_ID2 0x9F
HYN_REG_POWER_MODE 0xA5 0x03 = SLEEP (reset the touchpanel using the reset pin before using this register : pin_low, delay 5ms, pin_high, delay 50ms then write 3 to register 0xA5)
HYN_REG_FW_VER 0xA6
HYN_REG_VENDOR_ID 0xA8
HYN_REG_LCD_BUSY_NUM 0xAB
HYN_REG_FACE_DEC_MODE_EN 0xB0
HYN_REG_GLOVE_MODE_EN 0xC0
HYN_REG_COVER_MODE_EN 0xC1
HYN_REG_CHARGER_MODE_EN 0x8B
HYN_REG_GESTURE_EN 0xD0
HYN_REG_GESTURE_OUTPUT_ADDRESS 0xD3
HYN_REG_ESD_SATURATE 0xED 0xED

WARNING : Writing the SLEEP command (write 0x05 in HYN_REG_POWER_MODE) seems to freeze the controller (it returns only static values) until the battery is totally drained and the whole system reset. Analysis and debugging is more than welcome!

Accelerometer

The on board accelerometer in devices shipped before July 2021 is a Bosch BMA421, connected to the I2C bus. Devices shipped after July 2021 use a Bosch BMA425 accelerometer.

Pins

  • P0.06 : I²C SDA
  • P0.07 : I²C SCL
  • P0.08 : Interrupt

I2C Device address : 0x18

Reducing power consumption

The PineTime appears to be able to sleep with a current consumption of only 66µA.

To investigate current consumption, it's a good idea to disable everything possible to get the lowest current consumption possible, and then re-enable things one by one. Here is one way to get a baseline current consumption of 60µA, as measured from the 3.3V pin with the battery disconnected:

  • Enable the DC/DC regulator. This doesn't affect the current consumption while sleeping, but almost halves the runtime current consumption.
  • Use the low-frequency (32.768kHz) oscillator.
  • Leave all pins in their default state, except for P0.05 (SPI CS) and P0.25 (LCD CS) which should be configured as an output and set to high.
  • Put the heart rate sensor in sleep mode by setting the PDRIVER (0x0C) register to 0, see the HRS3300 datasheet for details.
  • Put the SPI flash in deep power-down mode by setting flash CS high, then low, then writing the byte 0xb9 on the SPI bus, and then setting flash CS high again.
  • Sleep in a loop, using WFE or WFI (if you're using the Nordic SoftDevice, call sd_app_evt_wait instead).

Here are some current consumption statistics (current consumed in addition to the baseline power), roughly ordered from large to small:

Source Current Notes
SWD 3.05mA Power cycle the chip after programming to avoid this, it can hide other inefficiencies.
LCD 5.61mA Set the LCD to sleep mode when not used, using SLPIN.
Backlight high 12.27mA
Backlight mid 5.51mA
Backlight low 1.83mA
ADC left enabled 1.3mA Stopping SAADC brings the current back to the baseline. It seems that it doesn't need to be disabled entirely.
UART left enabled 1.25mA Some bootloaders might leave the UART enabled after they start the application, leading to high current consumption.
Edge triggered pin interrupts 0-0.47mA? It appears that under some configurations, edge triggered interrupts result in a large power drain. One way to avoid this is by using the pin sense mechanism.
Accelerometer 0.15mA 151µA in performance mode, 99µA with performance mode disabled but power saving disabled, 50µA while polling on a high interval (100Hz, average 4 samples), 14µA when running at the lowest possible setting that still counts steps (50Hz, no averaging).
HRS sensor is enabled 0.1mA The HRS3300 sensor is enabled on power on. Write byte 0x00 to the PDRIVER register (0x0C) to set it in sleep mode.
BUTTON_OUT left high 0.04mA See Button for how to avoid this.
SPI flash sleep mode 0.014mA Sleep mode still consumes power. Put it in deep power down mode to avoid this.
SPI, I2C (negligible) SPI and I2C appear to consume very little power when idle, around 1µA or less.

Accessory

The following accessory is compatible with the PineTime.

Watch band

The PineTime uses a standard 20mm watch band / strap. There is a thread in the forum discussing this.

Due to the watches design. Retention for the spring bars are recessed into the watch. Not all 20mm bands / straps work. This is especially the case for Nato style bands / straps being too thick.


Known working bands:

Cases

There are no cases for PineTime yet, but some cases for Fitbit are suitable for it. Cases for Fitbit have one microphone hole, which is unnecessary for the PineTime, but otherwise they fit perfectly.

The community designed the following cases:

Datasheets, Schematics and Certifications

Schematics

Note: The part number for the SPI FLASH in the schematic diagram is not correct, the PineTime features a larger external FLASH device, see below.

Chip Datasheets

NORDIC nRF52832 information:

ARMv7-M information:

Component Datasheets

PMU (Power Management Unit) information:

SPI Flash information:

LCD Panel:

Touchpad information:

Sensor:

Certificates

Manuals