Read cumulative energy via Python

Hi,
Just getting started with scripted measurements for the Joulescope.
Looking good so far :slight_smile:

Is anything implemented to get the cumulative energy during a joulescope.read(…) command?
Or would you have to calculate it manually from the current/voltage readings?

The energy display in the UI is very nice, but i would like to read it programmatically.

Looking forward to see how this project and software evolves!

2 Likes

Hi @sorenfriis and welcome to the Joulescope forum!

If you want to read the energy just like the UI, then register a callable with joulescope.driver.Device.statistics_callback (link to software version 0.6.4, Oct 2019). Note that the callable is called from the USB thread, so you may have to resynchronize it to your main thread. I created the energy_printer.py example over in the pyjoulescope_examples GitHub repo.

Just like with the UI, this energy statistic is only updated every 1/2 second. Does this work for your application?

1 Like

Thank you for the quick response and the sample code.
That is definitely a usable solution.

1 Like