Starting app kills power

Joulescope Version: v0.8.11
OS: mac Mojave.

When I start the joulescope app the power to my device is cut momentarily - causing my device to reboot. If I quit the app, the device continues to operate normally, but restarting quits.

I tried downgrading to v0.8.9 with no luck.

I am not 100% sure, but it may be related to me re-installing the libusb using

brew install libusb

Current libusb is:

/usr/local/Cellar/libusb/1.0.23 (26 files, 467.3KB) *

Any clues how to keep everything running?

1 Like

Hi @graemerae and welcome to the Joulescope forum!

As of Joulescope UI 0.8.11, the UI resets the Joulescope when it connects. The original reason was to ensure that the Joulescope was functioning in a known state. Unfortunately, we do not have an option to change this behavior at this time.

The UI does have an option for what happens on exit. See File → Preferences → Device → on_close.

Longer term, we could add an option on what the UI does on connecting to a Joulescope. I think that the options are:

  • reset (existing behavior)
  • reconnect (what you want)

However, in all cases, the Joulescope UI would restore its configuration for things like current range and voltage range.

Would this feature be useful for you?

BTW, if you are using python to script Joulescope behavior, I believe that you can do this today:

from joulescope import scan_require_one
device = scan_require_one(config='ignore')

The Joulescope UI deals with managing settings more automatically which makes not reseting more complicated.

I am using a script. If I get the device running with the scope attached and then run the sample script:

import joulescope
import numpy as np
with joulescope.scan_require_one(config=‘ignore’) as js:
data = js.read(contiguous_duration=30)
current, voltage = np.nanmean(data, axis=0)
currentMax, voltageMax = np.nanmax(data, axis=0)
print(f’{current}, {currentMax} , {voltage} , {voltageMax } ')

The device actually turns off and does not return

% python3 record.py
EndpointIn(0x82): timed out
EndpointIn(0x82): timed out

config=‘ignore’ - device turns off, no data collects. (regardless of whether device is running already)
config=‘auto’ - device reboots, data collects.
config=None - device turns off, no data collects.
config=‘Off’ - device turns off, no data collects.

Yes - I have a complex computer/sensor system and I need to be able to monitor power usage in various configurations of sensors, software etc. Having the system boot each time means I cannot compare, say, all the sensors and software running and then sending a message via a sat modem.

All I need to do is be able to reset all the accumulated or average values to zero right before I run a test

Hi @graemerae

I confirm that I see a variable duration of OUT shutoff, usually on the order of 10 ms, when you use ‘auto’ and use pyjoulescope to open a connected Joulescope. I used a bench supply set to 2.5V as the supply. I connected a banana to BNC adapter, a BNC cable, and BNC T with one end connected to a 50 ohm BNC termination and the other connected to my oscilloscope. I triggered at 2.4V falling edge.

I took a closer look, and I found the root cause. In the ‘auto’ configuration, the ‘source’ setting is applied immediately, but the default for ‘i_range’ is ‘off’. It’s not until the next settings is applied that ‘i_range’ is turned back on. This produces the temporary glitch. By rearranging the order of applying settings, we can avoid this glitch with no bad effects.

This code no longer exhibits a glitch:

import joulescope
with joulescope.scan_require_one(config='auto') as js:
    data = js.read(contiguous_duration=1)

The change is to the order of lines 333-337 in joulescope/parameters_v1.py:

    'auto': {
        'i_range': 'auto',
        'v_range': '15V',
        'source': 'on',
    },

I just created a new Joulescope 0.8.13, which is now available on pypi:

pip3 install -U joulescope

Please let me know either way if this fixes the issue for you!

"while I have you on the phone… :wink: "

trying to install the code from scratch was quite a pain a couple of days ago. There are some hidden gremlin characters (I recall in ‘version.py’) that I manually deleted - now when I try to upgrade again I get:

Downloading joulescope-0.8.13.tar.gz (605 kB)
|################################| 605 kB 1.9 MB/s
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/private/var/folders/fg/ky3tqb1j7yqgk8n2mspj9p200000gn/T/pip-install-749s9ti9/joulescope/setup.py’"’"’; file=’"’"’/private/var/folders/fg/ky3tqb1j7yqgk8n2mspj9p200000gn/T/pip-install-749s9ti9/joulescope/setup.py’"’"’;f=getattr(tokenize, ‘"’"‘open’"’"’, open)(file);code=f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ egg_info --egg-base /private/var/folders/fg/ky3tqb1j7yqgk8n2mspj9p200000gn/T/pip-install-749s9ti9/joulescope/pip-egg-info
cwd: /private/var/folders/fg/ky3tqb1j7yqgk8n2mspj9p200000gn/T/pip-install-749s9ti9/joulescope/
Complete output (7 lines):
Traceback (most recent call last):
File “”, line 1, in
File “/private/var/folders/fg/ky3tqb1j7yqgk8n2mspj9p200000gn/T/pip-install-749s9ti9/joulescope/setup.py”, line 46, in
exec(f.read(), about)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/encodings/ascii.py”, line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xe2 in position 81: ordinal not in range(128)

Blockquote

If I look at the version file: I see this:

Blockquote
version = “0.8.13”
title = “joulescope”
description = ‘Joulescope E2 84 A2 host driver and utilities’
url = ‘https://joulescope.readthedocs.io
author = ‘Jetperch LLC’
author_email = ‘joulescope-dev@jetperch.com’
license = ‘Apache 2.0’
copyright = ‘Copyright 2018-2020 Jetperch LLC’
Blockquote

(but E2,84 and A2 are gremlin characters and they trip up the install.)

Those are unicode bytes representing the ™ code point. The existing files build on Windows, macOS, and Linux, so I have no idea why Python is not correctly handling this file for you. Can you see if this works for you? (modified from the Install from Source documentation):

git clone https://github.com/jetperch/pyjoulescope.git
cd pyjoulescope

Open setup.py in your favorite editor and change line 45 like so:

about = {}
with open(VERSION_PATH, 'r', encoding='utf-8') as f:
    exec(f.read(), about)

Then build and install it:

pip install -U .

Yep. That works! (Can’t test the script right now, my battery died - I’m recharging it now)

Battery charged. Can confirm that the python script with config=“auto” works. Device does not restart each time and data collected as normal.

The desktop app still reboots the device when the app starts up.

What would serve me perfectly would be a big “RESET STATS” button in the app, that zeros every statistic, max, min, etc - kinda like the “clear energy” but for everything. If you could make it a keypress too - ie “command / ctrl-R” for reset so I can hit it right when I need to - that would be ideal.

The pyjoulescope develop branch now contains the encoding=‘utf-8’ fix.

The pyjoulescope_ui develop branch now contains two fixes:

  • Added encoding=‘utf-8’ to setup.py to fix package install on macOS.
  • Fixed momentary power OUT power glitch when reconnecting using ‘auto’.

All of these fixes will be in the next official release. Thanks the time to report these issues and verifying the fixes!