Automating current sink functionality using set_battery_profile

I’d like to control the battery profiler through the JSON TCP API. Specifically, I’d like to programmatically update the “constant current” value as seen in the image below:

I see the set_battery_profile() function in Python here, but this fails with the following error message:

otii_tcp_client.otii_exception.Otii_Exception: {'type': 'error', 'errorcode': 'Invalid command', 'cmd': 'arc_set_battery_profile', 'trans_id': '5', 'data': {}}

Looking at the TCP server documentation here, I see no reference to the battery profiler. What might I be missing? Do I need to use a different version of the TCP server?

The functionality I’m interested in is documented as “programmable” here:

I found another option, inspired by an old energy harvesting example. My goal is to sink current into the Otii (specified by current_amps variable in the code below). Is this approach viable?

# Configure the device
ace.set_power_regulation("current")
ace.set_main_current(-current_amps)

# Enable measurements for main current and main voltage.
ace.enable_channel('mv', True)
ace.enable_channel('mc', True)

# Turn on the current sink.
ace.set_main(True)

Hi and welcome to the forum,

Today, I recommend using the set_main_current API, to control the current sink.
The example script added here is a great start!

Best regards,
Björn

1 Like

Great. Thanks for the response, @bjorn.rosqvist. I’ve gotten everything up and running successfully with the set_main_current approach.

Hi @bjorn.rosqvist,

Do you have any documentation on how the Otii’s current sink functionality is supposed to work? I’m seeing unexpected behavior using the approach described above.

I’m trying to measure the efficiency of a boost converter. I have the Otii hooked up to the output to sink current. I’m using a bench source and DMM on the input side. The Otii works fine for the low current values, but it starts to fail as I try to sink more current. Everything works as expected when I replace the Otii with an equivalent resistor.

Example numbers: 2V output, 20mA sink current.

Thanks for your help.

Best,
Charlie

Hi Charlie,

Either share your script here or create a case in our case system and share the script there.

Could you also explain what you mean with that “it starts to fail”, please.

Best regards,
Björn