niedziela, 26 sierpnia 2012

Controller Area Network (CAN) MCP2515 for Raspberry Pi

Universal CAN communication board for ARM, ATMEL, Raspberry Pi (3.3V and 5V power supply). Open Source project. Please treat this site only as a notebook. Until you see "Everything is ready and fully tested".


Schematic design of PCB board with all components- version 0.1 - incorrect => requires modification

Schematic design of PCB board with all components - version 0.1a  => modification Revised 0.1
Download Schematic design of PCB:
https://docs.google.com/file/d/0B1TmUZoDBigxdlpaMGZKZjNScHc/edit?usp=sharing



Drawing connected CAN board and Raspberry Pi


From left: Top Copper, Top Solder Mask, Top Silkscreen, Bottom Copper, Bottom Solder Mask, Drill Data


Pin Diagram and Pin Description of MCP2515 CAN board Raspberry Pi


Pin Diagram and Pin Description of MCP2515 CAN board for ARM and ATmega microcontrollers

How to Connect Multiple Raspberry Pi CAN Board with CANbus - CAN bus ISO 11898-2 Topology


Case for Raspberry Pi and CAN Board - created on RepRap Open Source 3D Printer
 First CAN Board for Raspberry Pi manufacture in the PL
How many cost one PCB? 3,8 euro ... quite a lot. MCP2515 - 0,85 euro, MCP2551 -  0,68 euro. The rest of the elements ... max 0,5 euro no more. This gives us 5,83 euros. Expander I2C PCF8574 - not necessary - 0,97 euro.
Gerber file (PCB) - CAN Board - 7zip
https://docs.google.com/open?id=0B1TmUZoDBigxcDQza0FwY2R5OUE

what is gerber?
http://en.wikipedia.org/wiki/Gerber_format


Minimal configuration for start with CANbus - 3.3V or 5V
Tabele from MCP2515 datasheet - how to select the resonator and capacitor
Recommended configuration: 16Mhz and 22pF or 10Mhz and 22pF


List of elements in minimal configuration:

Component Value                      Qty
-----------------------------------------------
2WP                                          1
3WP                                          3
4WP                                          1
C 22pF                                       2
C 100nF                                     2
LED_MINI                                   1
MCP2515-X_SO                          1
MCP2551-X_SN                          1
R 0.1W SMTF 0                           1
R 0.1W SMTF 2.2K                      1
R 0.1W SMTF 10                         1
R 0.1W SMTF 100K                     3
R 0.1W SMTF 120                       1
XTAL  16.000 MHZ                       1
----------------------------------------------- 
What is inside?

Version 0.1:


MCP2515 - Stand-Alone CAN Controller with SPI Interface

MCP2551 - high-speed can transceiver

PCF8574 - Remote 8-bit I/O expander for I2C-bus
http://www.nxp.com/documents/data_sheet/PCF8574.pdf



Version 0.1a:

PCF8583 - I2C-BUS COMPATIBLE REAL TIME CLOCK MODULE

24C32 - 32K-bit. 2-WIRE (I2C) SERIAL CMOS EEPROM

TMP100 - temp sensor (I2C), temperaturę range of −55°C to +125°C



Sample "Source Code in Python" for the components on the board:



TMP100

TMP100_Config_Read_Temp.py


Test circuit TMP100 - "T100"


EPROM 24C32


EPROM_24C32_Write_Read.py - 24C16 and 24C64


Test circuit 24C32



PCF8583P

Sample Code:

PCF8583P_getTime.py




PCF8583P_setTime.py



PCF8583P_setTime_fromOS.py



The test circuit PCF8583



more soon...

11 komentarzy:

  1. Hi there

    How can I buy this board? I am interested and can buy immediately 4 or 5 board for testing. I am in USA.

    Thanks
    Khalid
    Email: mail2mehmood@yahoo.com

    OdpowiedzUsuń
    Odpowiedzi
    1. At the moment it is not possible to buy, is being tested. I do not have too much free time. I do not have a sample code for Raspberry Pi which could be share. On request I can pack and send email 7zip all the data board 3d models and links to other software that should compatible.

      Boards can be made from a link on the page:
      Gerber file (PCBs) - CAN Board - 7zip

      In my country, just send these files to the web page, and after 2 weeks of the PCB get delivered to your home.
      https://www.drukowane.pl/
      I do not know any of the companies in the united states. It sure is a lot of them.

      When I finish and test everything in railway vehicles from different manufacturers. Cars. We all share the page, and show a few pieces on eBay. But I have to be sure that it worked well.
      The main objective of the project was to be the the recorder with the option of filtering CAN signals and diagnosis, and emergency control of the vehicle.

      Usuń
  2. Hello,

    Why MCP2551 VSS pin is not connected to ground ?

    Thank you

    OdpowiedzUsuń
    Odpowiedzi
    1. guyguy333 you're right ... This bug is easy to fix.

      MCP2551 VSS pin must be connected to GND.

      Thank you "guyguy333". No answer from me could mislead someone. On PCB should do a 2mm-3mm jumper / cross (tin) from MCP2551 VSS pin to GND (in C1 component).

      I'm sorry that so long delayed any response. I really have no free time.

      Usuń
  3. Hello,
    your board looks good :)
    I did one too , but in a little differnet way.
    You use the MCP2551 can tranceiver, the problem with it is, that it needs 5V power supply, the IO Voltage of the Raspberry is 3.3V
    I saw that you use a voltage divider between the MCP2515 and the MCP 2551 but only in the receiver lane.

    My solution is, to take the SN65HVD233, this Can tranceiver needs 3.3V power supply.
    I testet it and it goes very well.
    The pinning is simyler the same to the MCP2551.

    The biggest problem with all these transceiver are, that they do not have any galvanic isolation.
    Until now i don´t have any isolation installed, but i need a solution.
    I think about to take a opto coupler between the Can Controller and the Tranceiver, but for that i need a DC/DC chip for suppling the Tranceiver to.
    I found one all in one wonder Can Tranceiver, it includes the Galvanic Isolation and it usable for 3.3V power supply.
    I Forgot the name of it.
    The Porblem there ist, that it uses a PWM, to genereate the AC voltage to transmit the power...

    Many greetings
    Giosino


    OdpowiedzUsuń
    Odpowiedzi
    1. Giosino Pasquariello you're right. That's what I did from the point of view of Raspberry Pi is a stupid idea. But from the point of view of users using different platforms, it was the only solution to the PCB was universal. From the beginning I was going to use the configuration of SN65HVD233. In PCB is a bug if we use SN65HVD233. In PCB no selective choice of supply voltage for each device 3V3 or 5V. (I know it's not the only bug, MCP2551 VSS pin is not connected to ground, but easy to fix GND is next to the pin 2mm)

      Option I
      MCP2515 - 3.3V Power Supply - operates from 2.7V - 5.5V
      MCP2551 - 5V Power Supply

      Needs resistors to cut voltage on RXD MCP2551 ... R10 - 10K and R11 18K on sheme - to work with Raspberry PI () - aware that the resistors are fallible solution. This trouble free need a DC / DC converter chip for suppling the tranceiver 5V/3.3V on both lines - improving it :)

      Option II

      MCP2515 - 5V Power Supply - operates from 2.7V - 5.5V
      MCP2551 - 5V Power Supply

      No needs resistors on RXD MCP2551 ... work with Atmel Atmega16 5V - dont work with Raspberry PI - dramage Raspberry PI



      Option III

      MCP2515 - 3.3V Power Supply - operates from 2.7V - 5.5V
      SN65HVD233 - 3.3V Power Supply (RECOMMENDED OPERATING CONDITIONS VCC Supply voltage 3 - 3.6 V) not 5V, dont use with ATMEL 5V Microprocesors ATMEGA

      No needs resistors on RXD MCP2551 ... work with Atmel Atmega16 3.3V - and work with RaspberryPI but need 1 cross 3.3V and 5V and No conection CAN-board to RaspberryPI-board pin 5V. If you connect 3V3 and 5V dramege RaspberryPi. If you are using SN65HVD233 Can-board for safety should not be put directly into the connector raspberry, only by of wires.

      I try all the time and I'm learning all the time, forgive me for my mistakes :)

      Usuń
  4. Hello Arthur,
    are there any test results yet?

    I'm very interested in building this "by myself" but I'm a complete amateur and I treat it as my hobby.
    I already have Raspberry Pi (512MB RAM B version), I connected it to Huawei 3131 and Aero2 network, and GPS in my car.
    I use gpsd as basic information platform from GPS and send this info with TCP/IP to my server where I store the data in database.

    It would be great to have info from CAN-BUS about engine parameters, real distance, fuel level etc...

    First of all can you respond to comments about power supply?
    Are those diagrams corrected and I can use them "as is" in drukowanie.pl ?

    Second thing is software.
    Mounting all stuff is not the end... How can I read can info? Is there any software that can do this?

    Best Regards
    MJ

    PS As many of people I'm willing to pay for ready made boadr with debian (rospberian) package ;-) Just name the price ;-)

    OdpowiedzUsuń
  5. Hello,

    There is a ready made board for a reasonable price available at http://www.beyond-kinetics.com/ProductDetails.asp?ProductCode=1827.

    It uses the 2515 chip and is a very similar circuit. It also contains 3 buttons and 4 general purpose LEDs, 2 amp regulator for powering pi off of CAN, etc. Also a GPS connector for EM-406 chip.

    I am the owner of Beyond-Kinetics, we are very small and looking to get some sales. The board has been thoroughly tested and is 100% functional.

    Best regards and I hope to hear from you.
    Steve Tenniswood

    OdpowiedzUsuń
    Odpowiedzi
    1. How about international shipping? I see no option to select other country than US.

      Usuń
  6. This is very similar board to http://www.cooking-hacks.com/documentation/tutorials/can-bus-module-shield-tutorial-for-arduino-raspberry-pi-intel-galileo

    OdpowiedzUsuń
  7. I'm quite new to everything related to hardware but I believe another solution for the 3.3v - 5v might be add a Level Translator for the RPi SPI connectors, something like that: http://www.newark.com/pdfs/techarticles/microchip/3_3vto5vAnalogTipsnTricksBrchr.pdf (page 33).

    You simply suply 5V to the MCP2515/51, including the Level Translator side that connects to the MCP2515, the other side of the LC, the one that connects to the MCU SPI pins, you could have a DIP Switch to select 3.3v or 5v power, according to the MCU used.

    Does that makes sense?

    OdpowiedzUsuń