Same-day dispatch before 2 PM · Free delivery over ₹999 · GST invoices Get the appPrices incl. GST
Geekobot
Snap & SendNEWGeeko AIWhere's myOrder
Log in
Products
  • Projects
    • Component guidesHow parts work, with code you can run
    • Learning pathsFrom your first LED to your first robot
    • Workshops & eventsOnline sessions for makers and classes
    • ElectrolarkFree guided builds, simulator and certificates
    • Students & teachersStudent discount and classroom help
    • CommunityShare builds and ask other makers
    • CalculatorsOhm's law, LED resistor, 555 and 100+ more
    • Circuit builderWire parts and run the circuit, powered by Electrolark
    • Geeko AIAsk what to buy or how to wire it
    • Snap & SendPhotograph a part or list, we find it
    • Part finderAnswer a few questions, get the right part
    • Compatibility checkWill these two parts work together?
    • Compare partsSpecs side by side
    • Business & bulk ordersGST invoices, credit and volume prices
    • Request a quotationSend your list, get a quote
    • Classroom kitsPer-student kits and lab bundles
    • Gift cardsFor students, teams and events
  • Atal Tinkering Lab
BOM to cart
Geekobot

Components, kits and know-how for makers, students, engineers, labs and businesses across India.

Ask Geeko AIOrders, parts and projects, any timeEmail supportReply within 1 working dayGet the Geekobot appAdd it to your home screen, free

Follow us

Shop

  • Boards & SBCs
  • Sensors & Modules
  • IoT & Wireless
  • Drone & FPV
  • 3D Printing
  • Filaments & Resins
  • Motors & Drivers
  • Power & Batteries
  • Semiconductors
  • Passive
  • Displays & LEDs
  • Switches & Relays
  • Wires & Cables
  • Prototyping
  • Tools & Test
  • Robotics
  • STEM Kits
  • Atal Tinkering Lab
  • Mechanical Parts
  • Audio

Orders

  • Track your order
  • Help & support
  • Shipping and delivery
  • Refunds and cancellation
  • Contact us

Learn

  • Projects
  • Geeko AI project assistant
  • Learning paths
  • Guides
  • Calculators
  • Electrolark: free guided builds

Part tools

  • Part finder
  • Compare parts
  • Will it work with my board?

Institutions

  • Classroom kits
  • Atal Tinkering Lab
  • Students & teachers
  • Workshops & Events

Business

  • Business & education
  • Request a quotation
  • BOM bulk upload
  • Quick order by SKU

Company

  • About Geekobot
  • Community
  • Gift cards
  • Terms & conditions
  • Privacy policy
  • Product directory
  • Sitemap

© 2026 Geekobot, a trade name of OLatus Systems Private Limited. All rights reserved.

20, 1st Floor, Neeladri Complex, 10th Cross, Sampige Rd, 2nd Main, Malleshwaram, Bengaluru, Karnataka 560003 · GSTIN 29AACCO0462F1ZM

+91 91810 15607 · connect@geekobot.in · Monday to Saturday, 10 AM to 2 PM IST

UPI · CARDS · NETBANKING · GST INVOICES

ShopProjectsGeeko AIGuides
Compare 0 parts →
Log in

Shop by category

Shop all components
  • Boards & SBCs1,910 products
    • Alternative Single Board Computers
    • Arduino Ecosystem
    • FPGA & Logic Boards
    • Microcontroller & Wireless Boards
    View all
  • Sensors & Modules4,701 products
    • Biomedical & Heart Rate
    • Current, Voltage & Power
    • Force, Weight & Pressure
    • Gas, Weather & Environmental
    View all
  • IoT & Wireless2,314 products
    • RF Modules
    • RFID & NFC
    • Antennas & RF Accessories
    • Cameras & Smart Vision
    View all
  • Drone & FPV3,558 products
    • Flight Control & Navigation
    • FPV Video & Optics
    • Frames & Structural Parts
    • Motors & Propulsion
    View all
  • 3D Printing2,204 products
    • 3D Printers
    • 3D Scanners & Digitizers
    • Laser Engravers & Cutters
    • Material Management & Upgrades
    View all
  • Filaments & Resins1,472 products
    • Filaments
    • Photopolymer Resins
    View all
  • Motors & Drivers463 products
    • BLDC Motor Drivers
    • DC & Geared Motors
    • DC Motor Drivers
    • Linear Actuators & Solenoids
    View all
  • Power & Batteries557 products
    • Battery Holders & Connectors
    • Breadboard Power
    • Chargers & BMS
    • DC-DC Converters
    View all
  • Semiconductors295 products
    • Diodes & Rectifiers
    • Interface & RF Encoder ICs
    • Logic ICs (74xx)
    • Logic ICs (CD4000)
    View all
  • Passive67 products
    • Capacitors
    • Circuit Protection
    • Crystals & Oscillators
    • Inductors
    View all
  • Displays & LEDs572 products
    • 7-Segment & Dot Matrix
    • Addressable LEDs
    • Character LCDs
    • Graphic LCDs
    View all
  • Switches & Relays184 products
    • Keypads & Touch
    • Push Buttons & Tactile
    • Relay Modules
    • Relays
    View all
  • Wires & Cables233 products
    • Board-to-Wire Connectors
    • Crimp & Splice
    • Headers & Dupont
    • Heat Shrink & Sleeving
    View all
  • Prototyping101 products
    • Breadboards
    • Interface Modules
    • PCBs & Perfboards
    View all
  • Tools & Test717 products
    • Bench Power Supplies
    • Hand Tools
    • Measuring Tools
    • Meters & Testers
    View all
  • Robotics180 products
    • Humanoid & Legged Robots
    • Robot Chassis & Platforms
    • Robotic Arms & Grippers
    • Wheels & Casters
    View all
  • STEM Kits268 products
    • Arduino Learning Kits
    • Coding & IoT Kits
    • Early Coding (Ages 3-8)
    • Invention Kits
    View all
  • Atal Tinkering Lab196 products
    • Package 1: Electronics, Robotics, IoT and Sensors
    • Package 2: Rapid Prototyping Tools
    • Package 3: Mechanical, Electrical and Measurement Tools
    • Package 4: Power Supply, Accessories and Safety Equipment
    View all
  • Mechanical Parts212 products
    • Bearings
    • Brackets & Mounts
    • Couplers
    • Fasteners & Standoffs
    View all
  • Audio109 products
    • Amplifier Modules
    • Buzzers & Sirens
    • Speakers
    View all
  1. Home
  2. ›Guides
  3. ›IoT & Wireless
  4. ›CAN Bus Basics

How-to · Advanced · 3 min read

CAN Bus Basics

MCP2515 Modules, Transceivers and Adapters With Arduino and ESP32

By Geekobot Learning Team · Updated 29 Oct 2026

On this page
Short answerHow CAN worksHardware optionsSending a message with the MCP2515TroubleshootingTry itCommon mistakesFAQsParts and next steps
Short answer

CAN bus is a two-wire differential network where many devices share one pair of wires and send short prioritised messages. An Arduino needs a CAN controller (MCP2515 over SPI) plus a transceiver. An ESP32 has a built-in CAN controller called TWAI and only needs a transceiver. Use 120 Ω termination at both ends and set the same bit rate on every node.

Key specs at a glance

Wiring
CANH and CANL twisted pair, plus ground
Termination
120 Ω at each end of the bus
Bit rate
125 kbit/s to 1 Mbit/s for classic CAN
MCP2515
SPI CAN 2.0B controller, usually with a TJA1050 5 V transceiver
ESP32
TWAI controller; use a 3.3 V transceiver such as SN65HVD230
CAN FD
Faster data phase, needs FD capable hardware
01

How CAN works

Each message has an ID (which also sets its priority), up to 8 bytes of data in classic CAN, and a CRC. Every node hears every message and decides whether to use it. If two nodes talk at once, the lower ID wins without losing data. This makes CAN reliable for cars, drones (DroneCAN), 3D printer toolheads and industrial machines.

02

Hardware options

Choose by platform.

PlatformPartsNotes
Arduino Uno / NanoMCP2515 module with TJA1050SPI; check the crystal (8 or 16 MHz) in the code
ESP32TWAI controller plus a transceiverNo MCP2515 needed
Raspberry PiMCP2515 HAT or USB-CAN adapterSocketCAN on Linux
PCUSB to CAN adapterFor analysers and ROS
GatewaysCAN to RS485/Ethernet convertersLink CAN to other networks
Arduino Uno / Nano
Parts:
MCP2515 module with TJA1050
Notes:
SPI; check the crystal (8 or 16 MHz) in the code
ESP32
Parts:
TWAI controller plus a transceiver
Notes:
No MCP2515 needed
Raspberry Pi
Parts:
MCP2515 HAT or USB-CAN adapter
Notes:
SocketCAN on Linux
PC
Parts:
USB to CAN adapter
Notes:
For analysers and ROS
Gateways
Parts:
CAN to RS485/Ethernet converters
Notes:
Link CAN to other networks
03

Sending a message with the MCP2515

This Arduino sketch uses the common mcp_can library and sends an 8 byte frame every second at 500 kbit/s. Set MCP_8MHZ or MCP_16MHZ to match the module's crystal.

MCP2515 send example (mcp_can library) · Arduino C++Verify & upload in Electrolark
#include <SPI.h>
#include <mcp_can.h>
MCP_CAN CAN0(10);                      // CS pin

void setup() {
  Serial.begin(115200);
  if (CAN0.begin(MCP_ANY, CAN_500KBPS, MCP_8MHZ) != CAN_OK) {
    Serial.println("CAN init failed"); while (1);
  }
  CAN0.setMode(MCP_NORMAL);
}

void loop() {
  byte data[8] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
  if (CAN0.sendMsgBuf(0x100, 0, 8, data) == CAN_OK) Serial.println("sent");
  delay(1000);
}
04

Troubleshooting

Init fails

wrong crystal setting, wrong CS pin or wiring.

No traffic

bit rates do not match, or no termination. Measure about 60 Ω between CANH and CANL with power off (two 120 Ω resistors in parallel).

Errors on a long bus

use twisted pair, keep stubs short and ground the shield at one end.

Nothing on a 3.3 V board

use a 3.3 V transceiver or a level shifter (level shifting).

05

Try it: Uart baud rate error calculator

Change the values and the diagram and results update as you type.

06

Common mistakes to avoid

  • !Leaving out the termination resistors.
  • !Using the wrong crystal frequency in code.
  • !Different bit rates on different nodes.
  • !Connecting a 5 V transceiver output to a 3.3 V ESP32 pin.
  • !Running a long stub off the main bus.
07

Frequently asked questions

What is the difference between CAN and RS485?

Both use differential wires. CAN adds addressing, priority, error handling and message framing in hardware.

Do I need a transceiver?

Yes. The controller (MCP2515 or ESP32) needs a transceiver to drive the CANH and CANL lines.

Can MCP2515 do CAN FD?

No, it supports classic CAN 2.0A and 2.0B only.

How many devices on one bus?

Many dozens, limited by cable length and bit rate.

What is OBD-II?

The car diagnostic port, which carries CAN on pins 6 and 14 in most modern vehicles.

Parts for this guide

  • NanoRadar USB to CAN Adapter – USB 2.0 to CAN BUS Converter
    ₹7,909View
  • BIGTREETECH EBB36 CAN V1.2 Extruder Toolhead Board
    ₹2,199View
  • Waveshare CAN FD to RS232/RS485 Bidirectional Protocol Converter – DIN-Rail Mount
    ₹3,869View
  • Waveshare CAN FD Protocol Converter, CAN FD To ETH/RS232/RS485 Bidirectional Data Communication – DIN-Rail Mount
    ₹6,459View
Shop RS485, Modbus & CAN Communication Modules

Calculators

Uart baud rate error calculator

Terms in this guide

CAN busA two-wire differential network used in vehicles, drones and machines. Many nodes share one pair of wires and messages are prioritised by ID.SPISerial Peripheral Interface: a fast bus with clock, data in, data out and a chip-select line per device.Logic levelThe voltage that represents a digital high: 5 V on classic Arduinos, 3.3 V on ESP32, Pico and Raspberry Pi.Baud rateThe speed of a serial link in bits per second. Both ends must use the same value; 9600 and 115200 are the usual defaults.ModbusA simple industrial request-and-reply protocol in which a master polls numbered registers on slave devices, usually over RS-485 (Modbus RTU) or Ethernet (Modbus TCP).

Keep learning

Concept explainerIntermediateSPI ExplainedSPI (Serial Peripheral Interface) is a fast four-wire bus: SCK carries the clock, MOSI carries data from the controller, MISO carries data back, and a separate chip-select (CS) line per device chooses who is listening.3 min read · Electronics FundamentalsComponent guideIntermediateRS-485 and RS-232 ModulesRS-485 and RS-232 carry UART serial data over longer cables than plain TTL.3 min read · IoT & WirelessHow-toAdvancedModbus RTU With Arduino and ESP32Connect industrial Modbus RTU sensors to Arduino or ESP32 with an RS485 module: wiring, termination, slave addresses, baud rate, registers and example code.3 min read · IoT & WirelessComparisonIntermediateFlight ControllersA flight controller reads its gyro thousands of times a second and adjusts each motor to keep the craft stable and follow your sticks.3 min read · Drones & FPVHow-toIntermediate3.3 V vs 5 V LogicYou need level shifting when a 5 V device sends signals to a 3.3 V board such as an ESP32 or Raspberry Pi Pico, because 5 V on their pins can damage them.4 min read · Prototyping & WiringComponent guideBeginnerESP32 GuideThe ESP32 is a low-cost 3.3 V microcontroller from Espressif with built-in Wi-Fi and Bluetooth, used for IoT devices, smart-home controllers and web dashboards.5 min read · Boards & Microcontrollers

Sources

  • Microchip MCP2515 data sheet
  • Espressif ESP32 TWAI documentation
  • Bosch CAN specification overview

Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

On this page
Short answerHow CAN worksHardware optionsSending a message with the MCP2515TroubleshootingTry itCommon mistakesFAQsParts and next steps
Need a hand?Ask Geeko AI which part fits your project, or talk to the Geekobot team.Ask Geeko AIHelp & support

Parts for this guide4 items · ₹20,436

NanoRadar USB to CAN Adapter – USB 2.0 to CAN BUS Converter · BIGTREETECH EBB36 CAN V1.2 Extruder Toolhead Board · Waveshare CAN FD to RS232/RS485 Bidirectional Protocol Converter – DIN-Rail Mount · Waveshare CAN FD Protocol Converter, CAN FD To ETH/RS232/RS485 Bidirectional Data Communication – DIN-Rail Mount

Run itChange the inputs and watch the output
Serial monitor115200 baud
sent

A simulation of the sketch above, so you know what to expect. Real readings vary with your parts and wiring.

Ask the Community

Ask a question