CAN Bus with Arduino Mkr Zero

CAN Bus on Arduino is not some new topic. There are many options for Arduino Uno, Arduino Mega or Arduino Due. However, since the release of the Arduino Mkr Zero, it’s especially interesting due to the power being packed in a small form factor board. Arduino also releases a CAN shield for the Mkr which this post is about.

Required Hardware:

  • Wires/Jumper Wires

Set up

  • Install 2 wires to CAN HIGH & CAN LOW port of the shield
  • Optional: the ground & V-in port on the CAN shield can be used to supply power for the whole module.
  • Stack the CAN shield onto the Mkr Zero
  • Insert Micro-B USB to the Mkr Zero and connect to PC (to power and upload codes)

Arduino IDE (If first time working on Mkr Zero)

Besides the Arduino IDE that you can download & install from the Arduino website. There is extra program from board manager to help recognize the Mkr when working offline with the IDE. Instruction can be found here.

The codes

Thankfully to the generousness of the contributors in opensource world. This library

https://github.com/sandeepmistry/arduino-CAN

works out nicely with the module.

  • Install the library per instruction in the README of the github repo.
  • Use the example scripts in examples folder to test read/write CAN messages from the Mkr zero module to another CAN device.
  • Make sure the two device have the same baudrate in order to communicate successfully.
    In Arduino library, CAN baudrate is set at line
CAN.begin(500E3) # This is to set device to 500K baudrate

*** Disclosure: As an Amazon Associate I earn from qualifying purchases. ***

Thank you for visiting. I love to keep my website efficient with useful content. I personally use and test all hardware items mentioned in this website. You can feel free to drop a comment if having questions.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s