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.10.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.10-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: py_skyrc_charger-0.0.10.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.10.tar.gz
Algorithm Hash digest
SHA256 1f963ad557f78ae5cdafa3ffc738c106a7b2c7e65870b2e8f9ef84778fdf7e23
MD5 504b6539c0dfb40797a07e6223de3d46
BLAKE2b-256 33e7f33f1ff3d0f9e646926f639685ade420a89b20c16896efad896ea32e365d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py_skyrc_charger-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 5dacc5356be86187c49bfefd04ef24f2758756e0bcb41981d96085026b1c8308
MD5 fcf8ac0fe06dc3fbeb921b037591c718
BLAKE2b-256 7f839ad2776113d2ffda60aa5740d7a57a2ca2f7f103984f300d399692201642

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