Skip to content
CANBus-MQTT Adapter for connecting your car to the Internet of Things
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


CAN Bus Adapter allows an automotive's CAN (Controller Area Network) Bus to publish MQTT messages.


  1. Install libssl,curl, and jansson,gcc, autoconf, and libtool libraries by running
sudo apt-get install libssl-dev libcurl4-openssl-dev libjansson-dev gcc autoconf libtool
  1. Install paho-mqtt C library, repo
git clone
cd paho.mqtt.c
make clean
sudo make install
  1. Build the ClearBlade C SDK Repo
git clone
cd ClearBlade-C-SDK
make clean
sudo make install


  1. Enter your ClearBlade System details in /adapters/contants.h, example below
#ifndef _CONSTANTS_H
#define _CONSTANTS_H

char *SYSTEM_KEY = <SYSTEM_KEY>; // ex. "94aaa4890bc0afe1fbd282b1ac8e01"
char *USER_EMAIL = <USER_EMAIL>; // ex. ""
char *USER_PASSWORD = <PASSWORD>; // ex. "password"



  1. Build adapter
cd /path/to/canbus-adapter/adapters/
make clean
  1. Start adapter


  1. Install can-utils
git clone
cd can-utils
sudo make install
  1. Install virtual can interface
sudo modprobe can
sudo modprobe can_raw
sudo modprobe vcan
sudo ip link add dev vcan0 type vcan
sudo ip link set up vcan0
sudo ip link show vcan0
  1. Send an example payload to CAN Bus
sudo ifconfig vcan0 up
cansend vcan0 123#1122334455667788
  1. All set! You'll see CANBus messages within the CANBus Adapter!
ClearBlade init successful: NByVFwfSCjVf4zF8XSMTG_osxg3B0BA_Tw-CkqU89jsqSlS_eosLT3pPbc4w1Z0KvTQCWjeSvLnGgxoqQw==
Successful connection to MQTT broker
Subscribe succeeded
vcan0 at index 0
Received data from CAN bus: "3DUfw�
Send MQTT message: ID: 291, Data: "3DUfw�
You can’t perform that action at this time.