Git Product home page Git Product logo

arduino-can-reader's Introduction

Arduino CAN bus sketch

This sketch reads CAN data using a CAN bus shield (or any MCP2515 based boards) and outputs it over the serial interface.

It requires the CAN bus shield library from Seeedstudio.

You can use this Python script I wrote to display the data in a more readable format.

Configuration

Make sure the variables at the top of the sketch are correct for your usage.

  • CS_PIN should be set to the chip select pin for your board (leave to 9 if you have the latest CAN Shield from Seeedstudio)
  • SERIAL_SPEED is the speed of the serial interface. Make sure it matches the settings of whatever software you're using to read the data
  • CAN_SPEED should be set to the speed of the CAN bus you're connected too (possible values).

Be careful, setting the wrong speed can mess with the CAN bus. I once set the wrong speed when connecting it to my car and my dashboard lights went crazy! Restarting the car solved the problem, but in any case, use at your own risk.

If you're not using Seeedstudio's shield you may have to tweak the library to make it work. I had another MCP2515 board and could not make it work with Seeedstudio's library. This was due to the oscillator's frequency. Seeedstudio's shield uses a 16Mhz oscillator, whereas some boards use 10Mhz or some other value. So you need to use Kvaser's bit timing calculator and change the CFG1, CFG2 and CFG3 variables for your bus speed near the bottom of mcp_can_dfs.h.

arduino-can-reader's People

Contributors

alexandreblin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.