[code] [blog] [Repos] [GPS Tracker] [Music] [VNC] [Restart VNC] [E-Mail me]
git clone https://coredump.ws/repos/gh3011-vitals.git
# push (client certificate):
git remote set-url --push origin https://coredump.ws:8443/repos/gh3011-vitals.git

Branches and tags

mainbranch22 days agozip

Files at HEAD (57fa6750cd) · download zip

docs/
tools/
LICENSE34.3 KB
README.md3.9 KB

Recent commits · all

57fa6750Stop halving the rate while the arm is workingno-body-in-particular22 days ago
14efe423License under GPL-3.0-or-laterno-body-in-particular28 days ago
3e6d4ff2The pairing does not reproduce either, and that was the part that matteredno-body-in-particular2026-09-06
57ddee28Try the one thing that could have reopened saturation, and find it is not thereno-body-in-particular2026-09-06
1d59f191Stop the LED ramping when nothing is coming backno-body-in-particular2026-09-06
eb8ce02bRecord what a gain code is worth, and the night that measured itno-body-in-particular2026-09-04
ba55ecadRefuse a pressure when there was no pulse to measure it onno-body-in-particular2026-09-04
c7bb8b1aDrop the variables the new gain loop no longer carriesno-body-in-particular2026-09-03
9c055512Solve for the gain, one channel at a time, and measure the second derivativeno-body-in-particular2026-09-03
cd0df2bcSearch for the foot over a fixed time, not a fraction of a beatno-body-in-particular2026-09-03

README.md

gh3011-vitals

Heart rate, blood pressure and a saturation ratio from the Goodix GH3011 PPG sensor in a pt880 kids' watch, without the vendor's daemon.

The watch ships with gh3011_service, a closed daemon that drives the sensor and reports through its own protocol. This replaces it: vitalsd sits in the same init slot, drives the chip directly over /dev/gh_tools, and answers a socket. The launcher speaks to that socket and needs nothing else from here.

What works, and how well

state
heart ratemeasured against a cuff at about +1 bpm, three of four measurements inside two
blood pressuretracks poorly - the estimate sits near 114 whether the wearer is at 105 or 120
saturationa ratio, not a percentage. 0.70 with seven percent of spread when there is a pulse to measure
wear detectionthe sensor's own detector, about a second, five runs each way with no overlap

No saturation percentage is published, deliberately. The ratio is real; turning it into a number out of ten requires a calibration this has no reference for, and a one-point anchor once printed 86% for a healthy wearer at rest - alarming, and with no measurement behind it. docs/gh3011.md says what each number is worth.

The interface

One line each way over an abstract unix socket named watchvitals, which is what android.net.LocalSocket speaks by default, so the app side needs no filesystem permissions.

-> hr green LED, heart rate only -> spo2 red and infrared, adds the ratio and the pulse shape -> wear the thermometer alone: no LEDs, no measurement

<- hr=49 spread=2 hz=99.7 ... r=0.706 sbp=113 dbp=69 conf=0.82 <- hr=0 reason=... when nothing trustworthy came out

A refusal is a normal answer and says why. weak=1 on a ratio means there was too little pulse behind it to divide by; tracked=1 on a rate means the windows disagreed and the previous rate chose between them.

Every measurement is appended to /sdcard/vitals.log with its full field set.

Layout

tools/gh3011/vitalsd.c the daemon: socket, wear check, two-pass measurement tools/gh3011/ppgd.c the measurement itself, and everything that reads a waveform tools/gh3011/adtwear.c the chip's own wear detector tools/gh3011/ratio-lab.py tries different ratio formulations against a captured pass, offline tools/gh3011/seq.h the start sequence, generated from a capture of the vendor daemon tools/gh3011/adt_table.h the auto-detect configuration, read out of the vendor binary docs/gh3011.md the chip: registers, commands, and how a reading is taken

Building

An Android NDK arm32 toolchain, and nothing else:

armv7a-linux-androideabi19-clang -Os -Wall -o ppgd ppgd.c -lm armv7a-linux-androideabi19-clang -Os -Wall -o vitalsd vitalsd.c armv7a-linux-androideabi19-clang -Os -Wall -o adtwear adtwear.c

tools/gh3011/install-vitalsd.sh puts them on the watch and takes over the init slot. It keeps the vendor daemon at gh3011_service.real so the swap is one cat in either direction.

The captures

docs/data/ holds the saturation measurements and nothing else: five breath-hold runs against a finger meter, the vendor daemon's own output through a desaturation, a capture of their configured stream, and under hold-raw/ eight passes of paired raw samples spanning a hold from 99 to 91.

They are kept because they are what any future attempt at a saturation has to beat, and because producing them cost a wearer a lot of breath-holding. tools/gh3011/ratio-lab.py reads them.

What is not here

The probes, register sweeps, vendor-binary harnesses and captures this was worked out with are not in this repository. docs/gh3011.md is the result of them and is the part worth keeping; the rest was scaffolding, and some of it recorded measurements of a person.

License

GPL-3.0-or-later, see LICENSE.