MCP2515 CAN Bus Module Tutorial with Arduino and Linux

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 เม.ย. 2023
  • In this video, I demonstrate how to use the MCP2515 CAN Bus Module to transmit data from an Arduino that's connected over SPI to a CAN receiver connected to my Linux virtual machine.
    [MCP2515 CAN Bus Module]
    www.amazon.com/dp/B07J9KZ4L4?...
    [Arduino MCP2515 CAN library]
    github.com/autowp/arduino-mcp...
    [USB CAN Converter Module]
    www.amazon.com/dp/B07P9JGXXB?...
    [Setting up a Linux VM with CAN tools]
    • Getting started with S...
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 30

  • @aurothschild
    @aurothschild ปีที่แล้ว +8

    This guy CAN do it all!

  • @Bravo_L
    @Bravo_L 2 หลายเดือนก่อน

    Thank you boss! I'm 1st year out of school and I'm making a can bus reader and I'm going to shoot data to a screen and display rpms and other vehicle data. I will use esp32 as well as a stm32. I want to try using this chip as well as trying the onboard controllers and i will do what you did in the esp32 video and use just transceiver(the stm32 nucleo has built in "bxCan"). I need to buy you a coffee or something!!!!!! very helpful as well as the article you shared from circuit state saved my life!

  • @stevecarlisle3323
    @stevecarlisle3323 ปีที่แล้ว +1

    Thanks for producing theses videos. My interest is producing can obd2 messages from engine sensors on esp32, so that Android with Tourque app can display on tablet. I have been using a ObdLinkMX+ for years on my daily driver truck, so that is helping me learn. Thanks again

    • @EV_engineer
      @EV_engineer  ปีที่แล้ว

      Good to know, thanks for sharing!

  • @benhetland576
    @benhetland576 5 หลายเดือนก่อน

    1:33 Here's probably an interesting twist to the CAN bus set up on Linux: Instead of this _specific_ CAN-to-USB converter, which appears to be automatically recognized by socketcan, use an Arduino with MCP2515 to act as such a device. The Arduino already has the USB serial line to the PC that many of these devices actually use, so it's primarily about implementing a protocol that Linux already understands. Then it "just" needs to forward any message received from the MCP2515 (i.e., from the CANbus) to the PC via the serial link, and vice versa. One can probably tweak the Linux side to accept the USB device ID that the Arduino uses, because I don't think you really can control that on the Arduino.

  • @palanik1960
    @palanik1960 5 หลายเดือนก่อน +1

    Can you please present any project you made Canbus data displayed in nextion touch screen as desh

  • @deemorris7229
    @deemorris7229 5 วันที่ผ่านมา

    Good day to you so I am seeking to make a custom gauge cluster using master slave combo with uno r3 and mega r3. I want to connect to combination meter to the OEM gauge cluster for my 2006 honda cbr1000rr... Will make a tutorial on how to connect for the master to read the can bus from the meter send that data to the slave and the slave display it on a tft, hmi, or oled screen?

  • @NOT_JON
    @NOT_JON ปีที่แล้ว +1

    Hey, I really liked the video! Me and my friends are working on a similar system with a raspberry pi pico for a couple months now. We are trying to read an 8byte address from a car’s ecu. Do you know if the library can be edited to have that 8 byte address and if the CAN module with the MCP2515 and the TJA is able to convert from CAN to SPI (essentially reading CAN onto a microcontroller) if you can help, we’ve been suffering through the months with many many dead ends, and we’ll love if you could :)))))))))

    • @EV_engineer
      @EV_engineer  ปีที่แล้ว

      Reading the internal memory of a car’s ECU seems higher level than just the CAN protocol in my opinion. A CAN frame can hold 8 bytes so that should be large enough for a word of that ECU’s memory. I’m surprised you found an ECU with 64-bit addresses though. Whether or not the ECU decides to give out its memory contents sounds like app level logic to me. You may want to check out the XCP protocol over CAN, which sets up an XCP server to forward internal memory state over CAN. It’s used frequently for debugging.

  • @muhammadalfadhil4982
    @muhammadalfadhil4982 6 หลายเดือนก่อน

    Can i change from linux to be a heavy equipmen data ?

  • @renansaraivadossantos2896
    @renansaraivadossantos2896 หลายเดือนก่อน

    How are you reading the transmitted data? Are you using openmoko, is it a software for linux?

  • @allanadams5052
    @allanadams5052 11 หลายเดือนก่อน

    I have a question for you if you don't mind. I'm using a flat screen car radio in my home for music, I'd like to control the volume with the canbus that's on the radio wirelessly, with an esp32 and the Blink app. I just don't know how to built a canbus to make it work. Do you have any ideas that could help me?

    • @EV_engineer
      @EV_engineer  10 หลายเดือนก่อน +1

      Hi, just to clarify, are you trying to connect the car radio to the esp32 via CAN, and then communicate with the esp32 wirelessly over Bluetooth?

  • @kme8134
    @kme8134 5 หลายเดือนก่อน

    You are the best! Thank you. Please come to Uzbekistan and marry my daughter.

  • @user-rk9zx3lt8k
    @user-rk9zx3lt8k 10 หลายเดือนก่อน

    HI thanks for your video, I watched again and again, and I tried by myself, one question about MCP2515 library, because I need send a message with RTR, but in the example code, I did not find the rtr option, did you face the same problem and solve it? thanks!!

    • @EV_engineer
      @EV_engineer  10 หลายเดือนก่อน

      Hi, I tried looking through this library to find a setter for the RTR bit, but I can't find one. You can do this yourself manually though. The Remote Transmission Request (RTR) bit is part of the frame identifier for standard (11-bit) and extended (29-bit) frames. To set the RTR bit manually, you'll need to modify the can_id field of the CAN frame struct. Specifically, you'll set the RTR bit in the identifier to signal that the frame is a remote request. For an 11-bit identifier: the RTR bit is typically bit 12 (counting from 0) in the Frame ID. For a 29-bit identifier: the RTR bit is usually bit 31 (counting from 0) in the Frame ID.
      For example,
      frame11.can_id |= (1

  • @kylenorseth890
    @kylenorseth890 ปีที่แล้ว +1

    I'm trying to use this Arduino to CAN, to send a message to an automotive module. Any chance I could get some help? I've done the setup you show but the CANInterpreter isn't seeing the messages.

    • @EV_engineer
      @EV_engineer  ปีที่แล้ว

      It’s quite common for CAN nodes to have acceptance filters. These essentially filter out CAN ID’s that the ECU doesn’t care about. Could be part of your issue

  • @Explore-Gobal
    @Explore-Gobal 11 หลายเดือนก่อน

    I've seen how two Arduinos with two MC2515s communicate between each other, but not sure how your setup works? In my project, I installed VB with Ubuntu and extensions in Win10. Installed Can-Utils and have my Arduino and MC2515 running a sketch that compiles, uploads, and runs in VB. In the Ubuntu terminal window, lsusb returns the following: Bus 002 Device 003: ID 2341:0043 Arduino SA Uno R3 (CDC ACM), however, when I type ip link ls, the Arduino isn't listed and no Bus0? Next I tried "sudo ip link set up can0 type can bitrate 500000". After asking for my password, I get "Cannot find device "can0"." How do I initialize can0? Thanks

    • @EV_engineer
      @EV_engineer  10 หลายเดือนก่อน

      Hi, are you also using a USB to CAN converter?

  • @anush_udupi
    @anush_udupi ปีที่แล้ว +1

    I have a doubt with cross compatibility between 3.3V microcontroller transreciever Physical layer and 5V microcontroller I have used MCP2515 with Arduino
    Is it going to be problem If I use another node with 3.3V transreciever with MCP2515 module
    One of your earlier videos had TJA1050 needed power recycling
    Is there fixes as this is deal breaker
    For Permanent designs

    • @EV_engineer
      @EV_engineer  ปีที่แล้ว

      Can Hi and Lo swing from 2.5V to 3.5V and 1.5 V respectively, regardless of which transceiver you are using. You may or may not need a TTL level shifter between the microcontroller and the transceiver. Completely depends on what components you are using

    • @anush_udupi
      @anush_udupi ปีที่แล้ว +1

      @@EV_engineer Thank you

  • @user-rk9zx3lt8k
    @user-rk9zx3lt8k 11 หลายเดือนก่อน

    sorry, I am not familiar with spi.h, I using mega, but I dont know how to connect with 2515, which pin should connect with?

    • @EV_engineer
      @EV_engineer  10 หลายเดือนก่อน

      The mega has dedicated SPI pins, just look at the pinout diagram

  • @sanjayns9462
    @sanjayns9462 2 หลายเดือนก่อน

    Hello @EV_engineer, thanks a lot for this video, but I USB-CAN-A with me instead of the device that you have used, could you please let me know how to do the same project with my device, thanks in advance :)

  • @FreestylerAlbert
    @FreestylerAlbert 3 หลายเดือนก่อน

    tricky question, is ths possible?? :
    So car ECU ----> Arduino Nano33 ----> MCP2515 ------(can I connect the processed data back to the Arduino Nano 33??)---> And I want to push all processed data via Wifi ---> my phone
    Is this possible? :D
    (background: I want to process the ECU logs form my car, and have a realtime view on oil temp and things, I have a CANbus translator cript from the ECU already. And have a phone app which can process the CANbus data.)
    Million thanks!!!!

  • @user-rk9zx3lt8k
    @user-rk9zx3lt8k 11 หลายเดือนก่อน

    will you put 120 resistor ?

    • @EV_engineer
      @EV_engineer  10 หลายเดือนก่อน

      The resistors are built into the CAN modules I used

  • @tba3679
    @tba3679 2 หลายเดือนก่อน

    Ahahah nice video but wow that is a big fuss in the era of iot 😅