neilnegm
Posts: 1
Joined: Fri Aug 10, 2012 6:14 pm

Re: CAN Interface

Fri Aug 10, 2012 6:16 pm

There is a hobby guy who hooked up his prius to a linux laptop.

http://www.vassfamily.net/ToyotaPrius/CAN/cindex.html

Basti
Posts: 16
Joined: Thu Jan 26, 2012 8:46 am

Re: CAN Interface

Sun Sep 23, 2012 5:27 pm

Hi all

it has been a while since my last post, but finally I finished a prototype schematic and board layout. It is a small footprint CAN extension board for the Raspberry Pi.
Inspiration came from Gerhard Bertelsmann who posted his tinkering plans for his model railway and is very active in the CAN extension development (http://lnxpps.de/rpie/; thanks Gerhard)
All parts in my layout are through whole so it should be quite easy to solder. I personally soldered a first version on a piece of prototyping board.
Be advised that it is not tested yet!

I'm compiling a kernel with included CAN, SPI and MCP251x support at the moment.
(Good starting point for that is this topic: http://www.raspberrypi.org/phpBB3/viewt ... =44&t=7027; thanks to all users there)

Here are the eagle files for the DIL-Version of my extension board:
CanPi.zip
(39.73 KiB) Downloaded 851 times
When I have tested the board I will give an update if all is working.

When everything works fine I will transfer the DIL layout to a SOP layout. And maybe there will be some more functionalities added like a real time clock, a GPS extension and/or other functionalities.

Greetings,
Basti

Basti
Posts: 16
Joined: Thu Jan 26, 2012 8:46 am

Re: CAN Interface

Tue Oct 02, 2012 11:27 am

Hi

as it turned out my layout has some wrong/missing connections.

For those who have already started to work with the design:
- Missing 'Output enable' at the buffer.
- Twisted MOSI/MISO-Lines at RP-GPIO pins.
- MCP's 'chip select' signal at RP-GPIO should be pin 24 not 26.

I will correct that and post an update of board and schematics when it's finished.

Basti

ouzo
Posts: 1
Joined: Sat Oct 06, 2012 10:56 am

Re: CAN Interface

Sat Oct 06, 2012 11:00 am

Really looking forward to this project, keep up a good work!

Basti
Posts: 16
Joined: Thu Jan 26, 2012 8:46 am

Re: CAN Interface

Fri Oct 12, 2012 7:40 pm

Hi ouzo

Thanks for your support.

I will be posting an update for the layout maybe this weekend.
With a little support from this thread http://www.raspberrypi.org/phpBB3//view ... &start=125 I discovered another flaw of the actual design and I am testing an update right now.

Greetings,
Basti

Basti
Posts: 16
Joined: Thu Jan 26, 2012 8:46 am

Re: CAN Interface

Sat Oct 13, 2012 6:49 pm

Hi

I've finished a second revision of the 'CanPi' extension board.

It features:
- MCP2515 for CAN-controller
- MCP2551 for CAN-transceiver
- 74HX244 buffer for basic protection of the Raspberry Pi (similar to Gert Board)
- 7805 voltage regulator (enabling 12V/13.6V input for supply of MCPs and buffer for usage of CanPi in cars)
- A pin header for enabling a 120 Ohm termination resistor on canbus inputs.


I have succesfully interfaced the board with my Raspberry Pi and was able to get a CAN0 network socket interface up in my Raspbian linux.

BUT I haven't tested the board with an actual canbus for recieving and sending can messages. I'm going to confirm the correct functionality maybe on monday at work.

If you wan't to use the CanPi you have to compile a appropiate kernel.
Be adviced to modify the BCM2708.c file before you compile to use GPIO 17 for MCP 2515's interrupt signal and for the quarz frequency you use on the CanPi (I'm using 20MHz in my layout, but other values should be possible).

If you find any flaws in the layout/schematics you are very welcome to give a hint.
Also any other hint/advice to the project is very welcome.

A last advice:
You are using the schematics and layout on your own risk!
Espacially when interfacing with your car!
I'm not responsible if you are damaging your Pi or any other hardware/software you connect with the CanPi extenion board!


Here the Eagle-Files for CanPi with DIP-ICs:
CanPi_v0_2.zip
(46.34 KiB) Downloaded 725 times
CanPi_Rev0_2_schematic.png
CanPi_Rev0_2_schematic.png (23.65 KiB) Viewed 17216 times
CanPi_Rev0_2_layout.png
CanPi_Rev0_2_layout.png (30.83 KiB) Viewed 17216 times
I tried to work out the layout in a way that it should be possible to solder it also on a prototyping board.
I think further developments and board versions are going to be developed for SMD parts.

Greetings,
Basti

Basti
Posts: 16
Joined: Thu Jan 26, 2012 8:46 am

Re: CAN Interface

Wed Oct 17, 2012 7:55 pm

Hi again

finally I had the opportunity to verify if the above canbus extension board is working.
And I'm very glad to confirm full functionality.
I was able to communicate with an automotive ECU and a professional canbus network analyzing software.
Recieving and sending can frames worked flawlessly. I didn't have the time for testing the limits in recieving and transmitting with a high bus load, but for the home/hobby sector the above solution should be a cheap and relatively easy start point.

Greetings,
Basti

maw_hn
Posts: 2
Joined: Fri Aug 24, 2012 1:34 pm

Re: CAN Interface

Wed Oct 31, 2012 5:03 pm

Hi all together!

I am currently trying to get SocketCAN running on Raspbian (Virtual CAN in the beginning, later using the PEAK PCAN USB-Dongle).

Is it really necessary to compile the kernel? Is there no other way?

Greetz,
MAW

Basti
Posts: 16
Joined: Thu Jan 26, 2012 8:46 am

Re: CAN Interface

Thu Nov 01, 2012 11:26 am

Hi maw,

as far as I know you will have to recompile. Or you get a kernel somewhere else compiled with the correct options for canbus communication and for the hardware drivers you want to have supported.

It's not that tricky to compile a kernel by yourself. It just takes a couple of hours when you do that on your Pi.
I've posted a link to a compiling howto some posts above.

Greetings,
Basti

radioelf
Posts: 62
Joined: Mon Sep 03, 2012 1:14 pm
Location: España
Contact: Website

Re: CAN Interface

Mon Nov 05, 2012 8:41 pm

Hello, I'm thinking about making this interface, what do you think?

Image

Image

Basti
Posts: 16
Joined: Thu Jan 26, 2012 8:46 am

Re: CAN Interface

Wed Nov 07, 2012 7:13 pm

hi radioelf

schematic looks good in general (connections, pinning, etc.).

But I have some questions:

- C11: Why 10uF? For filtering purposes such a high value is not specifically necessary. Would drain a high current at first charging. Maybe too much for the Pi/USB power source if you plan to connect it directly to the 5V line of the Pi.

- R6 / R7: Again, very high values. It's possible that the signal lines are not recharged fast enough due to the small current resulting from the high resitance. 1k is more than enough for the purpose imho (means 3,3 mA for recharging per line).

The rest looks fine for me.

Much fun with playing around with the CAN.
What do you plan to do with your interface?

Greetings,
Basti

radioelf
Posts: 62
Joined: Mon Sep 03, 2012 1:14 pm
Location: España
Contact: Website

Re: CAN Interface

Thu Nov 08, 2012 4:35 pm

Hi Basti, thanks for the comment.
-The C11 would have to be in the board "GPIO adapter", but already in use.
-OK, R6 / R7 1k or 10K maximum.
-Learn first and if possible to design access remote equipment at home to monitor the current draw, voltage input, etc. (home monitoring through web ...)

Image

more information: http://radioelf.blogspot.com.es/ Sorry, only in Spanish

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: CAN Interface

Thu Nov 08, 2012 6:22 pm

radioelf wrote:Hi Basti, thanks for the comment.
-The C11 would have to be in the board "GPIO adapter", but already in use.
-OK, R6 / R7 1k or 10K maximum.
-Learn first and if possible to design access remote equipment at home to monitor the current draw, voltage input, etc. (home monitoring through web ...)

......
more information: http://radioelf.blogspot.com.es/ Sorry, only in Spanish
Consider dropping R1 and R2 about 2k or 2k2. Will give you squarer edges hwen scoped as well :)

4k7 for I2C is good for short cables runs with very low capacitance, lower pullup values should be used for longer cables and higher capacitance.

This would also mean it will be more tolerant of whatever you connect to it. I lowered my pull ups on my GPIO adapters (see facebook in sig), to cope with longer runs. The Pi internally uses 1k8 for the 3v3 I2C lines as well.
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

radioelf
Posts: 62
Joined: Mon Sep 03, 2012 1:14 pm
Location: España
Contact: Website

Re: CAN Interface

Fri Nov 09, 2012 2:30 pm

Hi techpaul, Thank you for explanations.

jagoda
Posts: 40
Joined: Fri Nov 02, 2012 8:46 am

Re: CAN Interface

Sun Nov 11, 2012 5:06 pm

Hi this can be done roughly as follows ...
Install Xenomai on your raspberryPi ... http://www.blaess.fr/christophe/2012/08 ... pberry-pi/ (its in French ... but you don't need to be that fluent in French to make sense of it).
Install the CAN drivers for Xenomai from DENX ...
ftp://ftp.denx.de/pub/xenomai/rtsocketcan/ - which uses a sockets API
There are plenty of Microchip boards etc. that support can - both SPI can controllers, and
PIC controllers with CAN (and also LIN) on the chip ...
I've not yet had time to adapt code working on other Linux embedded systems to the RaspberryPi, but now that I have come across this thread ... will plan a RaspberryPi with CAN 2 day workshop
Keep a lookout on http://www.absolutebeginners.uk.com

TuxPalm
Posts: 1
Joined: Wed Nov 28, 2012 9:52 pm

Re: CAN Interface

Wed Nov 28, 2012 10:06 pm

Hi,

maybe could you use a CAN transceiver from NXP http://www.nxp.com/products/automotive/ ... /#products the control is done by RX/TX and the power supply is 5V.

Regards,

WimVO
Posts: 2
Joined: Sat Jan 12, 2013 6:46 pm

Re: CAN Interface

Sat Jan 12, 2013 7:31 pm

Does anyone know where one can find the kind of things one could control with a Pi plugged into the CAN bus of a Volkswagen Golf ?

I'm currently thinking of Cruise Control and maybe the infotainment screen would be fun too, but I have really no idea what CAN even is, let alone what it can and cannot do.

Zeta
Posts: 72
Joined: Wed Dec 12, 2012 9:51 pm

Re: CAN Interface

Sat Jan 12, 2013 11:35 pm

WimVO wrote:Does anyone know where one can find the kind of things one could control with a Pi plugged into the CAN bus of a Volkswagen Golf ?
Google is a good start:
http://hackaday.com/2011/04/26/enhance- ... s-hacking/
WimVO wrote:I'm currently thinking of Cruise Control and maybe the infotainment screen would be fun too,
Take care of what you try to do. Make if fun, but safe !
WimVO wrote: but I have really no idea what CAN even is, let alone what it can and cannot do.
Google have a lot of information :
http://www.volkspage.net/technik/ssp/ssp/SSP_269_d1.pdf
http://www.volkspage.net/technik/ssp/ssp/SSP_238.pdf

Take also a look at OBD. It is a common interface for diagnostic plugs, that is based on CAN. Don't know if the Golf uses it.

WimVO
Posts: 2
Joined: Sat Jan 12, 2013 6:46 pm

Re: CAN Interface

Mon Jan 14, 2013 2:59 pm

Zeta wrote:Google is a good start:
http://hackaday.com/2011/04/26/enhance- ... s-hacking/
I thought I had done some searching but I guess I was too focused on the Raspberry Pi, which is not always involved. What was interesting in that post is that it seems to claim there is more than just one bus going through the car. Currently I have only knowledge of one connector sitting under my steering wheel and that's indeed only supposed to be used for diagnostics. So maybe I'll have to go looking for other busses elsewhere for what I'm trying to do.
Zeta wrote:Take care of what you try to do. Make if fun, but safe !
That will be the tricky part. Cruise control can be turned on and off manually, and eventually it can be set to a certain speed. There are only a few common used speed limits in my country, so I was hoping I could install a set of buttons that would allow me to pick one of those predefined speeds, rather than manually adjusting until I reach one. Ofcourse the moment I brake or otherwise disengage the cruise control, any attempts to adjust it's speed should cease immediately.
I was hoping to be able to get a view of all the information that regularly passes over the bus, without having to purchase a bus sniffer. Maybe I will find that in the PDF's you linked. Thanks for that.
Lastly, when my navigation system is on, it may show an icon in the top left corner mentioning the speed limit that counts for the stretch of road it thinks I'm on. Should I be able to read that value I may be able to do things like give an audio warning if my cruise control speed does not match the given speed limit, or maybe even adjust it down for me if it looks like I'm going too fast. Assuming I can read information off the screen.
I know this is not strictly raspberry pi related, but I'd rather know for sure I will be able to succeed before I start building/buying some of the CAN bus reading hardware like mentioned in this thread to go with my Pi.

Zeta
Posts: 72
Joined: Wed Dec 12, 2012 9:51 pm

Re: CAN Interface

Mon Jan 14, 2013 7:31 pm

WimVO wrote:I guess I was too focused on the Raspberry Pi, which is not always involved.
Yes, the part you are trying to find is only the CAN bus protocol for this specific car. This has nothing to do with the RaspberryPi.
Maybe search more on car tuning forums, or sites like that, that have more car-related information.
WimVO wrote:I was hoping to be able to get a view of all the information that regularly passes over the bus, without having to purchase a bus sniffer.
The raspberry pi with the can driver IS a bus sniffer, so you don't need to buy costly hadware, you only need two chips, one oscillator, 2 capacitor, some resistors and a breadboard (10$ ?).


Your project looks great, it's a nice idea.
If you cannot find the information from the navigation system of your car, then plug a GPS in the raspberry pi, put a screen, and use openstreemap to do the navigation from the Pi, connected to the can-bus, for display of car status, and to control it ;).
However I don't know if they have the speed limits in openstreemap database ?

Annesville
Posts: 6
Joined: Wed May 23, 2012 12:51 pm

Re: CAN Interface

Tue Jan 15, 2013 5:24 am

I've been collecting canbus related links here for some time. You may find one or two useful ones.

https://delicious.com/nicolasn/canbus

plugwash
Forum Moderator
Forum Moderator
Posts: 3431
Joined: Wed Dec 28, 2011 11:45 pm

Re: CAN Interface

Thu Jan 17, 2013 7:33 pm

Gert van Loo wrote:If I recall: you can drive 5V logic from 3V3
Depends on WHICH 5v logic. "TTL compatible" 5V CMOS will be fine. Real TTL will be ok voltage wise but you have to watch that the 3.3V side can drive enough current. 5V CMOS devices that are NOT advertised as TTL compatible are likely to be maginal when fed from 3.3V logic, they might work they might not, devices with schmitt trigger inputs are especially likely to be problematic.

syndicate
Posts: 50
Joined: Tue Jul 31, 2012 5:19 am

Re: CAN Interface

Tue Jan 22, 2013 8:56 pm

A little late on this post but for those of you still interested in developing solutions for OBD and communicating to the car, there is a development board that may be of interest. It even has power save options so you could run this thing for weeks on a car battery. As far as the RPI and using a 3G dongle PM me for the solution. I worked out a Linux Image step by step that will allow you to plug in a 3G dongle and use a dial program. The development board will allow you to plug your own bluetooth module up to it and is compatible with the

https://www.sparkfun.com/products/10393(bluetooth mate).

It has a standard FTDI USB to serial port that allows for a simple terminal connection to the STN1170 chip from: http://www.obdsol.com/

The power modules has power saving features and allows for 12V, 12V switched, 5V, 5V switched, 3.3V, 3.3V switched, and 3.3V_2 for external connections. The board can be powered from the car or be powered from a 12V AC adapter. Uses filtering PTC and TVS circuits and a 5V switching regulator with low quiescent current.

Supports single wire CAN, medium speed CAN, high speed CAN, ISO, and J1850 protocols. That includes OBDII and some non OBDII protocols.

If any of you are interested in a development board please let me know. These boards are still under QA testing but are so far functional :)

Image
Image

enfox
Posts: 1
Joined: Wed Feb 13, 2013 11:40 pm

Re: CAN Interface

Wed Feb 13, 2013 11:42 pm

very interested, how can one get their hands on one?

kjarke
Posts: 1
Joined: Mon Feb 25, 2013 10:16 am

Re: CAN Interface

Mon Feb 25, 2013 10:37 am

I would be very interested in the CAN adapter for marine applications to get NMEA2000 data onto a tablet computer either via USB or wifi. I guess both would be possible with the pi.

The thing with NMEA2000 is that it is a very closed standard and official certifications is quite expensive. They even want money from app developers to display the data. NMEA2000 to something else bridges are also supposed to be certified. This open source approach would be awesome ;) !

The ideal adapter would have 2 CAN interfaces plus one RS422 + a 12V power supply. The second CAN bus would be useful for a 2nd network on the boat which is not NMEA2000 (J1939 from engines for example or CANOpen). RS422 is used for an older NMEA0183 which is still common for GPS. With these interfaces you could easily replace several $1000 worth of equipment. You could do J1939 to NMEA2000, NMEA0183 to NMEA2000 and all of that to and from wifi or USB! I might check if there are enough interrupts available for 2 CAN controllers plus CS lines. I just started to get my head around the pi today.

Return to “Other projects”