By analyzing the CANbus of my motorbike, I located the speed data byte (sent by the ABS module).
The message ID 0x268 is sent every 10 ms and the Byte n.2 is the speed, but....
It takes the values 0, 1, 2, 3, .... which correspond to 0, 18, 36, 54, .... [km/h].
Now, the passage from one speed to another value is determined by the frequency of the respective raw data.
Example:
9 km/h (18/2) is obtained by alternating every 10ms the value 0 and 1.
If the 1s increase compared to the 0s, the speed increases and if they are only 1 to reaches 18 (threshold speed for raw data 1).
32 km/h is obtained by alternating more values 2 to the values 1.
Can you help me figure out how to get a formula for correct decoding?
Hi @robtillaart,
i have tested your library. It's perfect for this .
I have only an issue using it.
Board: ESP32-WROOM-32
run onReceive() function on Core 1 to receive canbus messages.
when I receive 0x268 (every 10ms), add the value and get average speed: