Author Options:

Measure RPM and MPH on motorcylce with Arduino Answered

Hi all, I have an idea for an Arduino based instrument cluster for my
cafe racer (1980 xs400). My question is what kind of rotary encoder I should use to measure the rotation from the cables coming from the engine block and front wheel that went to the original cluster (shown in pictures). I want something that won't break at higher RPMs and is more or less water proof. I have an idea of how to code this on the software level as well, but I'm not to experienced with C/C++ so any help there would also be appreciated. The end goal for this part of the cluster is to output the RPM and MPH to respective WS2812B 5050 LED strips, and possibly a small oLED later down the line. If something could be made more clear on this post let me know and I'll try to elaborate. Thanks again



2 months ago

Ok, took me only about 80 reloads and half an hour of swearing to be able to enter text in this box here, lets see if it makes it all the way...

Forget about rotary encoders!
Been there, done that, learnt my lesson the hard and costly way.
Assuming it is not a diesel engine you can utilise the ignition impulses together with calculations for the gear used, wheel diameter and so on.
Quite accurate but a pain to program.
Gave up on that one too once I realised it takes me longer to calculate everything then building the electronics required for it.
The light bulb moment came on a bike ride with my little niece.
If it works so well on a push bike then why not use the same simple tricks on a real bike?
Ok, I was lazy and just added a bicycle speedometer with trip counter and so on ;)
But the same simple reed contact from such a cheap "toy" can be used as the input for small Arduino or Pie.
One imulse per revolution of the wheel.
All that is left is to calculate the circumfence of the wheel to make it highly accurate.

Some hints:
Programming something to display your speed and trip data is not really hard.
Getting the data can be depending on the bike.
Mine was a Maico dirt bike with 500ccm in one cylinder...
That meant huge forks, ots of empty space.
To make the reed contact work with a magnet I used two small neodymium magnets glued (with quality epoxy) to little screw on studs - you know similar to those holding reflectors on the bike spokes.
Two because it prevents any imbalance on the wheel ;)
Easiest placement was on the rear wheel as the chain guards lower part was quite close to the inner spokes already.

In some cases it is possible to use a proximity sensor directly on the axle of shaft for the front sprocket of the chain.
If it has one or more groves for alignment then the sensor can pick on them.
That is if you have enough room to securely mount it in the right place.

Last and high tech option for the pro:
Sensors or cams that check the road surface - like a laser computer mouse.
But then again using a simple GPS module would give the same results for the screen on the dash ;)


Reply 2 months ago

Thanks, I'll keep all that in mind. The reason I wanted to use rotary encoders is that the cable shafts spin much slower then the actual RPM and MPH. I would use nothing more then a GPS module, but I would like to be able to read the engine RPM.