pybldc
Developed by Kristian Sloth Lauszus, 2024-2025
The code is released under the GNU General Public License v3.0.
Purpose
This tool allows you to flash a VESC via CAN-bus or serial/USB using Python.
Installation and running
To install:
pip install .
Or install the latest release from PyPI:
pip install -U pybldc
CLI
A handy CLI tool is included.
I recommend using uvx to run the CLI tool:
uvx pybldc --help
Or you can install it in your path:
uv tool install pybldc
pybldc --help
Usage
usage: pybldc [-id CONTROLLER_ID] [-i INTERFACE] [-l CHANNEL] [-p PORT] [-h]
[--version] [-B BINARY] [--bootloader] [-t TIMEOUT]
[-r PING_REPEAT] [-b BAUDRATE] [--debug]
{can,serial} {upload,ping,reset}
positional arguments:
{can,serial} Communicate with the target via either CAN or serial
{upload,ping,reset} upload: write BINARY
ping: send a ping command to the target and check for a response
reset: send a reset command to the target and check for a response
required CAN arguments:
-id CONTROLLER_ID, --controller-id CONTROLLER_ID
The VESC ID used for communication
optional CAN arguments:
-i INTERFACE, --interface INTERFACE
The CAN-Bus interface to use (default "socketcan")
-l CHANNEL, --channel CHANNEL
The CAN-Bus channel to use (default "can0")
required serial arguments:
-p PORT, --port PORT The port to use for serial
optional arguments:
-h, --help Show this help message and exit
--version Show program's version number and exit
-B BINARY, --binary BINARY
The binary to upload
--bootloader The binary to upload is a bootloader
-t TIMEOUT, --timeout TIMEOUT
The time to wait in seconds for a response (default 5.0)
-r PING_REPEAT, --ping-repeat PING_REPEAT
The number of times to try to establish a connection by pinging the VESC (default 3)
-b BAUDRATE, --baudrate BAUDRATE, --bitrate BAUDRATE
The baudrate/bitrate to use for serial/can (defaults to 115200 for serial and 500000 for CAN)
--debug Turn on debug logs
Upload
uvx pybldc can upload -id 1 -B VESC.bin
uvx pybldc serial upload -p /dev/ttyACM0 -B VESC.bin
Ping
uvx pybldc can ping -id 1
uvx pybldc serial ping -p /dev/ttyACM0
Reset
uvx pybldc can reset -id 1
uvx pybldc serial reset -p /dev/ttyACM0
Increase TX buffer
On Linux you might need to increase the TX buffer size:
sudo ip link set can0 txqueuelen 1000
Credit
- VESC firmware: https://github.com/vedderb/bldc
- VESC bootloader: https://github.com/vedderb/bldc-bootloader
- VESC Tool: https://github.com/vedderb/vesc_tool
Metadata
Release files for pybldc 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pybldc-1.1.0.tar.gz | 38.3 kB | Without provenance | Details for pybldc-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pybldc-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for pybldc-1.1.0-py3-none-any.whl |
Total release size: 66.6 kB
Release files / pybldc-1.1.0.tar.gz
| Download URL | pybldc-1.1.0.tar.gz |
|---|---|
| Size | 38.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1f44f07e00af25594dabe37e3c4c3a292cc147cc679125ba89957bd1f1c5cf29
|
|
BLAKE2b-256 checksum How to use checksums |
8c2a8a14e4937ff25ad8039e5bdf269aa9aa0f335616672c427720af3b262620
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / pybldc-1.1.0-py3-none-any.whl
| Download URL | pybldc-1.1.0-py3-none-any.whl |
|---|---|
| Size | 28.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c6d3015c31fa09065baccf85610a3183d0badf7854956713c80e562d698f1e95
|
|
BLAKE2b-256 checksum How to use checksums |
a737a371903c9b9c167764da1a478f5079b0b6233bb7a6cec94e7668bf03a561
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for pybldc 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.