Odometer Calculation

I have my custom dash up and running and the only thing left is the Odometer.

I am sending my speed from a vehicle speed sensor → Arduino → Can / XML → ID136 and the speedometer gauge is working well.

I assumed the odometer would be simulated from the speed signal but that is not happening so I have questions:

  1. Can Realdash simulate the Odometer from the speed input and store it within the app / tablet?
  2. Do I have to send an Odometer value from my Arduino to ID310?
  3. If sending to ID 310 do I store the cumulative value in my Arduino and send it fresh each time the dash boots up?

Is there an FAQ or tutorial on Odometer? I have searched the forums and have not found any guidelines on this one.

  1. Yes, this value is calculated to ‘Calculated Values->Odometer (Calculated)’. This is mapped to ID310 (Body Electronics->Odometer) by default.

  2. You don’t have to, but if you want to override the calculated odometer you can. If you send a custom value to ID310, change the mapping too in ‘Settings->Units & Values->Input Mapping’ to map your custom value to ‘Body Electronics->Odometer’

  3. Yes, if your device sends the odometer, it must save it.

I can report that since I wrote this post I managed to get my Arduino to calculate Odometer from the electronic speed sensor in the gearbox and store the value in the EEPROM on the Arduino when the car is turned off.

I had to put a relay on the power supply that gets power from the constant 12V circuit on the car to keep the arduino running after ignition is turned off. I used an output from the Arduino to keep that relay on until the Odomoter storage code has completed and then turns itself off.

It was a challenge to store such a large number on the Arduino EEPROM and still be accurate to 1m even though the Odometer only displays to the nearest 100m or 1km.

I had to split the distance value into 3 segments and use the three EEPROM channels on the EEPROM to get it to work.

Apparently the EEPROM has a limited number of times it can be re-written so I decided to only store Odometer once when the ignition is turned off. I was initially going to have the value store itself every 1km but that would have failed after around 10,000kms of driving.

2 Likes