The Idea Club
The best ideas are shared ideas.

GearSense


by Paul O'Rorke published 2026/05/04 22:23:35 GMT+0, last modified 2026-05-04T22:23:35+00:00
GearSense — the drivetrain-aware eBike controller

theIdea.club / Open Hardware & Software / GearSense

GearSense — the drivetrain-aware eBike controller

Every other eBike controller treats the drivetrain as invisible. GearSense treats it as the primary input signal.

"The gear ratio is the missing context that current controllers ignore entirely. GearSense is the first controller that actually listens to how the rider is riding."


The problem — you shouldn't have to juggle two control systems

Standard eBike PAS controllers count pedal strokes and scale motor output by a fixed percentage. That's it. They have no awareness of what gear you've selected, what speed you're doing, or what load you're carrying. The result is a constant, frustrating disconnect — you manage gearing manually while simultaneously managing motor assist. Two control loops. One human brain.

Cyclists already know how to communicate intent to a drivetrain. They use gears. GearSense finally listens.

Current PAS logic Gear awareness Rider experience GearSense approach
Count strokes, scale power None — zero Two separate control loops Gear ratio = primary signal

The insight — the gear ratio is always measurable. Nobody was using it.

Crank RPM ÷ Wheel RPM = a discrete ratio that maps 1:1 to a specific gear. On a 7-speed bike there are exactly 7 stable ratio values. On a 3×7 drivetrain there are up to 21. These ratios are discoverable without any gear position sensor — simply by observing two RPM signals over a single learning ride.

GearSense uses this ratio as its primary control input, enabling motor assist that responds to rider intent — gear selection and cadence — rather than raw pedal pulse count.


Learning mode — teach it your bike in one ride

On first use, the rider enters Learning Mode and rides normally for one session, using all available gears. GearSense logs crank Hz and wheel Hz, computes instantaneous ratios, and clusters the results to discover N distinct gears automatically. No manual configuration. No knowledge of the bike required. No additional sensors.

The same algorithm handles a 3-speed hub gear, a 21-speed derailleur, and everything in between.


Sensor philosophy — bring your own sensors. GearSense listens and learns.

"If cadence is already being measured somewhere on the bike, GearSense listens. If it isn't, GearSense adds the minimum hardware necessary to measure it. You are never asked to duplicate sensing you already have."

GearSense resolves its data sources at initialisation, walking a priority chain for both cadence and wheel speed independently:

Provider type Source How it works
Broadcast provider BLE / ANT+ cycling sensor Rider already owns a cadence sensor for their cycling computer. GearSense subscribes to the same broadcast. Zero additional hardware.
API provider Controller data bus ODrive, VESC, or any smart controller that exposes RPM over UART or CAN. GearSense queries it directly.
GPIO provider PAS ring / spoke magnet + hall sensor Classic retrofit hardware. Standard hall-effect sensors already present on most eBikes.

The gear ratio logic above the providers never changes. Swap the source, keep the intelligence. Same interface, different source.


Ride modes

Once the gear map is established, mode profiles give the rider meaningful control over how the motor fills the gap between human effort and desired speed:

Mode Behaviour
Cargo Low cadence target, high torque emphasis. Prioritises stability and load-carrying.
Cruise Moderate cadence target, smooth assist scaling. Comfortable everyday riding.
Sport Higher cadence allowed before motor supplements. Responsive, performance-oriented. Anticipates gear-up events.

Development plan — three phases, zero risk to the test bike

The prototype testbed is a BAFANG-powered 7-speed cargo eBike in active family use. The constraint is absolute: it must remain rideable throughout development.

Phase Name Description
1 Passive observer ESP32 taps the existing PAS signal and adds a spoke magnet + hall sensor for wheel speed. Read-only logging only — no motor control intervention whatsoever. Validates the gear-ratio clustering algorithm on real ride data. Hardware cost under $20. Zero change to bike behaviour.
2 Shadow mode ESP32 reads the existing throttle/PAS signal passively and computes what GearSense would have commanded versus the stock controller. Logs the delta. Surfaces edge cases before any intervention. Still zero change to bike behaviour.
3 Interpose ESP32 intercepts the control signal. A bypass switch restores stock behaviour instantly — under one second. GearSense now drives motor assist. Full algorithm active.

Hardware stack — genuinely vanilla

The sophistication is in the thinking, not the components. Everything below the firmware layer is commodity hardware available from any electronics supplier.

  • Compute: ESP32 — reads sensors, runs algorithm, manages BLE, sends setpoints
  • Cadence: Existing PAS ring (hall-effect, typically 12-pole) — read via GPIO interrupt
  • Wheel speed: KY-003 hall sensor module + spoke magnet (or controller API where available)
  • Motor driver (prototype): ODrive — FOC, accepts velocity/torque setpoints via UART/CAN
  • Motor driver (production target): VESC or purpose-built FOC controller via ODM
  • User interface: BLE to phone for learning mode; simple serial terminal initially
  • Firmware language: C++ (Arduino/ESP-IDF)

Market position — a gap that isn't being served

"Sophisticated torque-sensing systems exist — Bosch, Shimano STEPS, Fazua — but they are proprietary, mid-drive only, and priced at $500+. They will not sell you just the controller. GearSense occupies the gap: smart, adaptive, gear-aware assist for any bike, retrofittable, open-source."

Current eBike PAS controllers are universally dumb by design. The commercial manufacturers who do offer sophisticated systems bake them into proprietary platforms you cannot retrofit, modify, or build upon. The open-source and conversion market is wide open and currently served by exactly the kind of fixed-percentage PAS controllers GearSense replaces.


Status & how to contribute

Status: Active development — Phase 1 prototype underway.
License: TIC-OHSL (The Idea Club Open Hardware & Software License)
Project home: theIdea.club/GearSense
Maintainer: Paul O'Rorke

All firmware, schematics, and documentation will be published openly as they are developed. Contributions, forks, and improvements are welcomed and encouraged. If you ride an eBike and have ever been frustrated by the disconnect between your gears and your motor, this project is for you.

Simple hardware. A different way of thinking. That's all this is.