FVEAA Forums

EV Technology Development => Monitor and Control Devices => Topic started by: rich.carroll on March 02, 2017, 06:12:31 PM

Title: Inexpensive ways to Approach Vehicle Communications
Post by: rich.carroll on March 02, 2017, 06:12:31 PM
Here is a couple of interesting manuals that will help you a lot in understanding Vehicle Bus Communications. I'll also discuss the possibility of using an Arduino interface, so get a cup/glass of your favorite beverage and settle in.

 First is the owners manual for a pair of GridConnect CAN RS232 adapters.  It details the use of CANbus in cars, and discusses the various speeds.  I purchased two NEW CAN RS232 uVCCM adapters off eBay.  https://goo.gl/6nShzN (https://goo.gl/6nShzN) Two adapters, two power supplies and shipping for $12.95.  These are a couple of generations old, but are new in the box, never used. The current version is $122 each https://goo.gl/8HOmx9 (https://goo.gl/8HOmx9)  Neither the ones I bought, nor the new ones come with cables, but (taking care about pinouts) cables can be had for about $25 https://goo.gl/r2cYpV (https://goo.gl/r2cYpV) These are premium quality connectors, distributed by GridConnect who has really good tech support and is here in Naperville.

There is a second way to connect, much cheaper, but with some significant limitations.  You can use an Arduino (a single use, single board computer, under $10 https://goo.gl/r2cYpV (https://goo.gl/r2cYpV) )  and a SparkFun shield  https://goo.gl/jDK5a9 (https://goo.gl/jDK5a9) .  BTW, the SparkFUN OBDII info page has a really succinct description of the various CANbus protocols.https://goo.gl/xK8crB (https://goo.gl/xK8crB)

Now both of these solutions hook a computer (in one case a laptop, in another case an Arduino or Pi) to a DB-9 port.  What you have in your car, under the dash is an OBD-II connector, also called a Data Link Connector (DLC).  You just need an OBD-II to DB-9 cable.  What no one tells you clearly is that while the pin configuration of the OBD-II connector is well known, there are at least two common ways to configure the pins on the DB-9.  To get CANbus signals all you need is a CAN-H, a CAN-L (high and low) signal and a ground.  There is a standard for putting CANbus signals on a DB-9, called CiA, and the Grid Connect uses pin 7 and pin 2 of the DB-9 for CAN-H and CAN-L.   But all the arduino shields and raspberry pi shields use a different scheme, where pin 3 and pin 5 are CAN-H and CAN-L.  So you have to be careful to purchase the OBD-II to DB-9 cable that goes with your particular communication pinout.  And no one tells you this.  Fortunately, each of these two systems have some advantages.  The true CAN-RS232 adapters (Grid Connect and others) are designed to capture mounds and mounds of data off the CANbus, and you have to filter out the stuff you don't want.  This is MUCH easier in Linux than in Windows, but certainly possible in either.  The Arduino shields are not anywhere near as fast, but can capture what you want.  Both can issue commands to the BUS, but much of the Arduino software is written so as to do very little in writing.  Make the temp gauge move, or the speedometer, or clear trouble codes, but if you want much more than that, you will have to learn CANbus and write things yourself.  The software you can use on a Linux laptop is much beyond the Arduino and allows you to do most of what you want. 

So we have two systems to approach the CANbus, one more powerful and more expensive, and one capable of capturing data at a relatively inexpensive cost. 

I started by saying the manual from GridConnect for the adapters that I bought is a great tutorial.  Nicely written, and very practical.  I can give you a copy of that (pdf) if you would like.   The second great resource, and also a great read is "The Car Hacker's Handbook." https://goo.gl/YctY8D (https://goo.gl/YctY8D) You can download the book, and you will find it a well written resource.  You will also want to follow the author's YouTube videos, starting with, https://goo.gl/UNlCXg (https://goo.gl/UNlCXg)  I'll bet you will want to watch a number of his videos, as he makes it seem easy.

Title: Re: Inexpensive ways to Approach Vehicle Communications
Post by: simon.gibson on March 03, 2017, 07:34:49 AM
I am very familiar with the gridconnect products - I use boat loads of them as a controls engineer!

Title: Re: Inexpensive ways to Approach Vehicle Communications
Post by: rich.carroll on March 03, 2017, 08:04:52 AM
Yes, I thought $12.95 for two adapters, two power cords, and software was a really, really good price.  And Free Delivery, no less.