CAN-BUS Shield v1.2 novice help needed

Hello,



Please forgive my ignorance and lack of knowledge.



Several years ago I’d been using the Rapsberry Pi Model B with an ELM 327 adapter to read data from the bus on my run-about Ford Fiesta 1.6TDci. There was a little success with that approach despite a lot of work going into it but ultimately it didnt get the result I wanted at the time. I then switched to Arduino and the Seeed Studio CAN-BUS Shield v1.2 to have more success with the libraries.



Unfortunately, subsequently, other issues got in the way and I had to abandon this project too. However, although post-surgery at the moment (prostate cancer) I find myself at home recovering but also trying to get back to my Seeed Studio shield to work on the Arduino Uno R3 and MEGA 2560.



All the examples that are available from the SeeedStudio library for this shield work fine. The serial monitor seems to return some data from the OBDII port.



For example: If I run the ‘OBD-II_PIDs TEST CODE’ example, from SeeedStudio, I get the following HEX values returned to the serial monitor display:-



id: 0x7E8 . . . followed by . . 0x6 0x41 0x0 0x98 0x3B 0x80 0x11 0x0



I tried to work out what this means but I struggle to understand the information. As far as I can tell this may relate to a query made to or recieved from the PID 0x7E8 which returns the HEX data possibly relating to the RPM of the engine? Again, forgive the lack of knowledge here . . .



As far as I can tell, my Ford Fiesta runs an 11 bit ID at 500K baud (ISO15765 CAN?) protocol. In terms of connectivity with the car, I run an off-the- shelf Data Link Connector and cable from under the dashboard connector socket into the DB9 serial socket on the SeeedStudio shield.



Despite seemingly reading so much about CAN and OBDII some years ago, I find myself going around in circles unable to develop the SeeedStudio Shield Arduino examples beyond what the are written to do - function as starting blocks for learning.



What I’d hoped to do eventually was filter the data out for the vehicle speed and then convert this into an form which can be serially read out and displayed as an integer number corresponding to vehicle speed (mph) on a LED segment display. This all sounds straightforward enough but I don’t mind admitting I’ve struggled with this.



I dont expect anyone to offer the solution to this problem all in one go, but if anyone here can please help walk me through the problem, or point to further information which will help me locate the data from the engine/ECU that I’m trying to use as above, I should be extremely grateful.



I can explain other approaches I’ve tried to take when trying to get my project to work but suffice to say I’ll be brief about this at this point in my tentative enquiry.



Thank you again if you are able to offer any help.



Mark

In the unlikely event anyone is following my original posting . . .



Thank you to those who tried to help, or rather didn’t!



I’ve managed to resolve my query and now have an adapted script running the way I want it to.



My adapted and integrated script now achieves the following:-


  1. Read and *display (static, scroll, reverse & invert) Ford **ECU PID data (500Kb/11bit) relating to Vehicle Speed and RPM to a 10 x (8x8) LED Matrix display strip.


  2. ***Parse NEMA sentences to display on said matrix altitude and time-of-day data.



    • I plan to change to Mikal Hart’s TinyGPS++ libraries soon and adapt the script further to make it more efficient.



    • I also plan to present a YouTube tutorial about my project.



    *Thank you to Marco Colli (MajicDesigns) Parola libraries.

    **Thank you to Seeed Studio’s example script, OBDII_PIDs, as a base starting point.

    *** Thank you to “ludektalian” for further inspiration.



    Thank you,

[code]//-----------------------------------------
// #Define this_that_and_the_other
// String = “Only fraction of script”;
// blah - - -
// blah - - -
// blah . . .

unsigned char newArray[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
unsigned char serialOutArray[3] = {0,0,0};

if(CAN_MSGAVAIL == CAN.checkReceive())                   // check data acquisition
{
    CAN.readMsgBuf(&len, buf);    // read data,  len: data length, buf: data buf
    
    for(int i = 0; i<len; i++)    // print the data
    {            
        newArray [i] = buf[i], HEX;
    }        
    serialOutArray [0] = newArray [2]; // create new array of just 3 items
    serialOutArray [1] = newArray [3];
    serialOutArray [2] = newArray [4];
    delay(100);
                  
    for (int y = 0; y<13; y++)
       {
          if (int(serialOutArray [0]) == 5) // Coolant in Celsius
            {                 
            delay(100);               
            colSub = int(serialOutArray[1]);
            colTot = (colSub-40);
            P.print(colTot + "C");
            delay(500);
            colSub = 0;
            colTot = 0;
            break;      
            } 
         if (int(serialOutArray [0]) == 12) // RPM
            {
            rpmA = int(serialOutArray [1])*256; 
            rpmB = int(serialOutArray [2]);
            subRPM = (rpmA + rpmB);
            rpmTot = subRPM/4;       
            P.print(rpmTot + "RPM");
            break;
            }
            if (int(serialOutArray [0]) == 13) // MPH
            {
            mphA = serialOutArray[1];
            mphTot = mphA*0.621371192;       
            P.print(mphTot + "MPH");
            break;
            }     <e>[/code]</e></CODE></r>

Hi Mark,



Thanks for sharing the story. Do you mind posting the youtube in the forum in future? So other people can learn from it. thanks.



Bill

Thank you, Bill.



Yes, I will post the presentation to YouTube.



There might be a delay in that I’m gravely ill at the moment, so sitting at the desk is difficult over a longer period.



I also have to tidy the code up a little after developing the project further this week and also the draft code to test the concept I posted here was a little rough at the edges.



I hope to get it onto YouTube within the next month. I will post here when that happens.





Thanks again,



Mark

Hi Mark, Sorry to hear that and we hope you recover soon. thanks for your efforts for the code and video.

best wishes

Bill