A Self-Learning Microcontroller Delivers Motorcycle Gear Indication — On a Vintage Nixie Tube
A Bluetooth link to the bike's OBD port and some clever calculations provide a best-guess of the currently-engaged gear.
Pseudonymous maker "decogabry" has turned a vintage Nixie display into a gear indicator for a motorcycle — having an Espressif ESP32 microcontroller communicate with an On-Board Diagnostics (OBD) reader to convert engine revolution and wheel speed to a gear number through an automated learning process.
"This project is a motorcycle retrofit that calculates the engaged gear using wheel-sensor pulses and RPM read via OBD (ELM327)," decogabry explains of the build. "The system performs automatic gear learning, stores the data in memory, and displays the gear on a real cold-cathode Nixie tube driven with discrete transistors, combining modern electronics with historic elements."
The project would have been a considerably simpler thing if the OBD interface — common to most modern motor vehicles and providing a way to read values from on-board computer and sensor systems — kept track of the currently-selected gear, but it does not. As a result, decogabry had to get clever: "This system estimates the engaged gear by comparing engine RPM [Revolutions Per Minute] read from the ECU via OBD + ELM327 [and] wheel speed derived from the pulse signal of the wheel speed sensor," the maker explains.
"Each gear changes the mechanical ratio between engine and wheel. The firmware computes ratio = RPM / wheelFreqHz. In 1st gear the ratio is higher, in higher gears it becomes lower. This ratio acts like a 'fingerprint' for each gear. On first boot the project enters LEARN mode. For each gear (1–5) the rider keeps throttle and speed steady for a few seconds. The firmware: waits a short settle time (avoids clutch/transient effects); samples multiple ratio values; accepts the gear only if the ratio stays stable for consecutive readings. The learned values are then saved to EEPROM."
In "RUN" mode these learned gear numbers are displayed on a vintage Philips ZN1020 Nixie tube, while a seven-segment LED display shows the engine temperature as read over the OBD port. The whole system is mounted for at-a-glance reading on-the-move, though decogabry warns users to pay attention to the road and not the warm glow of the Nixie tube — and to "perform the learning process only on a safe, low-traffic road or private area."
The full write-up, including wiring instructions and source code, is available on Instructables.