rbtnx / CAN_to_db

translate CAN data to InfluxDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Store CAN data from solar box into db

Create CAN socket

sudo modprobe vcan
sudo ip link add vcan0 type vcan
sudo ip link set vcan0 up

Test socket

candump -L vcan0
cansend vcan0 012#deadbeef

prepare python env (not needed but advised)

In directory with requirements.txt:

virtualenv -p python3 .cantodb
source .cantodb/bin/activate
pip install -r requirements.txt

You can skip the first two commands, then all python packages will be added to your computer's python installation! You can leave the environment simply with

deactivate

Usage:

python cantodb.py vcan0

You should see decoded cbor data

send dummy data via cansend to test:

cansend vcan0 014#8000FA3FF33333
cansend vcan0 014#8000820C16
cansend vcan0 014#8000C48221196AB3
cansend vcan0 014#8080C48221196AB3

The output should look like this:

Message from ID 20 -> 0: 1.899999976158142
Message from ID 20 -> 0: [12, 22]
Message from ID 20 -> 0: 273.15
Error receiving package from ID 20. Error code: 0x80

About

translate CAN data to InfluxDB

License:MIT License


Languages

Language:Python 100.0%