Skip to main content

CLI tools for Korad power supplies, including lithium ion battery charging

Project description

psu-progs

PyPI version

A collection of utilities to put a computer-connected power supplies to good use.

The extraordinarily compact collection includes only a CLI tool for charging lithium-ion batteries with a Korad PSU.

Installation

pip install psu-progs

Quick-show-me-a-thing

# Charge a 1400mAh lithium-ion battery, with a Korad PSU connected at /dev/ttyACM0
korad-charge-lithium-ion -p /dev/ttyACM0 -c 1.4

Full command help

Usage: korad-charge-lithium-ion [OPTIONS]

  Charge a Li-ion battery using a Korad K300XP power supply

Options:
  -p, --port DEVICE              Name of serial device the power supply can be
                                 communicated through, e.g. /dev/ttyACM0
                                 [default: /dev/ttyUSB1; required]
  -c, --capacity FLOAT           Labeled capacity of battery, in amp hours.
                                 [required]
  --charge-current FLOAT         Current to use while in the constant-current
                                 charging phase, in amps. If not specified,
                                 this defaults to half the battery_capacity.
  --charge-voltage FLOAT         Voltage to use while in constant-voltage
                                 phase. For Li-ion cells, this value should be
                                 ≤4.2.  [default: 4.2]
  --charge-cutoff-ratio FLOAT    Ratio of the charge_current used to derive
                                 the value of measured output current at which
                                 to stop charging.  [default: 0.1]
  --channel INT                  Which channel to output power from (for power
                                 supplies with multiple channels).  [default:
                                 0; 0<=x<=1]
  --num-samples INT              When measuring current, use the average of
                                 this many number of samples. Using a value
                                 over 1 is recommended, as anomalous blips may
                                 be measured. This also addresses low readings
                                 when output is first enabled.  [default: 3;
                                 x>=0]
  --max-successive-failures INT  After this number of continuous errors are
                                 encountered while attempting to read the
                                 output current, stop charging.  [default: 5;
                                 x>=0]
  --help                         Show this message and exit.

Developing

This package uses poetry for dependency management. To get started hacking around the codebase:

  1. Create a new virtualenv (or skip this step and let poetry do it for you)
  2. pip install poetry
  3. poetry install
  4. Good luck!

Contributing

If you have other utilities you'd like to add, or other PSUs you'd like to support, pull requests are welcomed! I may not be able to physically test all contributions, but I sure can review and merge :)

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

psu_progs-0.1.1.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

psu_progs-0.1.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file psu_progs-0.1.1.tar.gz.

File metadata

  • Download URL: psu_progs-0.1.1.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.9.14 Linux/5.13.0-52-generic

File hashes

Hashes for psu_progs-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9d561b982ded2a729f254eb8df6c79e657e82b436479db4f118f1343f17aed90
MD5 8b2a2a3251853debec6c299506ec2c30
BLAKE2b-256 967706048e7548d1204d217bdf6b80f5281acfd903bcaf7620e8397deb8730a5

See more details on using hashes here.

File details

Details for the file psu_progs-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: psu_progs-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.9.14 Linux/5.13.0-52-generic

File hashes

Hashes for psu_progs-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4821c6ef5bd7fc387125c9ff66047d6cd5270082e87a094037a5da059f575fce
MD5 0e6b83cf47717f4083952eb767a9d391
BLAKE2b-256 602e9bdf2e93b07d7ecbb8d274827a2c5e3ea1ae348b257f34508e282d236cbd

See more details on using hashes here.

Supported by

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