colmi_r02_client

Open source python client to read your data from the Colmi R02 family of Smart Rings. 100% open source, 100% offline.

What is the Colmi R02?

picture of the colmi r02 smart ring in shiny black. The electronics can be seen through the epoxy inside the ring

It's a cheap (as in $20) "smart ring" / fitness wearable that includes the following sensors:

  • Accelerometer
    • step tracking
    • sleep tracking
    • gestures (maybe...?)
  • Heart Rate (HR)
  • Blood Oxygen (SPO2)

I found out about the ring from atc1441 and his work on ATC_RF03 and the Hackaday coverage

Got questions or ideas? Send me an email or open an issue

Are you hiring? Send me an email

How to buy

You can get it on here on AliExpress. If that link is dead try searching for "COLMI R02", I got mine from "Colmi official store". It cost me $CAD 22 shipped.

Reverse engineering status

  • Real time heart rate and SPO2
  • Step logs (still don't quite understand how the day is split up)
  • Heart rate logs (aka periodic measurement)
  • Set ring time
  • Set HR log frequency
  • SPO2 logs
  • Sleep tracking
  • "Stress" measurement

Planned Feature

  • add more CLI functionlity
  • pretty print HR and steps
  • sync all data to a file or sqlite db
  • simple web interface

Getting started

Using the command line

If you don't know python that well, I highly recommend you install pipx. It's puprpose built for managing python packages intended to be used as standalone programs and it will keep your computer safe from the pitfalls of python packaging. Once installed you can do

pipx install git+https://github.com/tahnok/colmi_r02_client

Once that is done you can look for nearby rings using

colmi_r02_util scan
Found device(s)
                Name  | Address
--------------------------------------------
            R02_341C  |  70:CB:0D:D0:34:1C

Once you have your address you can use it to do things like get real time heart rate

colmi_r02_client --address=70:CB:0D:D0:34:1C get-real-time-heart-rate
Starting reading, please wait.
[81, 81, 79, 79, 79, 79]

The most up to date and comprehensive help for the command line can be found running

colmi_r02_client --help
Usage: colmi_r02_client [OPTIONS] COMMAND [ARGS]...

Options:
  --debug / --no-debug
  --record / --no-record  Write all received packets to a file
  --address TEXT          Bluetooth address
  --name TEXT             Bluetooth name of the device, slower but will work
                          on macOS
  --help                  Show this message and exit.

Commands:
  get-heart-rate-log           Get heart rate for given date
  get-heart-rate-log-settings  Get heart rate log settings
  get-real-time-heart-rate     Get real time heart rate.
  info                         Get device info and battery level
  set-heart-rate-log-settings  Get heart rate log settings
  set-time                     Set the time on the ring, required if you...

With the library / sdk

You can use the colmi_r02_client.client class as a library to do your own stuff in python. I've tried to write a lot of docstrings, which are visible on the docs site

Communication Protocol Details

I've kept a lab notebook style stream of consciousness notes on https://notes.tahnok.ca/, starting with 2024-07-07 Smart Ring Hacking and eventually getting put under one folder. That's the best source for all the raw stuff.

At a high level though, you can talk to and read from the ring using BLE. There's no binding or security keys required to get started. (that's kind of bad, but the range on the ring is really tiny and I'm not too worried about someone getting my steps or heart rate information. Up to you).

The ring has a ble GATT service with the UUID 6E40FFF0-B5A3-F393-E0A9-E50E24DCCA9E. It has two important characteristics:

  1. RX: 6E400002-B5A3-F393-E0A9-E50E24DCCA9E, which you write to
  2. TX: 6E400003-B5A3-F393-E0A9-E50E24DCCA9E, which you can "subscribe" to and is where the ring responds to packets you have sent.

This closely ressembles the Nordic UART Service and UART/Serial communications in general.

Packet structure

The ring communicates in 16 byte packets for both sending and receiving. The first byte of the packet is always a command/tag/type. For example, the packet you send to ask for the battery level starts with 0x03 and the response packet also starts with 0x03.

The last byte of the packet is always a checksum/crc. This value is calculated by summing up the other 15 bytes in the packet and taking the result modulo 255. See colmi_r02_client.packet.checksum

The middle 14 bytes are the "subdata" or payload data. Some requests (like colmi_r02_client.set_time.set_time_packet) include additional data. Almost all responses use the subdata to return the data you asked for.

Some requests result in multiple responses that you have to consider together to get the data. colmi_r02_client.steps.SportDetailParser is an example of this behaviour.

If you want to know the actual packet structure for a given feature's request or response, take a look at the source code for that feature. I've tried to make it pretty easy to follow even if you don't know python very well. There are also some tests that you can refer to for validated request/response pairs and human readable interpretations of that data.

Got questions or ideas? Send me an email or open an issue

1"""
2.. include:: ../README.md
3    :start-line: 2
4"""