Skip to content

DEV-1067: decode an open circuit on SR68 GSR range 3 as open - #205

Merged
JongChern merged 1 commit into
masterfrom
DEV-1067_gsr_range3_open_circuit_limit
Oct 1, 2026
Merged

JongChern merged 1 commit into
masterfrom
DEV-1067_gsr_range3_open_circuit_limit

Conversation

@marknolan

@marknolan marknolan commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

DEV-1067

Explainer: before/after charts for DEV-1067, DEV-1068 and DEV-1070, and a table of the sibling PRs across every host API: https://claude.ai/artifact/6hDc2Ue9hdF8gcUDZXzFts (Shimmer sign-in)

Problem

SensorGSR.GSR_UNCAL_LIMIT_RANGE3_SR68 raises every range-3 code below it to it before calibration, so that an open circuit reads as open. It was 1134, which is below the 0.4986 V that CalibrateGsrDataToKOhmsUsingAmplifierEq divides by for the SR68 (code 1134.3 at the 1.8 V full scale). So 1134, and every code clamped up to it, decodes to a negative resistance:

  • auto-range: NudgeGSRResistance floors it at 8 kOhm, so an open circuit reads 125 µS, and the LIMIT_FOR_MINIMUM_VALID_GSR_CONDUCTANCE_US check reports it as Connected
  • fixed range 3: pinned to 680 kOhm, the bottom of the range

An SR68-9 with its electrodes open (DEV-793 dataset B6) reads range-3 codes peaking at 1126–1136, so most of such a recording hits this.

Fix

The limit is now 1138, the first code above 0.5 V, so it clears 0.4986 V as well. The Java driver divides by 0.5 V for the same front end, and one value is right under both. It is the same value as the Java driver and web SDK PRs below.

Tests

ShimmerBLETests/Sensors/SensorGSROpenCircuitTest decodes codes 1134–1138 on range 3:

  • in auto-range, also asserting Disconnected
  • on fixed range 3
  • plus a check that pins the limit to the first code above 0.5 V
Limit Result
1134 3/3 fail (8.0 / 680.0 kOhm)
1138 3/3 pass; all of ShimmerBLETests passes (121)

How it was built: the dotnet CLI cannot build ShimmerBLEAPI here — PropertyChanged.Fody 2.6.0 crashes, and Realm's weaver needs SolutionDir. So the tests were built with Visual Studio 2022's MSBuild with -p:SolutionDir=...\ShimmerBLE\, and the DLL was run with DOTNET_ROLL_FORWARD=Major, since no 5.0 runtime is installed.

Not changed here

An SR61-5/6 reports HardwareIdentifier.VERISENSE_IMU, so it gets neither the gen-2 resistors nor this clamp: GSR reads ~1.9× high, and an open circuit still reads 125 µS. That is the gap DEV-874 closed in the web SDK and DEV-793 closed in the Java driver. It needs its own change.

Sibling PRs (same constant, same ticket)

🤖 Generated with Claude Code

GSR_UNCAL_LIMIT_RANGE3_SR68 raises range-3 codes below it to it before
calibration so that an open circuit reads as open. It was 1134. That is
below the 0.4986 V this API divides by for the SR68, which is code 1134.3
at the 1.8 V full scale. So 1134, and every code clamped up to it,
decoded to a negative resistance. In auto-range NudgeGSRResistance
floored that at 8 kOhm, so an open circuit read 125 uS, and the
LIMIT_FOR_MINIMUM_VALID_GSR_CONDUCTANCE_US check reported it as
Connected. On fixed range 3 it was pinned to 680 kOhm.

An SR68-9 with its electrodes open (DEV-793 dataset B6) reads range-3
codes peaking at 1126-1136, so most of such a recording hits this.

The limit is now 1138, the first code above 0.5 V, which clears 0.4986 V
as well. The Java driver divides by 0.5 V for the same front end, so one
value is right under both. The Java driver and the web SDK get the same
change under DEV-1067.

SensorGSROpenCircuitTest decodes codes 1134-1138 on range 3 in auto-range
(also asserting Disconnected) and on fixed range 3, and pins the limit to
the first code above 0.5 V. At 1134 all three fail (8.0 and 680.0 kOhm).
At 1138 all three pass, as does the rest of ShimmerBLETests (121).

Built with Visual Studio's MSBuild. Under the dotnet CLI,
PropertyChanged.Fody 2.6.0 crashes in ShimmerBLEAPI, and Realm's weaver
needs SolutionDir.

Not changed here: an SR61-5/6 reports HardwareIdentifier VERISENSE_IMU,
so it gets neither the gen-2 resistors nor this clamp. That is the gap
that DEV-874 closed in the web SDK and DEV-793 closed in the Java driver.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@JongChern JongChern left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. This is the same one-constant change as Java #305. Only SR68 range-3 codes below 1138 change, and those can only come from open electrodes, so no reading taken with skin contact moves. CI ran both C# suites and passed.

Two small things:

  • The doc comments on GSR_UNCAL_LIMIT_RANGE3_SR68 and on TestLimitIsTheFirstCodeAboveHalfAVolt say the Java driver divides by 0.5 V. That stopped being true when Shimmer-Java-Android-API#312 merged: Java now uses the 0.4986 V divider value too. 1138 is still right; only the wording is out of date.
  • Merge order: this one first. #206 targets this branch, so after merging, change #206's base to master by hand and push or close/reopen it, so CI runs on it before it merges.

@JongChern
JongChern merged commit 3af2b5b into master Oct 1, 2026
2 checks passed
@JongChern
JongChern deleted the DEV-1067_gsr_range3_open_circuit_limit branch October 1, 2026 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants