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.9.tar.gz (9.6 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.9-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: py_skyrc_charger-0.0.9.tar.gz
  • Upload date:
  • Size: 9.6 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.9.tar.gz
Algorithm Hash digest
SHA256 d27957bbcea33a28f0f535aa2caf582459914489d091c4690d5492d5043251e9
MD5 7e2d249d206336fa932b6b8f31e38ae3
BLAKE2b-256 83f64361279cb68cd5dd3dc266df6eda80d7b80e7b31cddd0f784cb3e244deb9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py_skyrc_charger-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 b43f6fceea18864a0da8fa3e70adc18fc319cb6484b0cb9a12c50fa95c7c1783
MD5 d13fbdd1327092863ab8d476451556b7
BLAKE2b-256 5486321af0952198645a47509c493ce2760fa2b7a1a7ca1ec4f7910605d9dc01

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