Skip to content

Jelly battery: report charging from 27.1 V, not 27.6 V - #322

Open
shawnpatel wants to merge 1 commit into
mainfrom
fix-battery-charging
Open

shawnpatel wants to merge 1 commit into
mainfrom
fix-battery-charging

Conversation

@shawnpatel

@shawnpatel shawnpatel commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Problem

The control panel showed Jelly at a resting 100 % while it was on the charger. The lift board read 27.5 V, below the old CHARGING_VOLTS = 27.6, and every voltage above the resting curve's 26.66 V top clamps to 100 %. The charger only reaches its 29.2 V absorption voltage at the very end of a charge, so the old threshold missed almost all of it.

Measurements (Jelly, lift board ADC)

State Rail
On the charger, nearly full 27.48–27.53 V
Full, unplugged 27.00–27.01 V

ADC noise between samples is ~10 mV.

Change

  • CHARGING_VOLTS 27.6 → 27.1 V, with new CHARGING_CLEAR_VOLTS = 27.05 V: BatteryEstimator tracks charging with hysteresis so it doesn't flicker near the threshold, and still treats the charger connecting/leaving as a step instead of averaging across it.
  • Docs (robot.battery docstring, docs/api/robot.mdx) updated with the measured values and the limitation.

Known limitation

Early in a charge, a low pack can sit under 27.1 V and show a resting (too high) percentage — voltage alone can't separate that from a full pack at rest. Detecting the step when the charger is plugged/unplugged would close that gap, but needs a recording of that step on the real board first. The full-pack margin (27.0 vs 27.1 V) comes from one reading; if a full pack is seen reading above 27.1 V at rest, raise the threshold.

Testing

  • uv run pytest tests/test_battery.py tests/test_jelly_link.py — 62 passed (new: bulk-charge voltage reads charging, measured full-rest 27.0 V does not, hysteresis, reset clears charging).
  • Checked estimate_battery against the live readings: 27.01 V → not charging, 27.5 V → charging.
  • ruff check / format clean.

🤖 Generated with Claude Code


Note

Low Risk
Changes only Jelly battery telemetry thresholds and smoothing; a full pack reading above 27.1 V at rest could still false-trigger charging, which is documented and narrow.

Overview
Fixes the control panel showing 100 % at rest while Jelly was on the charger: bulk charge often sits around 27.5 V, below the old 27.6 V threshold, so charging stayed false even though percent clamped to 100 %.

CHARGING_VOLTS drops 27.6 → 27.1 V (Jelly-measured gap between ~27.0 V full/unplugged and ~27.5 V on the charger). Adds CHARGING_CLEAR_VOLTS = 27.05 V so BatteryEstimator keeps charging latched until the rail falls below the clear level, avoiding flicker near the threshold. Charger plug/unplug is still treated as a voltage step (not smoothed). Smoothed BatteryStatus now uses the estimator’s hysteresis flag instead of re-deriving charging from raw threshold on each sample.

Docs (battery module docstring and docs/api/robot.mdx) note the new thresholds, that percent is meaningless while charging, and that early bulk charge can still read as resting if the rail stays under 27.1 V. Tests cover bulk-charge detection, full resting pack, hysteresis, and reset behavior.

Reviewed by Cursor Bugbot for commit 7810101. Configure here.

The panel showed a resting 100 % while Jelly was on the charger: the lift
board read 27.5 V, under the old 27.6 V threshold, and everything above the
curve's 26.66 V top clamps to 100 %. The charger's 29.2 V absorption voltage
only arrives at the very end of a charge.

Measured on Jelly with this board: 27.5 V on the charger (nearly full),
27.0 V for the same pack full and unplugged. Charging now sets at 27.1 V and,
with hysteresis in BatteryEstimator, clears below 27.05 V so it does not
flicker. A low pack early in a charge can still sit under the threshold;
voltage alone cannot tell that apart from a full pack at rest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
axol Ready Ready Preview Sep 23, 2026 8:51pm UTC

Request Review

This branch was successfully deployed

1 active deployment
Preview — 78101013 Deployed Sep 23, 2026 by vercel[bot]
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.

1 participant