Motorcycle sensors

Background

My dad is rebuilding a 1929 Indian Scout motorcycle.

The problem is that it has no speedometer, odometer, or temperature guages and I need to build them.

Basics

I’m using a Metro Mini 328 as the brains. And a METRO 328 for building. The full size is nice because I have a couple each mounted to a breadboard and one with an oled display.

Housing

The first step is to make a duplicate of the dash itself. We only have one and needed a duplicate so that I could assemble the internal parts in a way that fits. A few hours of Fusion 360 later and a couple of 3D prints with tweaking in between and we had a pretty good model of the dash. It was useful to print the part with supports and carefully remove them in one piece. The supports could then be put into the original to compare the printed dash with the real one.

Speedometer

The speedometer/odometer wiring is relatively simple. Magnets on the wheel will trigger a reed switch and a button can be used to reset the odometer. The reed switch and button are connected to 5 volts on one end and an input pin on the other. The input is pulled down.

The code is a little more complex. I Started with this example by amandaghassaei on instructables. I rewrote the code to be a little more clear in my opinion and to add the odometer and reset button as well as an oled display. I also fixed a bug that happened when the wheel would stop in a way where the magnet was pulling the reed switch close.

A function is called as an interrupt every millisecond that polls the reed switch. It it’s open it adds one millisecond to a variable used to time a rotation. If it is open it counts that as one rotation and calculates mph and adds to the odometer.

code

Noise

Because this is an automotive project there’s going to be a lot of EMI noise. We’ll need to take precautions against this. I’m using this post as a guide. Unfortunately the guide is incomplete, I’ll be relaying on other makers for help.

Build coming soon.