JS220 python getting started

Using a JS220 - works fine.

I’ve got the python libraries installed - seems ok.
PS C:\git\pyjoulescope_examples-main\bin> C:/Users/scobb/AppData/Local/Programs/Python/Python312/python.exe -VV
Python 3.12.7 (tags/v3.12.7:0b05ead, Oct 1 2024, 03:06:41) [MSC v.1941 64 bit (AMD64)]

I can run bin\statistics.py

JS220-004622 0.0: -0.000000002 A, -0.418 V, -0.000000003 W, 0.000000000 C, 0.000000000 J
JS220-004622 0.0: -0.000000002 A, -0.418 V, -0.000000003 W, -0.000000000 C, 0.000000000 J
JS220-004622 0.0: -0.000000002 A, -0.418 V, -0.000000003 W, -0.000000000 C, 0.000000000 J
JS220-004622 0.1: -0.000000002 A, -0.418 V, -0.000000003 W, -0.000000000 C, 0.000000000 J
JS220-004622 0.1: -0.000000002 A, -0.418 V, -0.000000003 W, -0.000000000 C, 0.000000000 J
JS220-004622 0.1: -0.000000002 A, -0.419 V, -0.000000003 W, -0.000000000 C, 0.000000000 J
JS220-004622 0.1: -0.000000002 A, -0.420 V, -0.000000003 W, -0.000000000 C, 0.000000000 J
JS220-004622 0.1: -0.000000002 A, -0.420 V, -0.000000003 W, -0.000000000 C, 0.000000000 J
JS220-004622 0.2: -0.000000002 A, -0.420 V, -0.000000003 W, -0.000000000 C, 0.000000000 J
JS220-004622 0.2: -0.000000002 A, -0.420 V, -0.000000003 W, -0.000000000 C, 0.000000000 J
JS220-004622 0.2: -0.000000002 A, -0.420 V, -0.000000003 W, -0.000000000 C, 0.000000000 J

but running bin\monitor.py just sits there. No warnings or errors. Something did run, because bin\statistics.py runs faster than the first time I ran it before monitor.py. Anything obvious I’m missing? Will try stepping through it.

It finds and opens the device just fine:

Hello World - just one Joulescope found

Hello World - Before monitor.open u/js220/004622 -

Hello World - after monitor.open

I’ve been working fine with the other commands - just monitor.py is giving me issues

Hi @scobb and welcome to the Joulescope forum!

The description for this script is:

Inspect current data for errant conditions. On an errant condition, record data for analysis. For now, records 50 Hz statistics data to both a JLS v2 file and an Excel XLSX file.

So, this script does not do anything until it detects and errant condition, which is hard coded to self._i_threshold = 0.001 # 1 mA. Until your input exceeds 1 mA, it will just sit there waiting.

If I remember right, we made this for a customer looking for a specific issue in their device. The script says CAUTION: UNDER DEVELOPMENT for a reason. It looks like we never generalized it to customize the errant condition.

Are you looking to customize a measurement and having trouble finding a good starting point?

Hi,

Haha - on me. Thanks for the response. Yes, I didn’t look to carefully at what it was trying to do - now it makes sense. I’ve been looking at and working with the other examples and having reasonable luck.

Is there a simple example that periodically (say every 10 seconds) and spits out current and Voltage? Then every 20 seconds, also spits out the current Joule count. I think the documentation is sufficient, but working examples always help.

Eventually, I’ll tie it to a GUI. Planning on using Tkinter as the GUI framework. Anyone have luck with that? Or a recommendation for one of the other GUI frameworks?

If there is any interest, I can post some simple examples.

Thanks all,

Steve

Hi @scobb,

The lowest statistics frequency that the JS220 supports is 1 Hz. See statistics.py. If you would rather use pyjoulescope_driver, see the statistics entry point. You can run this using python -m pyjoulescope_driver statistics.

If you want lower than 1 Hz, you can combine statistics on the host side. As long as you don’t care about standard deviation, it’s easy. See downsample_logging.py for an example. Computing standard deviation is not too bad.

The Joulescope UI uses PySide6 / Qt6. You can steal the Multimeter widget.

Another approach is to make a Joulescope UI plugin.