The ppk2-api is a Python library providing an API for Nordic Semiconductor's Power Profiler Kit II (PPK 2). It enables programmatic control and data acquisition from the PPK 2 device, facilitating power consumption measurements and analysis for embedded development. The current version is 0.9.2, with active development and frequent releases (e.g., v0.9.0, v0.9.1, v0.9.2 in quick succession, aiming for v1.0.0).
pip install ppk2-apiVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to discover a PPK2 device, set it to ampere meter mode, start a measurement, wait for a period, and then stop it. It also shows how to retrieve some sample data. Note that actual data streaming involves more continuous polling with `ppk2.get_data()` in a loop.
Review concurrent code that interacts with ppk2-api. Adapt to threading model for internal operations. Consider explicit process management if isolation is critical for your application logic.
Always use version 0.9.0 or newer for accurate current measurements. Re-run experiments if data was collected using affected versions.
Wrap `PPK2.discover()` in a `try...except NoPPK2FoundException` block. Verify the PPK2 is powered on and connected. Check USB drivers and permissions. Ensure no other application is using the device.