How to use user fuses

Hello!

I searched the information about how to use user fuses in joulescope_driver, pyjoulescope_examples and pyjoulescope_examples repositories and found only few lines in js220.txt:

{p}/s/fuse/{N}/T : unsigned 8Q24 threshold level
{p}/s/fuse/{N}/K : unsigned 8Q24 decay level

that some how corresponds to Joulescope JS220 User’s Guide
but among parameters I see:

s/fuse/0/F {'dtype': 'u32', 'brief': 'Fuse accumulation constant 4q14.', 'default': 0}
s/fuse/0/K {'dtype': 'u32', 'brief': 'Fuse dissipation constant 8q10.', 'default': 0}
s/fuse/0/en {'dtype': 'bool', 'brief': 'Enable/disable the fuse.', 'default': 0}
s/fuse/0/engaged {'dtype': 'bool', 'brief': 'Set to 1 when engaged, set to 0 to clear.', 'default': 0}

Could you give an idea how I can use it?

Hi @Victor - We have not documented how to use the fuses directly from a Python script, but it’s not that difficult. First, js220.txt is out of date. We ended up moving the calculation off of the JS220 and only provide accumulation and dissipation constants.

See js220_fuse for how the Joulescope UI uses fuse_to_config to convert the two thresholds and a duration into the values for F and K. It then sends these values to the JS220 here.

You can copy fuse_to_config into your script (also to_q and the constants) and do something like:

    threshold1 = 1.0  # in amps
    threshold2 = 2.0  # in amps
    duration = 0.1  # in seconds
    fuse_config = fuse_to_config(threshold1, threshold2, duration)
    driver.publish(f'{device}/s/fuse/0/en', 0)  # fuse disabled for configuration
    driver.publish(f'{device}/s/fuse/0/F', fuse_config['js220_fq'])
    driver.publish(f'{device}/s/fuse/0/K', fuse_config['js220_kq'])
    driver.publish(f'{device}/s/fuse/0/en', 1)  # fuse enabled

Alternately, you can compute the F and K constants and then just use them in your script.

The fuse will never trip below threshold1. The fuse will trip in duration at threshold2, slower between threshold1 and threshold2, and faster above threshold2.

For details, see the User Fuse section of the Joulescope JS220 User’s Guide (page 36 in version 1.9).

Please post again with any questions and if you are able to get this working!

I thought of something else. Your script will also need to subscribe to f'{device}/s/fuse/0/engaged' so that your script is notified that the fuse engaged.

I added a complete fuse_js220.py example. Hope this helps!

Hi @mliberty !

Thank you very much for the example. It will help me a lot!

1 Like