Skip to content

feat(ism330dl): Add pedometer (step counter) example. #417

@nedseb

Description

@nedseb

What

Create a step counter example that detects footsteps using the ISM330DL accelerometer and displays the count + estimated distance on the OLED.

Why

Practical application of accelerometer data processing. Teaches peak detection, thresholding and debouncing — fundamental signal processing concepts on a tangible use case.

Suggested approach

  1. Read `acceleration_g()` continuously from the ISM330DL
  2. Compute the magnitude: `mag = sqrt(axax + ayay + az*az)`
  3. Detect a step when the magnitude crosses a threshold (e.g. 1.2g) with a minimum interval between steps (debounce ~300ms)
  4. Display on the OLED using `steami_screen`:
    • `screen.value(str(steps))` as the main number
    • `screen.subtitle("~{} m".format(steps * STRIDE_M))` for estimated distance
    • `screen.gauge(steps, max_val=TARGET_STEPS)` for a progress arc toward a daily goal
  5. `try/finally` with `imu.power_off()`

Learning goals

  • Signal magnitude computation
  • Peak detection with threshold + debounce
  • Real-time counting and display

Hardware

  • ISM330DL accelerometer
  • SSD1327 OLED

Documentation

Write a pedagogical activity sheet for the STeaMi wiki covering:

  • Learning objectives (signal processing, peak detection, debounce)
  • Step-by-step instructions
  • How to calibrate the threshold and stride length
  • Extension ideas (calorie estimation, activity classification walk/run, BLE broadcast to phone)

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions