Skip to main content

Microcycler Python SDK

Python SDK for the Microcycler battery testing platform.

Status: Pre-alpha — API subject to change.

Installation

pip install microcycler

The package is a thin Python layer over a Rust core (core/ in the repository: the same code the Microcycler dashboard and the headless agent run), shipped as one prebuilt wheel per platform (Windows, macOS, Linux; Python 3.9+). pip install microcycler needs no compiler. Installing from a source checkout (pip install -e sdk) builds the core and needs a Rust toolchain (rustup.rs); without the compiled core the package falls back to a pure-Python implementation, which MICROCYCLER_BACKEND=python forces.

microcycler-agent import <credential> then microcycler-agent run uploads this network's licensed cyclers to your organization (see the remote-link documentation). It needs only the installed package.

Quickstart

Connect and read telemetry

import asyncio
from microcycler import Cycler

async def main():
    async with Cycler("192.168.1.100") as cycler:
        print(await cycler.identify())
        t = await cycler.get_telemetry()
        print(f"State:    {t.state}")
        print(f"Voltage:  {t.voltage:.3f} V")
        print(f"Current:  {t.current:.3f} A")
        print(f"Temp:     {t.temperature:.1f} °C")
        print(f"Capacity: {t.capacity_mah:.1f} mAh")

asyncio.run(main())

Discover cyclers on the network

import asyncio
from microcycler import Cycler, discover

async def main():
    # Listens for the discovery beacon on UDP 5002. The beacon is periodic
    # and unsolicited, so this is a collection window, not a deadline —
    # allow at least one beacon period (10 s by default).
    for dev in await discover():
        print(dev)                      # HADES-042 @ 169.254.10.5:5000 (standby)
        async with Cycler(dev.host, port=dev.port) as cycler:
            print(await cycler.get_life())

asyncio.run(main())

Stream live telemetry via UDP

from microcycler.streaming import CyclerStream

async def monitor():
    async with CyclerStream() as stream:
        async for telemetry in stream:
            print(telemetry.voltage, telemetry.current)

Build and run a recipe

from microcycler import Cycler
from microcycler.recipes import Recipe, CC, CV, Rest, Loop

recipe = (
    Recipe(name="Standard Formation")
    .add(CC(current=0.1, cutoff_voltage_high=4.2))
    .add(CV(voltage=4.2, limit_current_high=0.1, cutoff_current_low=0.02))
    .add(Rest(duration=1800))
    .add(CC(current=-0.2, cutoff_voltage_low=2.8))
    .add(Rest(duration=1800))
    .add(Loop(cycles=3))
)

async def run():
    async with Cycler("192.168.1.100") as cycler:
        await cycler.load_recipe(recipe)
        await cycler.start()

Recipe steps

Step Description
CC(current, cutoff_voltage_high, cutoff_voltage_low, cutoff_time, cutoff_capacity) Constant current. current is signed: positive = charge, negative = discharge.
CV(voltage, limit_current_high, cutoff_current_low, cutoff_time) Constant voltage
CP(power, cutoff_voltage, cutoff_time) Constant power
CR(resistance, cutoff_voltage, cutoff_time) Constant resistance
Rest(duration) Open-circuit rest
EIS(freq_start, freq_end, amplitude, points_per_decade) Impedance sweep
Loop(cycles) Repeat preceding steps N times
ACRipple(duration, dc_current, ac_amplitude, ac_freq, cutoff_temp) AC ripple excitation for calorimetry / thermal characterisation

License

MIT


Lifetime wear counters

Every board keeps an odometer in its EEPROM. Three independent axes, because a unit can be worn out along any one of them while the others look fine: mechanical (relay actuations), calendar (powered time) and electrical (charge through the output).

from microcycler import Cycler

async with Cycler("192.168.1.200") as cycler:
    life = await cycler.get_life()

    print(f"boots            {life.boot_count}")
    print(f"powered          {life.powered_hours:,.0f} h")
    print(f"throughput       {life.throughput_ah:,.1f} Ah")
    print(f"MAIN relay       {life.relay_main:,} closings")
    print(f"FAN relay        {life.relay_fan:,} closings")

    if not life.durable:
        print("WARNING: counters are not reaching the EEPROM")

These belong to the physical board, not to your database, so they survive a reinstall, an MCU swap, or the unit moving to another lab. There is deliberately no way to reset them — an odometer that can be wound back is not evidence of anything.

life.durable (i.e. write_errors == 0) is the field worth alerting on. A unit with a dead EEPROM still counts perfectly well in RAM and reports entirely plausible numbers; nothing else distinguishes a kept odometer from one that is lost at every power cut.

Counters are flushed at most once every few minutes to spare the part, so up to that much accrued wear is in RAM only. Before deliberately powering a unit down:

await cycler.flush_life()

Metadata

Release files for microcycler 0.1.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for microcycler 0.1.15
File Size Uploaded Provenance
microcycler-0.1.15.tar.gz 162.1 kB Without provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for microcycler 0.1.15
File
microcycler-0.1.15-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
microcycler-0.1.15-cp39-abi3-manylinux_2_28_aarch64.whl CPython 3.9 abi3 Linux glibc 2.28+ ARM64 Details
microcycler-0.1.15-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
microcycler-0.1.15-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
microcycler-0.1.15-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 17.7 MB

Release files / microcycler-0.1.15.tar.gz

Download URL microcycler-0.1.15.tar.gz
Size 162.1 kB
Tags Source
SHA-256 checksum
How to use checksums
81d651a3a0e77185a5340272012562e81d91b5592959c7b727c0a0fbdbb7d6e0
BLAKE2b-256 checksum
How to use checksums
df2d90e51dddd77dfb11013839c9e030bf9a68bf5fed608ebaf31fc9cdc48466
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / microcycler-0.1.15-cp39-abi3-win_amd64.whl

Download URL microcycler-0.1.15-cp39-abi3-win_amd64.whl
Size 3.4 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
846c169d9ff08e1c6f55d390b65aed7a9e314de44b0322029b6935b7f9791052
BLAKE2b-256 checksum
How to use checksums
9eeaac34887a29d01216497dafb4f78e36c1a26eaa1fa9134f4aa110c361f547
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / microcycler-0.1.15-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL microcycler-0.1.15-cp39-abi3-manylinux_2_28_aarch64.whl
Size 3.2 MB
Tags CPython 3.9 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
c37b6d3216c5bbb5bd25df887749a27f2ae23be14f52d65d57daa68a4f2ee2bc
BLAKE2b-256 checksum
How to use checksums
c637a095e3f3d141b83f86732a660851fd3cec6db0e562682560bc73a3b00c1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / microcycler-0.1.15-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL microcycler-0.1.15-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 3.9 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
f5db4d8d087bcf0bbda01d7320ce5dba9079b9e40dc1c274af972adcae88a824
BLAKE2b-256 checksum
How to use checksums
77c2cc8c7232434515a7ebd6e2d2b35f52ceb23286d0c6e88b45150a1edc0aef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / microcycler-0.1.15-cp39-abi3-macosx_11_0_arm64.whl

Download URL microcycler-0.1.15-cp39-abi3-macosx_11_0_arm64.whl
Size 3.5 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
eb28502795950cdcb5e19fcfedb7798a3fa5d9516c468ca0675f8b7dfd7fff40
BLAKE2b-256 checksum
How to use checksums
201e737e3aaff0c67758105739e4db7195442ef3642adf239dfd3a6f0669d5ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / microcycler-0.1.15-cp39-abi3-macosx_10_12_x86_64.whl

Download URL microcycler-0.1.15-cp39-abi3-macosx_10_12_x86_64.whl
Size 3.6 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
386d15a7ac4feeaaffb658d595f7888be7df93717827aa17aa76c9f3080d15df
BLAKE2b-256 checksum
How to use checksums
9c9fc04f9f6a449b3774334edf45de2a75eb3a5a3a665454eff46a92e7d14669
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Security for microcycler 0.1.15

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.

Release history Release notifications | RSS feed

This release

0.1.15 This release

6 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page