CAN Interface


103 posts   Page 3 of 5   1, 2, 3, 4, 5
by Blars » Sun Apr 22, 2012 8:23 pm
USB or bluetooth interfaced GPS devices seem to be more readily available and frequently cheaper than serial ones.  Some of the USB ones use a serial-USB chip.
Posts: 88
Joined: Sun Aug 28, 2011 3:22 am
by vlick » Mon Apr 23, 2012 8:32 am
The Mini Can board is, in my opinion, a good product because it allows to start the develoment phase with MCP2515 immediately and with an already debugged HW.

Instead, the Can Node seems to be a product based on PIC uC: this requires to define on both side a protocol for exchanging data (I2C, Uart, SPI...) and to manage another Firmware/code on the uC side.

In my opinion the solution with MCP2515 is easier to develop.

After completing the developement/debug phase with MCP2515, in order to keep the additional board very small will be possible to design a new layout (with smaller package than DIP used in the Mini Can!) and with also the LS20031 GPS module on the same board.

@Blars

I agree with the cost considerations, but I' would't be  so confident on using BT/USB devices permanently installed on vehicles due to EMC/Power disturbances items: such kind of devices are more sensitive (and the related protocol more complex to reset) in comparison to serial line.
Posts: 12
Joined: Wed Apr 04, 2012 8:35 am
by opentronic » Fri May 11, 2012 4:49 pm
A solution that can be used to interface CANBUS and Raspberry PI is by a Raspberry Pi OT 1V0 extension board, avaible on ebay.

The board uses an MCP2515 controller and a MCP2551 transceiver. Moreover the board provider an RS485 controller and some high power electromechanical relays.

All controllers used in the dev board are compatible with standard linux kernel, and are used in a wide number of ARM based boards likely Raspberry PI.
Posts: 5
Joined: Wed May 09, 2012 11:24 am
by vlick » Sat May 12, 2012 10:33 pm
I had a look at Raspberry Pi OT 1V0 extension board and it seems really interesting.
It's not cheap but it's really the dev.board we'd need for our purpose !

At this point the main problem (for me at least...) is to actual own the pi to install and check the CAN driver, since I've no idea when I'll receive mine.

If someone would have the chance, I'd be very insteresting on knowing the documentation which is given with Pi OT 1V0 extension board, to understand which I/O are used.

vlick
Posts: 12
Joined: Wed Apr 04, 2012 8:35 am
by UnaClocker » Wed Jun 13, 2012 6:03 am
Anyone moving forward on this? If someone can suggest a good chip to use to do the level conversion from 3.3v to 5v and vice versa, I've got these two MCP canbus chips and a couple Pi to try it out on..
Posts: 12
Joined: Sat May 12, 2012 5:48 pm
by gja » Sat Jun 23, 2012 6:14 pm
There is another thread where I referred to this.
Please check there.
viewtopic.php?f=44&t=7027&p=90788&hilit=canbus#p90788
Posts: 22
Joined: Sat Mar 03, 2012 9:24 pm
by Madagaga » Wed Jun 27, 2012 12:14 pm
What about STN 1110 chip ? It could be more simple ?
Posts: 1
Joined: Wed Jun 27, 2012 12:09 pm
by RogerBW » Fri Jun 29, 2012 10:46 am
I'm interested in any progress here. I have a Canbus-equipped car, and it looks as though reading data from the onboard GPS and driving the maxidot display will both (a) need full canbus, not just odbii and (b) be pretty challenging...
Posts: 9
Joined: Fri Jun 29, 2012 7:42 am
by vlick » Mon Jul 02, 2012 10:24 am
From my side I'm still waiting for my Raspberry device: I hope to receive it before September so that I can have some spare time during the Holiday.

vlick
Posts: 12
Joined: Wed Apr 04, 2012 8:35 am
by Jokke » Thu Jul 05, 2012 11:32 pm
Hey,

This looks really interesting project. One think I would like to promote a bit. Megasquirt which was mentioned earlier could be really good development/education platform. It has can support from version 2, it's open and when you plug in the MS simulator board you get pretty cheap ECU + engine simulator to play around with without burning your car down. Just an idea.

I'll be building myself one of these can daughter boards when I receive my RPi at some day and this project takes a leap forward.
Posts: 11
Joined: Tue Jul 03, 2012 3:50 pm
by prodigy7 » Mon Jul 09, 2012 6:11 pm
Hi there!

An CANBUS interface for raspberry pi would be a great thing! It would open a wide range of possiblities for carpc for example.
I hope, it get real!

prodigy7
Posts: 2
Joined: Mon Jul 09, 2012 6:07 pm
by Basti » Fri Jul 13, 2012 8:34 pm
Hi

I'm also quite interested in this project for logging and car-pc reasons.
My abilities with programming are just moderate and sadly I have no experience with driver programming for linux. But electronics and layouting with Eagle is also quite common to me. So I will have a first try with a raspberry 'shield' for interfacing with CAN.

First step I did was developing a kind of functional diagram for the PCB:
CanPi-FunctionalPcbOverview.png
CanPi-FunctionalPcbOverview.png (39.12 KiB) Viewed 2682 times


http://www.flickr.com/photos/21817765@N00/7564084908/in/set-72157630562314824/

There are no power sources considered in this diagram. Also no details about communication lines between the separate ICs. It is just a first overview to discuss.

The main idea is, to have a 'mother shield' connected to the raspberry pi. On this shield there is a CAN controller, a RTC for the logging abilties and a second, much smaller PCB connected i.e. via pin headers. The smaller PCB is just for the CAN transceiver. The isolation is located directly after that smaller PCB. So if anything 'unthinkable' happens, only the transceiver PCB has to be changed quick and easy and the 'mother shield' is left undamaged.
Additionally there is a greyed out option for a GPS part, but I think in the first version there is already enough to handle just with main CAN interfacing.

So if anyone has suggestions for further ICs or functional abilities, please suggest and discuss them here.

I would be glad for any goob idea regarding functionalities and layouting.
Posts: 16
Joined: Thu Jan 26, 2012 8:46 am
by RogerBW » Fri Jul 13, 2012 9:03 pm
I'm much more a software person but my first thought on this is that you might want the option to use a GPS as an RTC - possibly even the vehicle's own GPS if enough data are exposed. Does the CAN controller need to see the RTC directly, or can this be moderated through the Pi?
Posts: 9
Joined: Fri Jun 29, 2012 7:42 am
by Basti » Sat Jul 14, 2012 7:10 pm
Hi Roger

Well as far as I know CAN communication, there are no timestamps transfered anywhere in the protocol (like arbitration data, control data, CRC-field, EOF-data). Except you transmit them in the data-fileds of course.
The CAN controller therefore is not in need of any time data. It is 'just' taking care of the protocol handling.

But there is a need for reliable clock informations when logging is performed.
So the RTC-data goes directly to the Pi.
I'm not sure if the linux CAN drivers are able to add time stamps to incoming/outgoing data.

Do you have any knowledge if the CAN drivers can hand over CAN data with added time stamps to following user software?

The idea to use a GPS module may be possible. But when you are tinkering in a workshop or in your garage, there may be little to none open skies ;)
I will have a look for some GPS modules and if some of them have a built in RTC for read out when GPS signal is missing. Maybe some have even a small coin cell to power a RTC and a storage for last satellite positions.
Posts: 16
Joined: Thu Jan 26, 2012 8:46 am
by RogerBW » Sat Jul 14, 2012 8:19 pm
I'm pretty new to the Linux CAN stuff but I'll take a look.
Posts: 9
Joined: Fri Jun 29, 2012 7:42 am
by jannis » Sun Jul 15, 2012 9:56 pm
When using an USB-based CAN-adapter (from PEAK Systems), the device logs a timestamp for every received frame and that is transfered to the userspace-software via the socketcan network-interface.
Posts: 55
Joined: Tue Jan 17, 2012 3:48 pm
by Basti » Wed Jul 18, 2012 7:08 pm
Sorry for the long reply time. Was quite busy last weekend. But sadly not very much with the project.

Back to topic:
jannis wrote:When using an USB-based CAN-adapter (from PEAK Systems), the device logs a timestamp for every received frame and that is transfered to the userspace-software via the socketcan network-interface.


Thanks for the input. I was reading some summaries about socketcan. I think it is a good basis for the project. I've not much knowledge about this piece of software yet, but i think the timestamps are not integrated because of the (quite expensive) PAEK Systems hardware. I think they are added through a PC-internal system clock. But it would be great if somebody can confirm that assumption.

@GPS-Modules:
Until now I found some GPS modules with a so called "PPS" output (= pulse per second). Every second the module pulses this pin and signals that the next/actual second from the last informations sent via serial interface "is now". It's used to have a higher accuracy becuase the serial output is not the fastest and most accurate.
And some modules have a small battery included to support an internal RTC and store the last known sattelite positions for a new faster sattelite lock.
The only drawback: these modules may be kind of to big for a usage on a credit card sized shield. So I think i will start with a small RTC-IC at first instead of a GPS module.

Next steps I will perform:
Layouting a first version of a CANbus-shield with CAN-controller, RTC, isolation, CAN-transciever, 5V/3.3V power supply.
Posts: 16
Joined: Thu Jan 26, 2012 8:46 am
by jannis » Thu Jul 19, 2012 12:40 pm
Basti wrote:Thanks for the input. I was reading some summaries about socketcan. I think it is a good basis for the project. I've not much knowledge about this piece of software yet, but i think the timestamps are not integrated because of the (quite expensive) PAEK Systems hardware. I think they are added through a PC-internal system clock. But it would be great if somebody can confirm that assumption.


It's like I said: the hardware makes the timestamp. Of course it's not an absolute one since the USB-CAN-adapter doesn't know the current time but it's a relative and high-precise one. You can take a look at their driver's code if you want. And the timestamping is one of the reasons why the PEAK-adapters aren't really cheap.

Basti wrote:Layouting a first version of a CANbus-shield with CAN-controller, RTC, isolation, CAN-transciever, 5V/3.3V power supply.


About the RTC you can have a look at this device:
http://www.ebay.de/itm/130726938768

And for "small" GPS-modules you can take a look here:
http://www.navilock.de/produkte/G_509_e ... anguage=en
Posts: 55
Joined: Tue Jan 17, 2012 3:48 pm
by Wolfram23 » Fri Jul 27, 2012 8:13 pm
Hey guys, great thread. I'm looking to do a Carputer (CarPi) and definitely want OBDII interfacing. In my case, I just want to read from it - get things like MPG, IAT, timing advance, coolant temp, oil pressure, intake manifold pressure, etc.

Firstly, while I like the effort in this thread, I wish it would focus on more OPDII protocols than just CAN. Most cars out there are not CAN compliant - I'm in a 2002 Acura RSX-S which uses ISO9141 (afaik). CAN has only been mandatory since 2008, and as a cheapo computer system, I think the RPi is going to appeal to people that aren't driving modern cars lol.

In that regards, while the MCP2515 is a great CAN chip, why not go with a more "open hardware" friendly STN1110, which is still lightning fast with CAN but also compliant with other protocols? Additionally, it supports the "AT" command set (basically the same as used with modems) so I'm sure programming for it wouldn't be too difficult for someone of moderate skill (not me, sadly). Also, you can get a free sample (1 to 3). I asked for one and apparently it will arrive at my door in a few weeks. Can't beat free.

Finally there's a few hurdles besides just communicating with the RPi. My research is currently at this stage:

-Needs protected power.
Luckily this is covered for us by the STN1110 datasheet. See the datasheet on this page, go to page 12 on the PDF http://www.obdsol.com/stn1110/

-Needs 5V and 3.3V
This should be fairly simple. Use a pair of MCP16323 or similar buck chips after the power protection circuit, as described in the STN1110 data sheet. Additionally, the datasheet on these buck chips layout the ideal setup, just needs a few capacitors.
http://www.digikey.ca/product-detail/en ... ND/2835024
Or buy a pre-fabbed, here's a 5V at any rate: http://www.futurlec.com/Mini_5V_High_Power.shtml

-Needs to interface with the RPi
This is probably the hardest part. Building an STN1110 breadboard shouldn't be too bad, and you can certainly connect the 3 or 4 wires from the ECU directly to the inputs as listed in the data sheet, although it might get messy. Connecting it to the Pi is something else. One option is GPIO pins, possibly using the WiringPi library which is similar to Arduino. A lot of my info comes from researching the OBDuino projects that work quite well.
http://obduino.ca/
http://code.google.com/p/opengauge/wiki ... oInterface
http://www.arduinodev.com/hardware/obd-kit/

Additionally, there is an OBDII UART breakout board available that is compatible with ELM327/STN1110:
https://www.sparkfun.com/products/9555
Although at $50, I hope we can just copy a similar design and DIY. Buying an OBDII interface to RS323 isn't too expensive. This kit includes the cable: https://www.sparkfun.com/products/10769

Alternatively there's a CAN board like this for $13:
http://www.futurlec.com/Mini_CAN_Board.shtml
Only issue for me is the micro controller is the MCP2551 :roll:

From here it's either GPIO or USB interfacing, no idea which would be better nor how to actually accomplish a hand-shake. :(

Here's one small list of OBDII software that might be a starting point, some of it is for Linux:
http://scantool.imechatronics.com/downloads.htm

That's most of what I have right now. Only addition is that it would be awesome to real-time update a 16x2 char LCD (in conjunction with a regular LCD like a 7" touchscreen for in car media and GPS) just like the one shown in one of the OBDuino links.

Since there is talk of GPS, I've done a limited amount of digging. For example here is another Arduino project that data logs both OBD II data and GPS information:
http://www.practicalarduino.com/project ... y-platform

I'd prefer real-time GPS/Navigation, though. I know it won't be easy. It seems like there's a decent selection of USB GPS devices.
There's also a selection of free Linux open source GPS software. I know for sure Google allows use of their maps and such as long as the software is open source. Ideally I'd like to have local maps pre downloaded to remove the need for a 3G component (city/province/state/country/continent/world/whatever you need)
http://tuxmobil.org/linux_gps_navigatio ... tions.html
http://www.fsckin.com/2008/04/06/review ... -packages/

Anyway, I'm really a noob and quite possibly overlooking many important factors, but this thread seems quite promising.
Last edited by Wolfram23 on Fri Jul 27, 2012 8:34 pm, edited 1 time in total.
Posts: 73
Joined: Thu Jul 19, 2012 6:50 pm
by jannis » Fri Jul 27, 2012 8:33 pm
Wolfram23 wrote:In that regards, while the MCP2515 is a great CAN chip, why not go with a more "open hardware" friendly STN1110, which is still lightning fast with CAN but also compliant with other protocols? Additionally, it supports the "AT" command set (basically the same as used with modems) so I'm sure programming for it wouldn't be too difficult for someone of moderate skill (not me, sadly). Also, you can get a free sample (1 to 3). I asked for one and apparently it will arrive at my door in a few weeks. Can't beat free.


Amazing, I didn't know of this chip and I instantly ordered a sample. Thanks for the tip.

Wolfram23 wrote:Since there is talk of GPS, I've done a limited amount of digging. For example here is another Arduino project that data logs both OBD II data and GPS information:
http://www.practicalarduino.com/project ... y-platform

I'd prefer real-time GPS/Navigation, though. I know it won't be easy. It seems like there's a decent selection of USB GPS devices.
There's also a selection of free Linux open source GPS software. I know for sure Google allows use of their maps and such as long as the software is open source. Ideally I'd like to have local maps pre downloaded to remove the need for a 3G component (city/province/state/country/continent/world/whatever you need)
http://tuxmobil.org/linux_gps_navigatio ... tions.html
http://www.fsckin.com/2008/04/06/review ... -packages/


You better take a look at OpenStreetMap then. The maps are better then Google's in some parts of the world and they are 100% free.
Software for navigation using Offline (pre-downloaded) maps can be found in the wiki:
https://wiki.openstreetmap.org/wiki/Rou ... ineRouters
Posts: 55
Joined: Tue Jan 17, 2012 3:48 pm
by Wolfram23 » Fri Jul 27, 2012 8:41 pm
jannis wrote:You better take a look at OpenStreetMap then. The maps are better then Google's in some parts of the world and they are 100% free.
Software for navigation using Offline (pre-downloaded) maps can be found in the wiki:
https://wiki.openstreetmap.org/wiki/Rou ... ineRouters


That's great! Thanks. I'll definitely check it out. Sadly my only way to try stuff on a Pi right now is with QEMU emulation at home, but maybe I'll buy a USB GPS device and see if I can get it to work in that environment.
Posts: 73
Joined: Thu Jul 19, 2012 6:50 pm
by Wolfram23 » Thu Aug 09, 2012 12:53 am
My sample just arrived! Yay for free stuff!

Image

Time to bust my butt and get a BoM made up and order this stuff! :lol:
Posts: 73
Joined: Thu Jul 19, 2012 6:50 pm
by bertr2d2 » Thu Aug 09, 2012 1:49 pm
stn1110 seem to be interesting - but less than 5 bucks you could get a "real" CAN interface:

http://lnxpps.de/rpie
Posts: 87
Joined: Wed Aug 08, 2012 10:12 pm
by Wolfram23 » Thu Aug 09, 2012 2:44 pm
bertr2d2 wrote:stn1110 seem to be interesting - but less than 5 bucks you could get a "real" CAN interface:

http://lnxpps.de/rpie


Not sure what you're getting at. The MCP2515 has been discussed already. The STN1110 is a "real" CAN interface too, but also works with all other OBD II protocols which makes it useful for a lot more people like myself, driving a car older than 2008.

Plus it's free.
Posts: 73
Joined: Thu Jul 19, 2012 6:50 pm
by bertr2d2 » Thu Aug 09, 2012 3:40 pm
Ups - sorry. There are more standards than CAN in a car ...
Posts: 87
Joined: Wed Aug 08, 2012 10:12 pm