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=4.2))
    .add(CV(voltage=4.2, cutoff_current=0.02))
    .add(Rest(duration=1800))
    .add(CC(current=-0.2, cutoff_voltage=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, cutoff_time, cutoff_capacity) Constant current
CV(voltage, cutoff_current, 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.0.tar.gz (6.3 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.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for microcycler-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ed594e524e63475270b0b8ecc80322e27e547ca8f6ebba8bbbe8b0a7d3a98afb
MD5 0cd44a155be575f288fe5ce9aef8fb69
BLAKE2b-256 f8652dd1a913c1d03002252e6be7be0457d19600121a7116b7a35fde84c6098b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: microcycler-0.1.0-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.11.7

File hashes

Hashes for microcycler-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b9d1553f68267d7ce215c7914140b2cbb72a4a773fc6f795ab17879829ec43b2
MD5 4fdff9784dfd9c1c09835746cbfecad3
BLAKE2b-256 74682de89f128dbdaabd3225323b81c96661117e62b023489d66eb6c9ef57979

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