marcellatwin
Posts: 13
Joined: Sat Jan 27, 2018 6:41 pm

CanBus Pi Project

Fri Aug 10, 2018 5:27 pm

Hello everyone. I'm fairly new to the Raspberry Pi, my first small electronics project. I'm also an engineering student. This project is mostly centered around Canbus. And hopefully putting my project up here will help others and help me when I hit a road block.

So first a quick overview of my project. To help get experience for fun and also to help with a future job, I'm doing this project. I have a RaspberryPi 3 with a PiCan2 board hooked up to my 2015 Honda Civic Si thru the OBDII port to access the Fast Can. Eventually I'll get the PiCanDuo board to access both the Fast Can and the Body Can, but that's later. I want to access some things like when Vtec is on, RPM is in a certain range, load of the engine is above a certain amount, etc. I want to then run my own program that will actuate an exhaust cutout. So when "vtec just kicked in yo" lol the exhaust will become a straight thru exhaust, but only during high load, high rpm situations. There's a product out there that already does this. I think it's called Vtec Climax but it's several hundred dollars and I want to do it myself, as I'm sure you all can understand.

So here is the progress I've made. I got a Pi 3 and the PiCan2 board hooked up. I'm waiting on a Mini Black Hat Hack3r to split the GPIOs so I can use the unused ones on a breadboard for prototyping (additional switches I have planned, LEDs for when the system is working, etc.). I setup the Pi and finally connected it to the internet to update it. To give context to why that last part was difficult for me, I'm running the Pi entirely thru command line issues from my Macbook connected thru an ethernet cable. The reason is because that how this project will run, without a screen or keyboard. Once the project is done, it will sit inside the car and operate all by itself, only needing to connect to my laptop for occasional update. At least this is my hope, lol. So after that I found out the PiCan2 board has an LED circuit. I downloaded wiringPi's code for GPIO use and got the LED to work via command lines. I then wrote a program that did the same thing, turn on and off the LED. Some of this may seem simple to you, but it is my first time doing something like this and is huge steps for me. But trying to mimic what I've learning in school and my internship of taking a big software project and breaking it down to little projects.

The stage I'm at is now the Canbus part. I am using the linux-can-utils software (from Volkswagen I think, haha). I have started to decode some of the Can packets, but it is difficult. The problem I have right now is with the cansniffer.c program. I noticed several other characters after the 8 bits of each can packet. Sometimes they are just "........" sometimes they change rapidly and with no perceivable pattern. What is this data???? or is it just garbage to be ignored???? Does anybody know?

Thanks for all your help in advanced. I hope this project is of interest to some people.

marcellatwin
Posts: 13
Joined: Sat Jan 27, 2018 6:41 pm

Re: CanBus Pi Project

Wed Aug 15, 2018 4:53 am

Hello again. So there's been some updates. First I answered the question from my last post about the random characters after the CanBus data. I emailed Craig Smith, a "CanBus hacker" who has a YouTube channel and a book about CanBus hacking where I learned how to use the cansniffer program a little bit more. He replied that it was ASCII data and not really of much use unless you are looking for a VIN or something.

So with his advice and other research I've done 2 decoding sessions with my car. One just sitting in the garage by myself trying to figure the program out. Key thing was I wasn't moving. The other was about 2 hours on the highway with someone else driving. This helped a lot as I could say, "go to 5th, now floor it, now 6th, left off the throttle, clutch in, clutch out, etc." We could only do some much with traffic. The plan is the do another session at night or early morning on Saturday where there won't be any traffic on desolate county roads. But I'm also going to try to find if there is anybody that has already decoded my particular car's CanBus, cause this might take a while to decode everything I need.

In the mean time, I've combed thru the candump and cansniffer programs to try to write my own program to take each Can data packet and try to at least display what I've decoded so far, like throttle position and speed. I'll post that code later once I've added a little more structure to it.

If anyone has suggustions as to decoding or know where CanBus data has already been decoded please let me know.

Below is the data I've decoded so far.
Screen Shot 2018-08-14 at 21.44.28.png
Screen Shot 2018-08-14 at 21.44.28.png (217.43 KiB) Viewed 49 times

marcellatwin
Posts: 13
Joined: Sat Jan 27, 2018 6:41 pm

Re: CanBus Pi Project

Wed Aug 15, 2018 7:30 pm

For those of you who are car people, this is my motivation:

https://www.youtube.com/watch?v=cMGyUm-4v8E

That video was the review of the Vtec Climax that I'm replicating with some differences. As stated before, this item is too expensive (over $350) and I want the experience of coding and building this myself.

I've fine tune the code for the displaying of certain canbus data (translated) onto the terminal, like my own primitive dashboard. But I still can't figure out how to get the address off the socket for the canbus data coming in. Anybody have any ideas?

Here is the forum post on that specific issue: viewtopic.php?f=91&t=220451&p=1352963#p1352963

Soon I should get my switches and Mini Black Hat Hack3r so I can split the GPIOs and have a prototyping breadboard AND PiCan2 board hooked up at the same time. They are shipping from England to the USA so it might take a few more days (shipped a week ago). Pictures will definitely follow.

Return to “Other projects”

Who is online

Users browsing this forum: No registered users and 7 guests