Skip to main content

take control of a SkyRC charger via USB

Project description

py skyrc charger

this package allows to interface with skyrc chargers using the usb-connection as a more flexible replacement for the Charge Master software. This library was created by reverse engineering the protocol and does not support the complete set of functions yet.

supported devices

this code was developed and tested using the SkyRC T1000: https://www.skyrc.com/t1000 however chargers working with the original Charge Master software are likely to work as well. A list of supported devices is on the download page of Charge Master: https://www.skyrc.com/downloads

tested on linux only, windows should also work, but it is more difficult to setup the usb driver

setup (linux)

fix usb permissions

this might be necessary to run the code without sudo.

create a file /lib/udev/rules.d/50-skyrc-t1000.rules with the following content:

ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0000", ATTRS{idProduct}=="0001", MODE="660", GROUP="plugdev"

run:

sudo adduser $USER plugdev

how to use

import time
from py_skyrc_charger import Charger, Config, Action, ChargerResponse


def rec_data_callback_sample(data: ChargerResponse):
    print("---")
    print(f"got cmd: {data.command}")
    if data.is_error:
        print(f"error: {data.error_str}")
    else:
        print(f"got data: {data.data}")


if __name__ == "__main__":
    charger = Charger(rec_data_callback_sample, device_index=0)
    charger.connect()

    time.sleep(1.0)

    print("read version...")
    charger.poll_version()
    time.sleep(0.2)

    print("read settings...")
    charger.poll_settings()
    time.sleep(0.2)

    # configure charge program
    conf = Config(port=1,
                  action=Action.BALANCE,
                  cells=3,
                  cur_in=0.1,
                  cur_out=0.5)

    # read values in idle
    start_time = time.time()
    while time.time() - start_time < 5:
        charger.poll_all_vals()
        time.sleep(1.0)

    print("START")
    charger.start_program(conf)

    # read values while charging
    start_time = time.time()
    while time.time() - start_time < 10:
        charger.poll_all_vals()
        time.sleep(1.0)

    print("STOP")
    charger.stop_program(conf.port)

    # read values in idle
    start_time = time.time()
    while time.time() - start_time < 10:
        charger.poll_all_vals()
        time.sleep(1.0)

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

py_skyrc_charger-0.0.11.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

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

py_skyrc_charger-0.0.11-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file py_skyrc_charger-0.0.11.tar.gz.

File metadata

  • Download URL: py_skyrc_charger-0.0.11.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for py_skyrc_charger-0.0.11.tar.gz
Algorithm Hash digest
SHA256 3ed454e4c9498d006fa0058554ff762ce3ca03612dabae0d0d557bd86a4bc2c5
MD5 af05b7b4af32af38e0e87f88e265d777
BLAKE2b-256 fbedc7f4580cde7a5d2e2cf14bddd6181e08d66185453577bce5aa98aa5d87d3

See more details on using hashes here.

File details

Details for the file py_skyrc_charger-0.0.11-py3-none-any.whl.

File metadata

File hashes

Hashes for py_skyrc_charger-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 b5509bdb295ec279cdea6bfec0e87e4a569a58857a34fdb7a236b455da58e43b
MD5 cb905e9b8e517a8d373354c52e1d9b0a
BLAKE2b-256 9cdc8c5d0ad6c0c12f000dcf4f03f56f2dc69d1bceb1202c2ad1534065275a15

See more details on using hashes here.

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