Skip to content

Updated Timer with Broad RPi Compatibility and kernel 6.x GPIO support#157

Open
larsll wants to merge 2 commits intoaws-solutions-library-samples:mainfrom
larsll:feature/updated-timer
Open

Updated Timer with Broad RPi Compatibility and kernel 6.x GPIO support#157
larsll wants to merge 2 commits intoaws-solutions-library-samples:mainfrom
larsll:feature/updated-timer

Conversation

@larsll
Copy link
Contributor

@larsll larsll commented Mar 11, 2026

Issue: #14

Description of changes:

  • All RPi models now supported: RPi 1/2/3/4/5, Zero W, Zero 2W, and all Compute Modules (CM1–CM5)
  • Replaced rpi-gpio with node-libgpiod as the primary GPIO library — uses the /dev/gpiochipN character device interface, unaffected by the kernel 6.x sysfs GPIO renumbering that broke rpi-gpio on Bookworm
  • rpi-gpio retained as optional fallback for pre-kernel-6.x systems only
  • Automatic chip detection: RPi 5 / CM5 use gpiochip4; all other models use gpiochip0
  • Recommended OS updated to Raspberry Pi OS Bookworm (32-bit or 64-bit depending on device); Bullseye and earlier not recommended
  • Activation script now uses uname -m architecture detection (aarch64 / armv7l / armv6l) instead of fragile model-string matching, correctly covering all RPi variants
  • ARMv6 devices (RPi Zero W, RPi 1, CM1) use unofficial Node.js builds from unofficial-builds.nodejs.org
  • Node.js updated to v18.20.8 LTS; libgpiod-dev and node-libgpiod installed unconditionally
  • Conditional UFW rule: opens port 8080/tcp if ufw is installed and active
  • Server-side timestamps: lap time captured at GPIO trigger using Date.now(), eliminating network latency from measurements
  • Per-sensor debounce tracking, configurable via config.gpio.debounceMs (default 2000ms)
  • Configuration now defined entirely in the config object at the top of timer.js — no external config file
  • WebSocket messages now send structured JSON lap data (timestamp, GPIO pin, lap number, per-sensor count) instead of a plain 'lap' string; updated racePage.tsx and racePageLite.tsx to match
  • package.json bumped to v2.0.0; node-libgpiod and rpi-gpio moved to optionalDependencies; engines: { node: ">=18.0.0" } added
  • Zip command updated to exclude package-lock.json; README updated with OS table, Node.js install steps, NTP sync guidance, configuration reference, and troubleshooting section

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@larsll larsll force-pushed the feature/updated-timer branch 2 times, most recently from c4c52b3 to 0ea8ff8 Compare March 18, 2026 07:50
Timing - server-side

Test fixes

Remove not required files

Updated zip

Upgrade node to latest v18

Updates after RPi5 testing

Changes after additional testing
@larsll larsll force-pushed the feature/updated-timer branch from 0d21a06 to 4d171ad Compare March 19, 2026 20:28
@larsll larsll changed the title Updated Timer with RPi5 Compatibility Updated Timer with Broad RPi Compatibility and kernel 6.x GPIO support Mar 19, 2026
@larsll larsll marked this pull request as ready for review March 19, 2026 20:50
@larsll
Copy link
Contributor Author

larsll commented Mar 19, 2026

@StevenAskwith @davidfsmith This one is ready for review. Will need some testing on different devices before merging. (I have tested on Pi Zero W and RPi5 CM so far...)

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