Skip to main content

Tool to configure and operate OpenInverter systems over CAN

Project description

OpenInverter CAN tool

Build status PyPI - Python Version PyPI - License

A tool to allow configuration and operating of OpenInverter systems for electric vehicles over a CAN connection.

Features

  • Display all available modifiable parameters and read-only values supported by a given inverter firmware version
  • Read a specified parameter/value
  • Write a new value to a specified parameter
  • Display the current value of each parameter/value on a given device
  • Log a list of parameters to a CSV file at regular intervals
  • Save and load all parameters to and from a JSON file
  • Manage parameter to custom CAN message mappings:
    • Create, remove and list parameter mappings on a device
    • Support maps with standard CAN 2.0a and extended CAN 2.0b frames
    • Export and import mappings to a local JSON file
    • Export mappings to DBC allowing easier debugging with SavvyCAN
  • Upgrade firmware or recover devices over CAN
  • Display the inverter serial number
  • Command the inverter to:
    • Start
    • Stop
    • Load parameters from flash
    • Save parameters to flash
    • Revert parameters to their default values
    • Reset
  • Display a device's error log
  • Scan a CAN bus for possible nodes
  • Runs on Linux, Windows and MacOS with python 3.9+
  • Support shell completion for commands and options for bash, zsh and fish shells
  • Works with any CAN adapter supported by python-can
  • Supports stm32-sine 5.24.R or later
  • Automatic parameter database download and caching (requires stm32-sine 5.27.R or later)
  • Works with Foccci/Clara CCS controller, Stm32-vcu (a.k.a. Zombieverter VCU) and Flying ADC BMS

Installation

To avoid any clashes with other software the tool is best is best installed using the pipx package manager. Install this following the pipx installation guide for your platform.

Initial Install

The most recent release may be installed using:

    pipx install openinverter_can_tool

Upgrading

Upgrading to the most recent release is carried out using pip:

    pipx upgrade openinverter_can_tool

Configuration

Before the tool can be used the CAN interface adapter needs to be configured. To do this create ~/.canrc on Linux and MacOS or %USERPROFILE%/can.conf on Windows. Details on interfaces supported and the configuration file format can be found in the python-can documentation.

An example configuration file for a SocketCAN compatible adapter on Linux would look like:

[default]
interface = socketcan
channel = can0
bitrate = 500000

Note: Before the tool can on Linux run the SocketCAN network interface needs to be started. Read the guide on how to do this.

An example configuration file for a SLCAN adapter such as GVRET on Windows would look like:

[default]
interface = slcan
channel = COM8
bitrate = 500000

Tested interfaces

Let me know if you have used a particular CAN interface successfully and I can expand this list.

The many CANable clone devices on eBay or AliExpress can be swapped from socketcan to slcan firmware (or vice versa) using the web firmware updater.

Incompatible interfaces

These python-can drivers are known to have problems with openinverter_can_tool:

Command Line Usage

To get the usage information for the tool run the oic command with no parameters:

    Usage: oic [OPTIONS] COMMAND [ARGS]...

    OpenInverter CAN Tool allows querying and setting configuration of inverter
    parameters over a CAN connection

    Options:
    -d, --database FILE       Override the OpenInverter JSON parameter database
                                to use
    -c, --context TEXT        Which python-can configuration context to use
    -n, --node INTEGER RANGE  The CAN SDO node ID to communicate with  [env var:
                                OIC_NODE; default: 1; 1<=x<=127]
    -t, --timeout FLOAT       Response timeout in seconds  [default: 1.0]
    --debug                   Enable detailed debugging messages
    --version                 Show the version and exit.
    --help                    Show this message and exit.

    Commands:
    cache       Parameter database cache management commands
    can         Manage parameter to CAN message mappings on a device
    cmd         Execute a command on a device
    dumpall     Dump the values of all available parameters and values
    errors      List all of the errors on a device
    listparam   List the definition of PARAM
    listparams  List all available parameters and values
    load        Load all parameters from json IN_FILE
    log         Log the value of PARAMS from the device periodically in CSV...
    read        Read the value of PARAM from the device
    save        Save all parameters in json to OUT_FILE
    scan        Scan the CAN bus for available nodes
    serialno    Read the device serial number.
    upgrade     Upgrade the device firmware.
    write       Write the value to the parameter PARAM on the device

To scan for OpenInverter devices on a CAN network:

    $ oic scan
    Scanning for devices. Please wait...

    Found possible OpenInverter node: 1
    Found possible OpenInverter node: 3

To read the current value of a parameter:

    $ oic read brakeregen
    brakeregen          : -50

Values may be changed using symbolic names:

    oic write potmode DualChannel
    oic write pinswap PWMOutput13,PWMOutput23

Firmware on devices may be easily upgraded:

    $ oic upgrade stm32_sine.bin
    Device upgrade started for 87193029
    Upgrading: 15.3% complete

Experimental GUI

An experimental GUI version of the tool exists which can be started by running the oic-gui command:

Screenshot of the OpenInverter CAN Tool showing the Parameters tab on a Linux GNOME desktop

Further details can be found in the user documentation.

Development and Contributing

If you are interested in contributing to the tool please check the contributing guidelines.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openinverter_can_tool-0.5.1.tar.gz (384.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openinverter_can_tool-0.5.1-py3-none-any.whl (366.1 kB view details)

Uploaded Python 3

File details

Details for the file openinverter_can_tool-0.5.1.tar.gz.

File metadata

  • Download URL: openinverter_can_tool-0.5.1.tar.gz
  • Upload date:
  • Size: 384.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for openinverter_can_tool-0.5.1.tar.gz
Algorithm Hash digest
SHA256 4fa724f50ca4eae0896448b402b7f15e912e945bd5befc8af4da9a2ebb9041c2
MD5 6c9949aa134ae2e71f848f72394f4857
BLAKE2b-256 3038b7a74f28862e82660956b6d621f36550e47104478fac091bb6c1cd8e9c80

See more details on using hashes here.

Provenance

The following attestation bundles were made for openinverter_can_tool-0.5.1.tar.gz:

Publisher: release.yml on davefiddes/openinverter-can-tool

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file openinverter_can_tool-0.5.1-py3-none-any.whl.

File metadata

File hashes

Hashes for openinverter_can_tool-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 72302f6f3024ad293584fa0706c5e9fa863e181ed50b8d6185253c126617fdb2
MD5 80dafac4621490353e60314a06db28e7
BLAKE2b-256 1e0a6af939b1db477080fb0a47e48b3c6733aed4eee494a95f3696aaaa4c1642

See more details on using hashes here.

Provenance

The following attestation bundles were made for openinverter_can_tool-0.5.1-py3-none-any.whl:

Publisher: release.yml on davefiddes/openinverter-can-tool

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page