Skip to content

Instantly share code, notes, and snippets.

@eonist
Created March 13, 2026 06:33
Show Gist options
  • Select an option

  • Save eonist/1587363408a1de9413c5321b2b797c5e to your computer and use it in GitHub Desktop.

Select an option

Save eonist/1587363408a1de9413c5321b2b797c5e to your computer and use it in GitHub Desktop.
ai assist with torque sensor

There's a lot of potential here, especially since you're already building custom firmware/controller logic and have deep experience with local AI. The torque sensor gives you a real-time force signal at ~100–200 Hz — that's a rich data stream most e-bike brands barely use beyond simple proportional assist. adventuro

Adaptive Rider Profile (on-device ML)

Run a lightweight model (TinyML / TFLite on the controller MCU, or on a companion ESP32) that learns your pedaling signature over time: tamobykesport

  • Builds a personal torque-cadence-speed profile across different terrains and conditions.
  • Automatically adjusts the assist curve without you touching PAS levels — it just knows you want more on climbs and less on flats.
  • Could run entirely offline, fits Omera's local-first philosophy. adventuro

Predictive Terrain Assist

Fuse torque sensor data with GPS + altimeter to anticipate what's coming: tamobykesport

  • Pre-load motor torque 1–2 seconds before a hill hits, so assist feels seamless.
  • Learn your commute routes and pre-cache optimal power curves per segment.
  • Optimize battery spend: "You have 14 km left, 2 hills — here's the power budget."

Rider Fatigue Detection

This is the novel one. The torque signal contains subtle patterns that shift as you fatigue: hezzobike

  • Pedal stroke asymmetry — left vs. right leg force imbalance increases when tired.
  • Torque variability — consistent riders get jerky when fatigued.
  • Cadence drift — natural RPM drops without the rider noticing.
  • An on-device model could detect fatigue onset and silently increase assist to keep you safe, or nudge you to take a break.

Riding Analytics / Training Mode

Log torque + cadence + speed at high resolution and pipe it to a companion app: smartybikes

  • Power output estimation (torque × cadence = watts) without needing a power meter.
  • Stroke-by-stroke analysis like what cyclists pay €500+ for with Garmin/SRM.
  • "Ghost mode" — ride against your own previous best on a route.

Anti-Theft / Rider Authentication

The torque signal is surprisingly biometric: hezzobike

  • Everyone has a unique pedal stroke signature (force curve shape, L/R balance, cadence preference).
  • Train a small classifier on your stroke pattern.
  • If someone else pedals the bike → motor doesn't engage. No keys, no app, just pedal and it recognizes you.

What's Realistic for Omera v1

Feature Complexity Hardware needed
Adaptive assist curve Medium Torque + cadence + existing controller
Predictive terrain Medium-high + GPS module (ESP32 + u-blox)
Fatigue detection Medium Torque signal only, needs ML model
Power analytics Low Just logging + app
Rider authentication Low-medium Torque signal + small NN on MCU

The power analytics + adaptive assist combo is probably the best bang-for-buck for v1 — useful immediately, differentiating vs. every other e-bike, and you can ship it with just the torque sensor you already have plus a small local model running on the controller. The rider-auth feature is a fun flex that fits Omera's anti-theft story too. tamobykesport

Want me to spec out the data pipeline for any of these (sensor → MCU → model → motor control)?

@eonist
Copy link
Author

eonist commented Mar 14, 2026

For your Omera e-bike controller running TinyML workloads (adaptive assist, fatigue detection, rider auth) alongside real-time motor control and BLE to the iPhone, the ESP32-S3 is the strongest all-around pick. Here's how it stacks up against the other realistic candidates.

The S3's headline feature is its vector processing extensions (PIE) on dual Xtensa LX7 cores at 240 MHz, which accelerate quantized neural network operations by roughly 40× compared to unaccelerated inference. Key specs:dronebotworkshop+1

  • 512 KB SRAM + optional 2–8 MB PSRAM

  • Built-in Wi-Fi 4 + BLE 5.0 (no separate radio chip needed for iPhone comms)

  • Rich ADC/SPI/UART for torque sensor input and motor PWM output

  • Proven TFLite Micro support: ~50–60 ms inference, ~240 KB model size, ~350 KB RAM usage for a quantized CNN[dev]

  • Costs ~€3–5 per chip, massive community and tooling

This comfortably handles your small classifier models (rider auth, fatigue detection) at 100–200 Hz sensor rates while leaving headroom for motor control on the second core.[zediot][ppl-ai-file-upload.s3.amazonaws]

Nordic nRF5340 — Best for Ultra-Low Power + BLE Quality

If you prioritize best-in-class BLE and ultra-low power consumption over raw ML throughput, the nRF5340 is worth considering:[jonpeddie]

  • Dual Arm Cortex-M33 (128 MHz app core + 64 MHz network core)

  • Excellent BLE 5.0 with Thread/Zigbee multi-protocol

  • Edge Impulse partnership for rapid TinyML deployment — gesture models run in 1.7 ms using ~4 KB[hackster][youtube]

  • Lower ML ceiling than the S3, but sufficient for small sensor classifiers

The trade-off is less community momentum for motor-control applications and a more constrained toolchain compared to ESP-IDF.[edgeimpulse]

ESP32-P4 — Future Upgrade Path

The P4 is Espressif's 2026 powerhouse: dual RISC-V at 400 MHz, 32 MB PSRAM, AI instruction extensions, and hardware H.264 encoding. However:linkedin+1

  • It requires a separate ESP32-C6 co-processor for Wi-Fi/BLE — adds board complexity

  • Designed for vision/multimedia, which is overkill for torque sensor ML

  • ESP-IDF support is mature but Arduino support is still limited[dronebotworkshop]

This makes sense if Omera v2 adds a camera (e.g., dash-cam or gesture control), but it's overengineered for v1.

STM32N6 — Overkill

The STM32N6 packs a dedicated Neural-ART NPU delivering 600 GOPS at 800 MHz Cortex-M55. It's designed for on-chip computer vision and audio — far beyond what torque-sensor classifiers need, and significantly more expensive.[embedded]

Recommendation for Omera v1

Factor | ESP32-S3 | nRF5340 | ESP32-P4 -- | -- | -- | -- ML inference speed | ~50–60 ms [dev]​ | ~1.7 ms (tiny models) [youtube]​ | Faster (400 MHz) [linkedin]​ BLE quality | Good (BLE 5.0) | Excellent (BLE 5.0) | Via co-processor [dronebotworkshop]​ Motor control I/O | Excellent | Moderate | Excellent Power consumption | Moderate | Very low | Higher Cost per chip | ~€3–5 | ~€5–8 | ~€8–12 TinyML ecosystem | TFLite Micro, mature [dev]​ | Edge Impulse, growing [hackster]​ | TFLite Micro, newer Board complexity | Single chip | Single chip | Needs C6 co-processor

Go with the ESP32-S3 (N8R2 or N16R8 variant) for Omera v1. It gives you TinyML inference, BLE to iPhone, motor control GPIOs, and GPS module support (via UART to a u-blox module) — all on a single chip at a few euros. The N16R8 (16 MB flash, 8 MB PSRAM) gives you generous headroom for model storage and data buffering. You already know ESP-IDF from your Arduino/embedded work, so the ramp-up time is minimal.github+1

For your Omera e-bike controller running TinyML workloads (adaptive assist, fatigue detection, rider auth) alongside real-time motor control and BLE to the iPhone, the **ESP32-S3** is the strongest all-around pick. Here's how it stacks up against the other realistic candidates.

ESP32-S3 — Best All-Rounder (Recommended)

The S3's headline feature is its vector processing extensions (PIE) on dual Xtensa LX7 cores at 240 MHz, which accelerate quantized neural network operations by roughly 40× compared to unaccelerated inference. Key specs: dronebotworkshop

This comfortably handles your small classifier models (rider auth, fatigue detection) at 100–200 Hz sensor rates while leaving headroom for motor control on the second core. [zediot](https://zediot.com/blog/esp32-chip-series-comparison/)

Nordic nRF5340 — Best for Ultra-Low Power + BLE Quality

If you prioritize best-in-class BLE and ultra-low power consumption over raw ML throughput, the nRF5340 is worth considering: [jonpeddie](https://www.jonpeddie.com/news/nordic-semiconductor-expands-its-ai-footprint/)

The trade-off is less community momentum for motor-control applications and a more constrained toolchain compared to ESP-IDF. edgeimpulse

ESP32-P4 — Future Upgrade Path

The P4 is Espressif's 2026 powerhouse: dual RISC-V at 400 MHz, 32 MB PSRAM, AI instruction extensions, and hardware H.264 encoding. However: linkedin

  • It requires a separate ESP32-C6 co-processor for Wi-Fi/BLE — adds board complexity
  • Designed for vision/multimedia, which is overkill for torque sensor ML
  • ESP-IDF support is mature but Arduino support is still limited dronebotworkshop

This makes sense if Omera v2 adds a camera (e.g., dash-cam or gesture control), but it's overengineered for v1.

STM32N6 — Overkill

The STM32N6 packs a dedicated Neural-ART NPU delivering 600 GOPS at 800 MHz Cortex-M55. It's designed for on-chip computer vision and audio — far beyond what torque-sensor classifiers need, and significantly more expensive. embedded

Recommendation for Omera v1

Factor ESP32-S3 nRF5340 ESP32-P4
ML inference speed ~50–60 ms dev ~1.7 ms (tiny models) [youtube](https://www.youtube.com/watch?v=I8KYwWOlCe8) Faster (400 MHz) linkedin
BLE quality Good (BLE 5.0) Excellent (BLE 5.0) Via co-processor dronebotworkshop
Motor control I/O Excellent Moderate Excellent
Power consumption Moderate Very low Higher
Cost per chip ~€3–5 ~€5–8 ~€8–12
TinyML ecosystem TFLite Micro, mature dev Edge Impulse, growing hackster TFLite Micro, newer
Board complexity Single chip Single chip Needs C6 co-processor

Go with the ESP32-S3 (N8R2 or N16R8 variant) for Omera v1. It gives you TinyML inference, BLE to iPhone, motor control GPIOs, and GPS module support (via UART to a u-blox module) — all on a single chip at a few euros. The N16R8 (16 MB flash, 8 MB PSRAM) gives you generous headroom for model storage and data buffering. You already know ESP-IDF from your Arduino/embedded work, so the ramp-up time is minimal. github

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment