1
\$\begingroup\$

I am trying to reverse engineer the data sent from an old CAN bus data logger. It sends a single ID which is selectable from a dip switch.

The only bit of data I am struggling with is the RPM

I plan to feed this data into a STM32F Discovery, in the past most of this type of data is linear and easy to work with, for example RPM=CANbus data x 0.32 but looking at my data below it is not linear and I cannot find a simple way of interpreting it:

RPM CAN Bus Decimal Data

1000 = 0312

1250 = 0389

1500 = 0464

1750 = 0541

2000 = 0613

2250 = 0688

2500 = 0762

2750 = 0828

3000 = 0903

3250 = 0979

3500 = 1058

3750 = 1140

4000 = 1226

4250 = 1313

4500 = 1401

4750 = 1485

5000 = 1568

5250 = 1653

5500 = 1736

5750 = 1821

6000 = 1900

6250 = 1984

6500 = 2063

6750 = 2144

7000 = 2224

7250 = 2301

7500 = 2377

So I need to come up with an equation so I can put it in my code to calculate the RPM.

RPM = Data x 0.3 + 12 is very close but not close enough

I have plotted the above on a graph and the line of best fit is: y=0.00000357058x^2+0.29145x+11.9358 but this seems very complicated to try to replicate in code and I also cant see why the designer would have made the data so complicated.

So my question is how can I take the above data and come up with an equation or code so my device can interpret the RPM from the CAN bus data?

\$\endgroup\$
  • \$\begingroup\$ You could program in a lookup table and do a linear interpolation between points. \$\endgroup\$ – Ron Beyer Dec 17 '17 at 17:26
  • \$\begingroup\$ where are you getting the RPM values? \$\endgroup\$ – jsotola Dec 17 '17 at 18:35
  • \$\begingroup\$ by disconnecting the device from the network and sending my own data to the bus via a usb to can device the rpm is then displayed on the legacy screen \$\endgroup\$ – JohnBoy Dec 17 '17 at 18:36
  • \$\begingroup\$ Let's get this straight. Are you saying that, for instance, if you send decimal 2224 via CAN, the legacy software displays 7000 RPM? \$\endgroup\$ – WhatRoughBeast Dec 17 '17 at 19:57
  • \$\begingroup\$ Yes correct if I send 2224 decimal it displays 7000 RPM on screen \$\endgroup\$ – JohnBoy Dec 17 '17 at 20:40
0
\$\begingroup\$

Looks pretty linear to me:

enter image description here

I doubt you have any real work to do.

\$\endgroup\$
  • 1
    \$\begingroup\$ Something is wrong with the source data, 4250 and 4500 appear twice with different values. \$\endgroup\$ – Ron Beyer Dec 17 '17 at 18:03
  • 1
    \$\begingroup\$ My thought exactly ...an offset like that would seem to indicate it's probably quite linear. \$\endgroup\$ – Jack Creasey Dec 17 '17 at 18:07
  • 1
    \$\begingroup\$ My bad, something went wrong with copy and paste there! Ive now updated the data in the question \$\endgroup\$ – JohnBoy Dec 17 '17 at 18:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.