I am just forming the ideas for a small project, so appreciate any input you can give me.
The background - My motorcycle has a bit of an issue. It was imported into this country and as a part of the compliance process, they had to change out the speedo for one that shows the speed in kilometers instead of miles. The original speedo has a small reed switch in it that would detect the revolutions of the speedo mechanism and feed that info back to the computer in the bike. The replacement speedo does not have that reed switch, and trying to retrofit one into the unit would be more trouble than it is worth.
My idea - to create a small circuit using a Nano and an accelerometer. It would measure the acceleration, over time and from that work out the speed, and then act the same way the reed switch would, turning on and off at the correct frequency (which I will still need to calculate) to feed the info back to the ECU on the bike.
Is there something that I am overlooking with all this? Am I going about it in a weird way, and is there a better/simpler solution to this?
It shows speed, as it is a mechanically driven speedo, but it doesn't then feed that information on to the ECU which controls the self-cancelling indicators etc, and therefore like to give me a check engine light telling me there is something wrong with my speed sensor.
Ok, I think I get what they are saying. As roads are rarely ever flat, and being in a motorcycle there will be quite a lot of leaning, any degree tilt to the sensor will throw the data it reads way out.
Do you have any other suggestions for this problem, short of adding GPS to this system (which I suppose could be handy if I wanted to make a low-jack type system in the future).
Those are a couple of the reasons it won't work, but there are other errors that are more serious, like the failure to correctly subtract out the acceleration due to gravity.
A GPS module would work very well, and have other uses too. That is a fine idea.
With a small magnet fixed to a wheel or other rotating part, a Hall Effect sensor can detect each revolution. Pretty simple. Always available and accurate. Disadvantage is it 's a custom installation (would be far easier on a bike than a car). Advantages of GPS are portability and as jremington said gives more data and more interesting.
I would strongly caution against using GPS for this. GPS speed measurements when surrounded by tall buildings is pretty bad. I spent a long time on a project that required GPS distance calculation and we initially tried integrating speed and it simply wasn't reliable until you drove out into the suburbs or rural areas.
I use a GPS speedo daily and find it works very well even among city canyons.
How long ago did you work on that project? I wonder if modern units perform better. Dunno.n
A GPS speedo is not reliable at very low speeds. When stationary it can still register speeds, sometimes quite high. It's just its inherent randomness that you can't do much about except filter out spurious values. But for showing your car speed while actually driving, I find it does a fine job.
If distance measuring is important then an HE sensor counting wheel clicks can't be beat, don't you think?
I think the module we were using was a uBlox 7p, but I could be wrong. Speed may have had something to do with it since most of the time the vehicle under test would be traveling well under 30MPH. In any event since what we really needed was distance, it was much more accurate to plot positions and accumulate distance from point to point.
You could do what auto GPS receivers do. Ignore any data where any single LAT-LON is significantly different from the prior reading. I did this on a drone project a few years ago and the result was surprisingly accurate.
I have played around with a MINI GPS PA1010D STEMMA QT from Adafruit. While when stationary it will read under 1.0 MPH when moving it is pretty accurate. My Wife's truck is a cherry 99 Tahoe so we added a Garmin GPS and that thing is right on target for speed and everything else. I have my GPS module connected to an Arduino Uno Rev 3 and a 4 line 20 character display and you can choose what you want to display.