# Best way to calibrate ADC for current sense MOSFET

I'm using the infinion BTS6143 as a current switch and current measurement device in combination with an STM32 controller.

The BTS6143 is an integrated MOSFET with internal charge pump and $I_{sense}$ output.

The ADC value proportional to the load current $I_L$ is calculated by:

$$Value_{ADC} = \frac{680 \Omega * I_L}{3,3V*k_{ILIS}} * 4095$$

My problem is that the $k_{ILIS}$ is higly dependent on the load current as shown in the data sheet:

Especially for very small currents under 1A.

My "solution" to the problem was to calibrate the device with 5A which I measured quite precisely with a fluke multimeter. With this the µC now knows what 5A are.

With the 1 calibration point and the ADC starting at zero I get 2 points

$P_1 (0|0), P2(5|ADC(5A))$

and can calculate a slope for a straight line: $$f(x) = \frac{ADC(5A)}{5A} * x$$

I measured a few devices after using this method and this gave me an error of about 5% at currents from 6...10A, but on some devices I got errors of 50% for currents around 1A.

So I introduced another calibrationpoint at 1A, which brought me down to 3% error at 1A. I used this point only to tell the device what 1A is. Not to modify my straight line, which I still calculate from the 5A point.

With the error at 1A down I checked what the next critical point is which was at 2A (10-15%), so I tried (ADC(1A)+ADC(3A))/2 which roughly halfed the error at 2A.

Now everything is below 10% of error from the ideal value for the current and I could live with that, but is there a better way, or things to improve? I can only take 2 calibration points, due to some restrictions and I can't calculate a line from the ADC value at 1A and 5A, because the point at 1A ruins the line for larger currents.

• Figure 6B in the datasheet shows the current sense ratio, and it really looks like a device that is going out of saturation and then into subvt with an exponential I-V relationship (just looking at the shape), so your linear fit would have to be modified with some rolling value, and not a purely linear relationship. Feb 14, 2016 at 19:39
• @bdegnan What do you mean by rolling value? What I do at the moment is calculating the ADC values for 1A, 2A, 3A .... 10A with $$f(x) = \frac{ADC(5A)}{5A} * x$$ and write them into an array. Then I overwrite the value for 1A with the value I actually measured at 1A. This brings my error down at currents around 1A. My next step was to take my ADC value for 3A and 1A, and take the mean and write this to the array at the value for 2A. That basically halfed the deviation at 2A. Feb 14, 2016 at 20:11
• So, you have these values; however, I do not believe that they are actually as linear as you think, however, you probably can approximate it. When you get near 1A, you start having a different behavior, which is what I would expect to see as a device that is long moves less current so you see the other effects, like the depletion encroachment at the drain edge of this "super huge" mosfet. I would expect the correlation, as you go to large to small currents, linear, roughly quadratic (x^1.8) and then exponential. Just trying to read into that graph. Feb 14, 2016 at 21:02
• One more note, I would expect good variance between devices on the same wafer run, but I usually see mismatch of 2% between runs, so be sure your calibration routine doesn't count on the devices to behave identically. The first 10k units might work out, but the next batch might have an offset. Feb 14, 2016 at 21:03
• @bdegnan They aren't that linear, but for larger currents the K_ILIS is quite stable and linear. My problem was especially with lower currents. That problem was solved by taking a point at 1A. The question was if that was a good way to solve this or not. Feb 16, 2016 at 18:18

You may not be able to achieve what you set out to do. When calibrating treat the system as a black box, there are inputs and outputs. Your are trying to find out what goes on inside the box and model it in some way. The model may be easy or it may be difficult. If you can come up with a good enough model, you can calibrate almost anything. If its linear or follows a polynomial relationship it is even easier to calibrate.

You see the system as a box with current in (the actual current which you want to measure) and the black box as your IC/Mosfet and the voltage out of the IC measured by your ADC as the output. Your model is the equation as described above.

With calibration you have to know the inputs and the outputs THIS IS ESSENTIAL!

If K_ILIS were constant your calibration routine could be this
1) Put in a known current like 1Amp (input), measure voltage on ADC (Output)
2) Put in a known current like 2Amps (input), measure voltage on ADC (Output)

And the rest is plug and chug. You'll get your value for K_ILIS. This will give you a decent result for the part of the curve that doesn't change (above 3A or so).
If you want to get more detailed, you could do a first order linear fit.

y = m*x + b where y is your ADC measurement (output), and x is your I_L and 680*4095/(K_ILIS*3.3) is your m value. The problem with doing this is you still aren't going to get a good fit. You can only model a line, which would be the equivalent of getting a ruler and drawing a line through the curve, you will still have quite a residual left over in the 0 to 3Amp range.

So another trick in the bag is to move to a higher order like this model:
y= c3*x^3+c2*x^2+c1*x+c0
The problem with this is a line needs at least two points to define it. Fitting a curve would need much more data. There are other fitting functions, a sigmoid might work
y=c2/(c1+exp(c0*t))+b
but these need optimization routines to find all the constants and again, you would want to take as many samples as you could.

One of the problems I see is that K_ILIS is also dependent on temperature and its the junction temperature so that means that if you were to measure it, it would have to happen at the IC. You would have to calibrate it for temperature and know the temperature. It seems the temperature curve of K_ILIS varies from device to device also.

This phrase suggests that K_ILIS is constant on every device but this conflicts with the information in the diagnostic characteristics section, I think its a mixture of the two:

This range for the current sense ratio refers to all devices. The accuracy of the kILIS can be raised by means of calibration the value of kILIS for every single device.

So if you were to do a temperature calibration, you would have to know the temperature. Once you knew the temperature you could look up the value of K_ILIS, but you would still have to figure out how it changes over temperature. It doesn't look like you could come up with an easy emperical formula or function (such as an exponential or sigmod). If I were to do this and I had no other way to change the design, I would use the table given to me OR I would run experiment after experiment to characterize K_ILIS over temperature in a lab based setting. Then I would use this data in a look up table on the micro but I would still have to know the temperature. Can you put an thermistor on the IC? Probably not. The current range you are trying to measure is very large. In my experience it is really difficult to get the first 5% of the current measurements range. Part of the problem is there leakage currents and offsets become as large as the voltage measurement from whatever is measuring the current whether it be a differential signal from a sense resistor or via other means.

I think its time you revisit your requirements. It seems you have two or three requirements.

1. Simple calibration
2. 1% Current measurement accuracy from 0A to 40A (you can insert whatever number you wish for the 1% and 40A)
3. Low price

If you have to have 2) and 3) you can't have 1). If you don't need 3) I would consider adding another method for a "high gain" current measurement that would let you zero in on the 0 to 1A range.

I also think part of your problem is not writing requirements in the first place. Its a good way to design things, then you have a discussion of your options before they are on a PCB.

I don't have enough reputation for comments, but here is suggestion. You can try manually or in Matlab create your function k=f(I) regarding to figure 6b (MATLAB has some interpolation functions, on the basis of points that you enter). Than you can use that function instead of using k.