# speedsensor-correction

Hi my friends,
I am quite new to arduino, so please be patient with some of my questions, it is just my desire to understand - once you understand, learning gets fun!

I have a scooter, it is a suzuki. It has a Hall-IC as a speedsensor. The frequency ranges from 8Hz @ 1km/h to 1456Hz @180km/h.

Whats the problem?
The speedometer is nearly 10% ahead. I must ride nearly 109-110 to actually reach the speed of 100. I dont like that. For the discussion of my arduino-programming inquiry it does not matter how accurate a reference measurement by tomtom gps is...

Description of my thought:
So I have a pulse at a digital input, and a pause of differing length, and then another pulse... C=L*F
What do I want?
I want to define a correction factor (e.g. 9% or 1,09), and use this to digital output a corrected frequency, which I give back to my speedometer.

Sounds quite simple, but so far I could not get it working. I tried the tone-library and measured by a Oscilloscope. Please guide me how to have a most stable and very fast and accurately responding program. As the actual job is really small I am even considering to finally use a ATtiny...

So the speed meter show a higher speed than you actually ride?
Then the simple solution is to copy every pulse except the 10th. Might just work

``````void loop()
{
for (byte i=0; i<9; i++)
{
digitalWrite(outPin, HIGH);
while (digitalRead(inPin) == HIGH);

digitalWrite(outPin, LOW);
while (digitalRead(inPin) == LOW);
}
// skip 10th pulse
while (digitalRead(inPin) == HIGH);
while (digitalRead(inPin) == LOW);
}
``````

The speedometer is nearly 10% ahead. I must ride nearly 109-110 to actually reach the speed of 100. I dont like that.

It is a legal requirement that the speedometer must not indicate a speed slower than you are traveling it is normal to give them 10% over. So you have to be very careful not to make your bike illegal.

I would just use the pulses you get but use a different wheel diameter to make any adjustment. If you use the real wheel diameter that would be a start.

Hi robtillaart,

thanks for your input, I must admit this would probably be one of the most simple solutions.

But somehow I am not completely happy with this work around yet, as it is neither fast responding nor accurately. It is not smooth and kind of inconsistant, it just does it statistically over longer time. At lower speeds the display may even start jumping heavily although riding at constant speed. No, I dont like it. Additionally I can not define freely the desired correction factor e.g. 1,07 to assure, that the travelled speed is still below the speedometer display.

Sigh!

The frequency ranges from 8Hz @ 1km/h to 1456Hz @180km/h.

Simply shift this relationship, no need to miss anything.

I'd love to see a scooter doing 180 km/h ;D

ian332isport:
I'd love to see a scooter doing 180 km/h ;D

try Suzuki Burgman 650 I love to ride it!

hmm,
seems like this problem is either too simple, that many don´t feel worth contributing, or it is more challenging than I expected?