Go Down

Topic: [Solved] MCP2515 CAN Bus Shield and Arduino Pro Mini - coryjfowler (Read 510 times) previous topic - next topic

sathyanarayananp

Hi All,

I don't know if I am going in the right direction. I do not see many detailed articles that I could read to get more information on reading the Speed and RPM of my Hyundai.

I am using the library coryjfowler, I think I managed to get connected with my car as it showed some random value. I am new to Arduino which makes the job even more difficult for me.

https://github.com/coryjfowler/MCP_CAN_lib

Can any body guide me? and sorry if I am asking a dumb question.
I am referring WIKI as documentation. https://en.wikipedia.org/wiki/OBD-II_PIDs

This is the data I received when the Ignition and engine was turned off,  there were lot more Standard ID: 0x541 when the engine was running.
Code: [Select]

Standard ID: 0x541       DLC: 8  Data: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01
Standard ID: 0x541       DLC: 8  Data: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01
Standard ID: 0x553       DLC: 8  Data: 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x00
Standard ID: 0x541       DLC: 8  Data: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01
Standard ID: 0x541       DLC: 8  Data: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01
Standard ID: 0x553       DLC: 8  Data: 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x00
Standard ID: 0x541       DLC: 8  Data: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01
Standard ID: 0x541       DLC: 8  Data: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01
Standard ID: 0x553       DLC: 8  Data: 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x00
Standard ID: 0x541       DLC: 8  Data: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01
Standard ID: 0x541       DLC: 8  Data: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01
Standard ID: 0x553       DLC: 8  Data: 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x00
Standard ID: 0x541       DLC: 8  Data: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01
Standard ID: 0x541       DLC: 8  Data: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01
Standard ID: 0x553       DLC: 8  Data: 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x00
Standard ID: 0x541       DLC: 8  Data: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01

DKWatson

If this is output from your connection, it would appear that everything is working fine. What does the data mean? Who knows? That is Hyundai CAN data and really has nothing to do with Arduino. I don't know if you'll find someone here with specific knowledge of a specific CAN data structure. My response, in an effort to help, is simply to bring your post back to page 1 where others may once again choose to look at it. Few venture past the first page looking for issues. Good luck.
Live as if you were to die tomorrow. Learn as if you were to live forever. - Mahatma Gandhi

sherzaad

Hi All,

I don't know if I am going in the right direction. I do not see many detailed articles that I could read to get more information on reading the Speed and RPM of my Hyundai.

I am using the library coryjfowler, I think I managed to get connected with my car as it showed some random value. I am new to Arduino which makes the job even more difficult for me.

https://github.com/coryjfowler/MCP_CAN_lib

Can any body guide me? and sorry if I am asking a dumb question.
I am referring WIKI as documentation. https://en.wikipedia.org/wiki/OBD-II_PIDs

This is the data I received when the Ignition and engine was turned off,  there were lot more Standard ID: 0x541 when the engine was running.
What message are you sending out (via the OBD I'm assuming)? any respose to that message(s) in igniyion ON/engine running?

sathyanarayananp

Right now it's just sniffing out all the packets that it can get.

Regards,
Sathya

sherzaad

Right now it's just sniffing out all the packets that it can get.

Regards,
Sathya
then... there's no point referring to WIKI as documentation. https://en.wikipedia.org/wiki/OBD-II_PIDs!

what you looking is probably propriety.

refer to the "CAN (11-bit) bus format" section in that link to understand what message(s) you need to send to receive the many parameter enumerated

sathyanarayananp

#5
Sep 18, 2018, 08:14 am Last Edit: Sep 18, 2018, 08:32 am by sathyanarayananp
Can somebody help me understand what the Standard ID is and what PID is?

Is PID highlighted in Bold below??
Standard ID: 0x541      DLC: 8  Data: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01

I did not understand the concept after reading wiki, can somebody please direct me to a good reading material?? Or Guide me with their knowledge?

The concept in my head goes like this... The gauges in the console are already reading these values so these values will be getting transmitted over can bus.

In the Wiki it states us to
Quote
"The functional PID query is sent to the vehicle on the CAN bus at ID 7DF"
and the response is
Quote
The vehicle responds to the PID query on the CAN bus with message IDs that depend on which module responded. Typically the engine or main ECU responds at ID 7E8h. Other modules, like the hybrid controller or battery controller in a Prius, respond at 07E9h, 07EAh, 07EBh, etc. These are 8h higher than the physical address the module responds to.
So do we really need to send the query as suggested by wiki or can I get the data from the dump from https://github.com/coryjfowler/MCP_CAN_lib/blob/master/examples/CAN_receive/CAN_receive.ino

The above extract is taken from the link https://en.wikipedia.org/wiki/OBD-II_PIDs#Query


I am a non native english speaker I might be reading the article and not be interpreting it correctly.
Please understand my situation.

sherzaad

Can somebody help me understand what the Standard ID is and what PID is?
do you even know CAN protocol... I wonder!


in a previous post YOU said you were just reading the OBD and got that data. and I told you that the data you got its likely to be proprietary. if you have the vehicle CAN database sure you can then decode it.

what's wiki is open data to the public that all OEMs should  implement.

meaning: you need to then that 0x7DF can ID (that is your standard CAN ID btw) with the PID (that is the command within the 0x7DF CAN message to request the data you want)

for example to get engine current (service 0x01) rpm (PID 0x0C) you would send Standard ID 0x7DF message 0x02 0x01 0x0C 0x00 0x00 0x00 0x00 0x00 and look at the reply message to get the raw rpm value.

sathyanarayananp

do you even know CAN protocol... I wonder!


in a previous post YOU said you were just reading the OBD and got that data. and I told you that the data you got its likely to be proprietary. if you have the vehicle CAN database sure you can then decode it.

what's wiki is open data to the public that all OEMs should  implement.

meaning: you need to then that 0x7DF can ID (that is your standard CAN ID btw) with the PID (that is the command within the 0x7DF CAN message to request the data you want)

for example to get engine current (service 0x01) rpm (PID 0x0C) you would send Standard ID 0x7DF message 0x02 0x01 0x0C 0x00 0x00 0x00 0x00 0x00 and look at the reply message to get the raw rpm value.
Thanks for the reply,  I did try to send 0x7DF and the value, my engine misfired and Check engine lights came on for a moment and then went off.. I got a bit worried and continued my hunt for answers..

Regards,
Sathya

sherzaad

Thanks for the reply,  I did try to send 0x7DF and the value, my engine misfired and Check engine lights came on for a moment and then went off.. I got a bit worried and continued my hunt for answers..

Regards,
Sathya
sorry to here that. never got this problem.

you might want to check out this library... it's got example about how to use PIDs or over OBDII

https://github.com/Seeed-Studio/CAN_BUS_Shield

sathyanarayananp

sorry to here that. never got this problem.

you might want to check out this library... it's got example about how to use PIDs or over OBDII

https://github.com/Seeed-Studio/CAN_BUS_Shield
Let me get home and try it, I will keep you posted thanks for helping me out.

sathyanarayananp

#10
Sep 19, 2018, 03:39 pm Last Edit: Sep 19, 2018, 08:26 pm by sathyanarayananp
OK, I am back with some good news.

I managed to get the RPM, I think the reason that the engine misfired was some code / repeated messaging.

I connected all my arduino circuits and tried to read the 0x7DF. and it sent out a response through 0x7E8 but with a general failure response 0x7F in the 2nd byte.

I then tried to connect the "Torque" android app along with my circuit and everything started working. Probably there is some command that I need to isolate for OBD2 to start responding to the request to 0X7DF.

I have dumped a before and after log, I will compare both and let you know the findings..

Regards,
Sathya

sathyanarayananp

#11
Sep 20, 2018, 01:47 pm Last Edit: Sep 20, 2018, 05:13 pm by sathyanarayananp
Hi All,

For those of who you have the same problem ie you cannot get 0x7DF to respond with successful message.


Send in the "Activation query" (Thats how I named it) first.
Code: [Select]
Standard ID 0x7DF message 0x02 0x01 0x00 0x00 0x00 0x00 0x00 0x00

Then send the query again - for RPM
Code: [Select]
Standard ID 0x7DF message 0x02 0x01 0x0C 0x00 0x00 0x00 0x00 0x00


Thank you all for your support especially sherzaad, DKWatson You guys are the best!!!!!


Regards,
Sathya

Go Up