04/18/2024

Reading CAN bus data into ctrlX CORE

Introduction

This article provides two options for reading CAN bus messages into the ctrlX CORE X3 using CAN to USB adapters. The CAN to serial solution is recommended for current applications. A video tutorial for the CANdapter solution is provided under Useful Links.

Option 1: CAN to Serial

This adapter, named the CANdapter, from Ewert Energy Systems converts CAN messages to serial over USB. This was the most plug and play option of the two adapters. The data is immediately available on the serial port after issuing initialization commands and opening the serial port. The data stream is in hexadecimal format and must be decoded with the CAN busĀ message definition.

Example Node-RED code is provided below to read and decode data from an Orion Jr 2 BMS system. In this example, an Influx database is used to store the data. The required node comes from theĀ node-red-contrib-influxdbĀ pallet.Ā The decoded CAN data is not available on the ctrlX Data Layer by default. Data can be provided to the ctrlX Data Layer using a custom application and the SDK for ctrlX OS, the PLC application, or theĀ Key Value DatabaseĀ application.

Option 2: PCAN-USB

This adapter comes from PEAK System and is named the PCAN-USB. The adapter can utilize the Linux socket can interface, which is included in the ctrlX OS distribution. There is a Python library to work with this interface called python-can. At the moment, using this adapter will require a custom application as some configuration of the network interfaces is required that cannot be done from the Web UI of the ctrlX CORE. Please reach out directly if you'd like more information on this option.

PCAN USB Device Detection

Related Links

1
CAN_DECODE_ORION_BMS_JR.txt
17.9KB

Latest published/updated articles

Types
Example
Categories
Controls
Attachments
Project