Skip to main content

Python SDK for the Microcycler battery testing platform

Project description

Microcycler Python SDK

Python SDK for the Microcycler battery testing platform.

Status: Pre-alpha — API subject to change.

Installation

pip install microcycler

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

from microcycler.streaming import discover

hosts = asyncio.run(discover())
print(hosts)  # ['192.168.1.100', '192.168.1.101']

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
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

License

MIT

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

microcycler-0.1.5.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

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

microcycler-0.1.5-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file microcycler-0.1.5.tar.gz.

File metadata

  • Download URL: microcycler-0.1.5.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for microcycler-0.1.5.tar.gz
Algorithm Hash digest
SHA256 3ba5f302316ad6a63bbc80554bf714159c8bf43523edb506bcd7d562c9943469
MD5 047e7daccf7f3d22ec581f4def05f375
BLAKE2b-256 dd86e9b2531f184c044ea324bcb2d2b18e5935a34751e2d8c86caefda0d35f2b

See more details on using hashes here.

File details

Details for the file microcycler-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: microcycler-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for microcycler-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2cce1f083cef873e561d8b82163a14064fc971ab833a624ffd900f4ee0ede785
MD5 97fa67a6b313baa462730794f44e20fb
BLAKE2b-256 840f9dcb56b6d5ab78c484a1ff4e9271b3cc335c9087f97744404d1c0536b516

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