This is a custom speedometer built with an Arduino Nano. It can be mounted on a bike.
I make this project four years ago and roughly assembled on wood with hot glue. The system worked for a few years, than humidity, rain, and poor contacts broke the project.
Now that I have a 3d printer, I've redesigned it and I've built a 3D case to host everything.
Circuit schema, Arduino code and 3D case model are provided.
How it works:
The concept is simple: a reed sensor placed near the wheel listen for the passage of a magnet placed on a spoke of the bike wheel.
When the magnet passes a spin is counted.
Knowing the length of the circumference of the wheel and the number of spins done in a defined time frame, we can calculate the speed.
Two buttons are provided to handle functionalities.
The speedometer can show:
- Speed
- Distance
- Number of spins of the wheel
- Time passed from start
There some special features, which make this project interesting:
Software special feature 1: the system uses timers and an interrupt to read the passage of the magnet, so that time is not wasted inside the code. No delays.
Software special feature 2: when the speed changes the numbers in the display are gradually incremented to match the new value.
Special feature 3: the case cover is attached to the box with two small magnets.
User instructions
To change function press left button (D7 pin), this will cycle between functions:
- Speed
- Distance
- Rounds (spins of the wheel)
- Time
The right button (D5 pin) switches through sub-functions (or "modes"):
- Speed: kph / mps / avarage speed in kph
- Distance: show units / hide units to have some more space
- Rounds: total spins / rpm
There is also a "special function" to save data in EEPROM, so that you can keep track of time and distance also after turning off the Arduino:
- Press both the buttons for 5 seconds will save data (spins and time passed)
- Keep buttons pressed for 10 seconds will delete data and restart the Arduino
Nice to have...
Talking to ChatGPT lead me to a nice to have feature, to detect when the speedometer has been turned off and only in this case automatically save data into EEPROM. I left the link here for future reference:
Automatically save data when turning the Arduino off, by using a CAP and a voltage read to detect power off and save just before powering off:
https://chatgpt.com/share/6726094c-0564-800c-a1c1-479772cbc928