Joulescope data logging

Questions from a Joulescope user:
I want to log the current and voltage of a charging cycle of a Li-Ion battery. The charging time is about 3h.

  • Is it possible to show the entire cycle on the screen?
  • Is it possible to set the sampling rate?
  • Is it possible to save the data or export images?
1 Like

With the latest 0.5.1 software, the “.jls” file format is about 8.6 MB/s, which is 92 GB for 3 hours. If you are only concerned with monitoring charge or energy, recording the 2 million samples per second is overkill. We recently added to pyjoulescope_examples that records downsampled 2 Hz Joulescope data to a CSV file. Here is what you need:

  • Install python 3.6+ and pyjoulescope. See the instructions. Although we recommend using a virtualenv, that step is optional.
  • Clone the pyjoulescope_examples repo.
  • python pyjoulescope_examples/bin/

Here are the commands for windows without virtualenv. Open a command line (terminal) and type:

cd {your_repo_path}
pip install joulescope
git clone
python pyjoulescope_examples/bin/

The script will print the logging location, which is:


By default, the CSV contains a single line column header. Here is the full help from the script:

>python bin\ --help
usage: [-h] [--header {none,simple,comment}] [--resume]

Capture downsampled data.

optional arguments:
  -h, --help            show this help message and exit
  --header {none,simple,comment}
                        CSV header option. "none" excludes all header
                        information and just includes data. "simple" (default)
                        adds a first line with column labels. "comment"
                        contains multiple lines starting with "#" and also
                        inserts events into the CSV file.
  --resume, -r          Resume the previous capture and append new data.


Here are example output files:

Units are SI: second, ampere, volt, watt, coulomb, joule


Just what I was looking for. I was planning to code something similar (but likely not as good).

Is this still processing the full 2MSPS? I presume the output is average values?
Any chance this will be extended to include min & max values per time interval? At least for current.
I may find some time to do that and create a PR - but probably not for a week or two.


Hi @Kean, Just capturing data is much simpler (see, and much of the extra complexity in comes from the error handling and recovery.

Yes. The Joulescope sampling still runs at 2 MSPS, and those full rate samples are used to compute power. The existing output for current, voltage and power are the average (mean) values. The existing implementation uses a rectangular window (trivial window) with no other downsampling filter. The energy is the discrete integration (sum multiplied by period) of power.

Adding other statistics and configurable CSV columns should be relatively straightforward. The implementation uses the same statistics as the multimeter display, so variance, standard deviation, min, max, and peak-to-peak are available.

1 Like

Hi, I downloaded the python joulescope files and tried to test the function. I did the example “python3 -m joulescope capture --contiguous 1.0 mycapture.jls”. I can see the .jls file, but when I open it, I only get readings of the voltage stored. The current values are always 0. I know I’m drawing current on my device in thetestcapture.jls (1.5 MB) uA range. Any reason why my captures are not storing any data for the current reading?

Hi @Gary,

In 0.5.0, I added a “config” option so that Joulescope devices were not automatically initialized. This causes the example to leave the i_range parameter set to off which keeps your target powered off. For now, you can insert a line to set i_range after line 75 in

device.parameter_set('source', 'raw')
device.parameter_set('i_range', 'auto')
device.start(stop_fn=on_stop, duration=duration, 
1 Like

Awesome that was the issue! thanks

I just updated the script to support additional downsampling using the --downsample command-line option. The script normally logs at 2 Hz. To record 1 sample per minute, provide --downsample 120. I also improved the documentation within the script to more clearly explain how to use it. I tested logging data with both the Python joulescope 0.5.x package and the upcoming 0.6.x. A quick 5-minute accuracy test with constant 3.3V and 1000 Ω load (shown in the documentation) works correctly with both --downsample 1 (default) and --downsample 120.

You can tail the CSV log file to check on the script and the charge/energy. On linux and macOS (with brew), use:

tail -f {filename}

On Windows, you can use PowerShell. Here is an example of using Windows PowerShell to tail the CSV file:

Get-Content {filename} -Tail 2 -Wait

Please don’t hesitate to post with your feedback, questions, or issues!


Is it also possible to log this way with a higher frequency, like 20Hz or more?

1 Like

Not with the existing script, but it should be possible without that much work. I’ll add it to the near-term list.

Note to self: modify the reductions in the stream buffer instance to [200, 50, x] and allow x to be [2, 4, 10, 20, 40, 100] for [100, 50, 20, 10, 5, 2] Hz

1 Like

Will handle multiple Joulescopes on the same PC?

Big fan of the product!

Hi @MostlyHarmless Matt and welcome to the forum!

I took a quick look at the code, and it currently “supports” multiple Joulescopes by just selecting the first one. The script only supports a single instance at a time so that it can recover across power losses and reboots, so running two instances is not currently an option.

I see two possible solutions:

  1. Allow for multiple downsample_logging instances where you explicitly state the filename. On resume, the script would need to prompt you for which one to continue.
  2. Detect and support multiple Joulescopes from a single instance. Record a CSV file for each Joulescope attached to the system. The top-level session log would also have to record which Joulescope serial number is associated with which log.

Any thoughts or preferences? What’s your timeframe for starting logging with multiple Joulescopes?

Thanks for the rapid response!

My priority is start my tests this week. Option 2 sounds great with respect to functionality.

Starting testing this week does not give much time. I will take a closer look tomorrow and see if its possible to fit in…

Thanks for the effort! Much appreciated. I will run my tests serially and on a few workstations until then.

I added support for multiple Joulescopes to downsample_logging (click Raw and save). The changes are still in the develop branch since they have only been tested for minutes, and this script needs testing for days. However, it looks good so far.

If you are running on Windows, you should be good to go with the 0.6.8 joulescope package from pypy.
If you are running on Linux or macOS, you will need the latest source. I had to change the device string descriptions to match. Windows is “Joulescope:xxxxxx” but Linux/mac was “Joulescope xxxxxx”.

Excellent! Thank you!

I am able to run 4 Joulescopes at once. Thank you!

Once I went for 5 or 6, though, I ran into some issues. I will post a thorough bug report soon.

Thanks, again for the quick feature addition.

1 Like

You definitely need to use care when running that many Joulescopes. Two considerations are USB bandwidth and power.

Each Joulescope uses 8.1 MB/s when active. USB 2.0 high-speed has a theoretical max of 53,248,000 B/s (see last line of USB 2.0 spec Table 5-10):

However, 40 MB/s is a much more realistic practical max. So, 4 Joulescopes sounds about right! To support more, you will need to use a different USB root on your host computer. It does not matter if you have USB 3 SuperSpeed as SuperSpeed is an entirely separate data path in parallel to USB 2. Also, ensure that any hubs are powered as each Joulescope draws about 0.2 A when active.

Downsampling is currently performed on the host computer. In the future, we may implement downsampling on the Joulescope device to reduce bandwidth requirements. Also, we may implement USB isochronous mode transfers which would help with some of the USB bulk mode transfer fragility as the USB traffic picks up.

Is there a potential timeline for the higher-samplerate logging mentioned above? I’m trying to figure out if this device is suitable for our use case - which is about 100 Khz sample rate, for long periods of time.

I’m also not sure I fully understand the functionality of the above script:

  • If I want to log at the full sample rate, would I just use The code for that includes a SamplingFrequency argument in the DataRecorder; can that be set assuming I don’t want to downsample later?

  • Running results in a .jls file which is to be opened with joulescope.exe?

I would love some clarification on these points :slight_smile:


1 Like