Interfacing SH-C30L USB to CAN Adapter With Arduino UNO

by Rachana Jain in Circuits > Arduino

110 Views, 0 Favorites, 0 Comments

Interfacing SH-C30L USB to CAN Adapter With Arduino UNO

How to Use a USB to CAN Bus Adapterjpeg.jpg

CAN (Controller Area Network) is widely used in automotive systems, industrial automation, and robotics for reliable communication between multiple devices. However, accessing and analyzing CAN data using a computer isn’t straightforward, since PCs don’t natively support CAN protocol.

In this project, you’ll learn how to bridge that gap using the SH-C30L USB to CAN Adapter along with an Arduino UNO and the MCP2515 CAN module. This setup allows you to send, receive, and monitor CAN messages directly from your computer.

Whether you're a student exploring embedded systems or an engineer working on diagnostics, this guide will help you build a practical CAN interface system from scratch and understand how real-world CAN communication works.

Supplies

  1. SH-C30L USB to CAN Adapter
  2. Arduino UNO
  3. MCP2515 CAN module

SH-C30L USB to CAN Adapter Overview

doc_pics.png

The SH-C30L USB to CAN Adapter is a compact and budget-friendly tool designed to interface a computer with a CAN network. It is especially useful for students, hobbyists, and engineers who want to explore CAN communication without investing in expensive professional tools.

At its core, the adapter is built around an STM32F072C8T6 with an integrated CAN controller. This design eliminates the need for an external CAN controller chip, resulting in faster communication and reduced complexity. It also includes a CAN transceiver that converts logic-level signals into differential CAN bus signals (CAN_H and CAN_L), enabling reliable communication over the bus.

Key Functional Capabilities

  1. Supports CAN 2.0A (11-bit) and CAN 2.0B (29-bit) frames
  2. Data rates up to 1 Mbps
  3. USB-powered (no external supply required)
  4. Compatible with Linux (SocketCAN), Windows, and macOS
  5. Switchable 120Ω termination resistor
  6. Firmware flexibility (Candlelight, SLCAN, etc.)

Driver Installation and Required Software Tools

⚙️ Why is Driver Installation Required?

When connecting the adapter to your computer, the operating system must identify how to communicate with it.

  1. On Windows 10/11, it usually works out-of-the-box using USB CDC drivers
  2. On Linux and macOS, native support is already available
  3. Manual driver installation is only needed if the device appears as “Unknown Device”

In simple terms, drivers act as translators between your OS and the hardware.

🧰 Required Software Tools

To actually interact with CAN data, you need software tools:

For Linux:

  1. SocketCAN (native CAN framework)
  2. Utilities like candump, cansend, and cansniffer

For Windows:

  1. Cangaroo (recommended open-source CAN analyzer)

For macOS:

  1. Python-based tools or cross-platform CAN utilities

These tools allow you to monitor traffic, send frames, and debug communication.

🐧 Using the Adapter on Linux with SocketCAN

Linux offers a powerful built-in CAN stack called SocketCAN.

  1. With Candlelight firmware, the adapter appears as can0
  2. With SLCAN firmware, a virtual interface is created using slcand

Once configured, you can:

  1. Monitor traffic using candump
  2. Send frames using cansend

This makes Linux ideal for CAN development and testing.

🐍 Using the SH-C30L Adapter with Python

Python enables automation and advanced CAN applications such as logging, simulation, and diagnostics.

The adapter works seamlessly with the python-can library, which provides a clean interface for sending and receiving CAN frames across platforms.

📦 Installing the Required Library in Python

To begin using Python with CAN:

  1. Install the required package using pip
  2. Ensure the adapter is detected properly (either as can0 or a COM port)

Once set up, Python scripts can interact with CAN networks programmatically.

🖥️ Using SH-C30L on Windows with CAN Monitoring Software

For Windows users, graphical tools simplify CAN interaction.

Basic workflow:

  1. Connect the adapter via USB
  2. Verify detection in Device Manager
  3. Launch CAN software (like Cangaroo)
  4. Select the interface and configure bitrate

MCP2515 Module Overview

Controller Pinout.png

The MCP2515 CAN module is one of the most commonly used solutions for adding CAN communication capability to microcontrollers like the Arduino UNO, which do not have a built-in CAN controller.

This module acts as a bridge between the Arduino and the CAN bus, handling all communication tasks so the microcontroller can focus on processing data.

Important Features of MCP2515 Module

  1. Supports CAN 2.0A and CAN 2.0B protocols
  2. SPI communication with microcontroller
  3. Interrupt-based message handling
  4. Configurable baud rate
  5. Built-in message filtering

🔌 Pin Configuration Explained

🔄 SPI Interface (Arduino Connection)

  1. MOSI → Data from Arduino to MCP2515
  2. MISO → Data from MCP2515 to Arduino
  3. SCK → Clock signal
  4. CS → Enables communication (Chip Select)

⚡ Control & Power

  1. VCC → 5V supply
  2. GND → Ground
  3. INT → Interrupt signal (optional but recommended)

🌐 CAN Bus Interface

  1. CAN_H → High line of CAN bus
  2. CAN_L → Low line of CAN bus

Termination Resistor

The module includes a 120Ω termination resistor, which can be enabled using a jumper.

  1. Enable it if the module is at the end of the CAN bus
  2. Disable it if the module is in the middle of the network

👉 Proper termination prevents signal reflection and ensures stable communication.

Interfacing SH-C30L With Arduino UNO Using MCP2515

Wiring SH-C30L USB to CAN Adapter with Arduino.png

Now let’s connect everything and understand how the system works in practice.

This setup creates a bridge:

  1. Arduino UNO ↔ MCP2515 (SPI communication)
  2. MCP2515 ↔ SH-C30L Adapter (CAN bus)
  3. SH-C30L ↔ PC (USB interface)

🪛 Step 1: Connecting Arduino with MCP2515 (SPI)

The MCP2515 communicates with Arduino using SPI. Typical connections:

  1. VCC → 5V
  2. GND → GND
  3. CS → Pin 10
  4. MOSI → Pin 11
  5. MISO → Pin 12
  6. SCK → Pin 13

Once connected, Arduino can send commands and data to the MCP2515 over SPI.

🔌 Step 2: Connecting MCP2515 with SH-C30L Adapter (CAN Bus)

Now connect the CAN side:

  1. CAN_H → CAN_H
  2. CAN_L → CAN_L
  3. GND → GND

This establishes the CAN communication channel between Arduino and the USB adapter.

⚙️ How the Communication Works

Let’s break down the data flow:

📤 Arduino to PC

  1. Arduino generates data
  2. Sends it to MCP2515 via SPI
  3. MCP2515 converts it into CAN frames
  4. SH-C30L receives CAN signals
  5. Converts them into USB data
  6. PC software displays the messages

📥 PC to Arduino

  1. PC sends CAN message via adapter
  2. SH-C30L transmits it on CAN bus
  3. MCP2515 receives the message
  4. Interrupt signal triggers Arduino
  5. Arduino reads and processes the data

⚠️ Important: CAN Bus Termination

For stable communication, proper termination is critical.

  1. MCP2515 module → Enable 120Ω jumper (if at one end)
  2. SH-C30L adapter → Enable R120 switch (if at other end)

👉 Together, they create the required 60Ω effective resistance, ensuring signal integrity and preventing reflections.

Conclusion

The SH-C30L USB-to-CAN adapter is a highly capable and affordable solution for anyone getting started with CAN communication. When combined with Arduino UNO and the MCP2515 module, it forms a complete development and testing setup that mirrors real-world CAN systems.

👉 For complete step-by-step instructions and code, check the full guide here:

https://playwithcircuit.com/how-to-interface-servo-motor-with-arduino/