# FlexSEA Wiki

A WEARABLE ROBOTICS TOOLKIT

### Sidebar

##### Integrated Solutions
• Custom Development

i2t

# I²t current limit: Programmable Fuse

Important: this note covers the original I2t protection. If you programmed your Regulate before September 2018 that's what you have. After September 2018 we released an improved version (I²t current limit: Programmable Fuse (v2.0)). The foundation is the same, but handy new features have been added.

FlexSEA-Execute and FlexSEA-Battery/Regulate have an optional I²t protection. This piece of code allows the user to select limits for average and peak currents (of a certain duration). It is essentially a programmable fuse that can be used to protect the circuits, but also the robot that used FlexSEA.

The Matlab/Octave script below allows users to generate the proper constants for the C code. The example uses 5A average, and a peak of 30A for no longer than 2.5s.

```% I2t current limit: user
% JFDuval, Dephy, Inc. 06/14/2017

% Note: use this file to get your #define values. i2t_1.m can be used to test
% your values with different profiles.

clc;
close all;
clear all;
format short eng

% Period, i2t_compute() call:
dt = 100e-3;    %Every 100ms

disp('Program these values in i2t-current-limit.h:')
disp('============================================')

% The algorithm uses 8-bit values: we need to scale down the maximum current
% accordingly. It uses real units (mA). Ex.: ±30000mA sensor =>
% 30000/256 = 117 => shift 7 (div by 128). 30A will give us 234

I2C_SCALE_DOWN_SHIFT = 7  % Closest bitshift available
SCALE = 128;              % (Octave only, avoids bitwise operations)

% Maximum average current you want to support:
maxAvgCurrent = 5000;    %mA
I2T_LEAK = (maxAvgCurrent / SCALE)^2

% Maximum current you want to support, and duration:
currentLimit = 30000;     %mA
currentLimitTime = 2.5;   %s
I2T_LIMIT = (currentLimitTime / dt) * ((currentLimit/SCALE)^2 - I2T_LEAK)

%At what fraction of the max to you want a warning? (0-1)
warn = 0.8;
I2T_WARNING = warn * I2T_LIMIT

% Plotting:
CURR = maxAvgCurrent:1000:30000;
tmp = (CURR./SCALE).^2;
time = (I2T_LIMIT * dt) ./ ( tmp - I2T_LEAK );
figure()
plot(CURR, time)
title('Time before reaching the I2t limit')
xlabel('Current (mA)')
ylabel('Time (s)')

disp('Time at 6A:')
CURR = 6000;
tmp = (CURR./SCALE).^2;
time = (I2T_LIMIT * dt) ./ ( tmp - I2T_LEAK )```

The script will output constants, and a plot:

```Program these values in i2t-current-limit.h:
============================================
I2C_SCALE_DOWN_SHIFT =     7.0000e+000
I2T_LEAK =     1.5259e+003
I2T_LIMIT =     1.3351e+006
I2T_WARNING =     1.0681e+006
Time at 6A:
time =   198.8636e+000```

## Tips & Examples

The examples below are based on a Pocket board with a ±5A sensor, 1.5A continuous and 5A 500ms limit.

```Program these values in i2t-current-limit.h:
============================================
I2C_SCALE_DOWN_SHIFT =     5.0000e+000
I2T_LEAK =     2.1973e+003
I2T_LIMIT =   111.0840e+003
I2T_WARNING =    88.8672e+003
Time at 1.6A:
time =    36.6935e+000```
• The standby current gets added to the load current. On a 30A board that's negligible, but on a ±5A board with a low limit that can be significant. As you can see, adding 100mA to the 1.5A load will make the protection trip after 37s instead of infinity.
• Why does my board turn off with 1A for 900ms and 5A for 100ms? 1²*0.9 + 5²*0.1 = 0.9 + 2.5 = 3.4, sqrt(3.4) = 1.84A DC. Just the pulse is equivalent to 1.58A DC, enough to kill it.
• How long do I need to wait between 5A 500ms pulses (assuming 0A the rest of the time)? 25*0.5 = 12.5, and our limit is 1.5. 1.5/12.5 = 12% duty cycle, so you need to wait at least 4.17s (0.5s/0.12) before the next pulse.

## Pre-computed values

2.5A continuous, 15A for 1s, non-linearity at 22.5A:

```I2C_SHIFT =     7.0000e+000 (7)
I2T_LEAK =   381.4697e+000 (381)
I2T_LIMIT =   133.5144e+003 (133514)
I2T_NON_LINEAR_THRESHOLD =   175.7812e+000 (176)

Time at given current (mA):
CURR =    25.0000e+003
time =   353.5354e-003
timeNL =    87.7193e-003```

10A continuous, 15A for 1s, non-linearity at 20A:

```I2C_SHIFT =    7.0000e+000 (7)
I2T_LEAK =     6.1035e+003 (6104)
I2T_LIMIT =    76.2939e+003 (76294)
I2T_NON_LINEAR_THRESHOLD =   156.2500e+000 (156)

Time at given current (mA):
CURR =    25.0000e+003
time =   238.0952e-003
timeNL =    22.6244e-003``` 