Last month I bought a CAN shield from Sparkfun in order to display gas mileage statistics in realtime for my OBD2-compatible car. I could not find a CAN library the did what I needed written in English, so I decided to write my own from scratch. I thought I would share it, in case it might be useful to anyone else.
The library has the following functions:
static boolean initCAN(int baudConst);
static boolean setCANNormalMode();
static boolean setCANReceiveonlyMode();
static boolean receiveCANMessage(CANMSG *msg, unsigned long timeout);
static boolean transmitCANMessage(CANMSG msg, unsigned long timeout);
static byte getCANTxErrCnt();
static byte getCANRxErrCnt();
static long queryOBD(byte code);
It includes a tested example to display miles per gallon on an LCD display (I have been using this in my car for the past several weeks).
I´m sorry,it´s in spanish. It´s not a proper library, it´s an explanation how to use MCP2515 and the basic functions needed.
I´ve some links to code and hardware.... I´ve just added a link to your library!
DaveAK, if you also have a library, please let me know the link and I could add. There are no many projects with CAN bus and Arduino.
Igor, I like your LCD display! Bet its expensive though. I have the Sparkfun Nokia knockoff as well, but it is too small to display multiple parameters at a time so have not used it with OBD.
Hi,
I've used a NewHaven Display => www.newhavendisplay.com/
It's very big and cool!!!! ;D I don't remember, but something less 70 dollars.
I've choosen one based on T6963 controller. I bought directly from this web.