I’ve been designing a breakout board for the ACS758 hall-effect current sensor. The first few prototype boards came in and I decided to give them a quick test. The results were not quite as I expected so I thought I’d put write about them here, for others that might be using this IC.
These current sensors come in a number of ranges (50A,100A, 150A and 200A, all with uni and bi directional variants). They use the hall-effect, which measures the change in the magnetic field to measure current. This means you do not need to install a shunt resistor, with its associated power loss and voltage drop.
The board requires a 3-5V supply and outputs a voltage signal which is proportional to the current flowing through the main part of the device.
I was using testing a couple of ACS758-LCB-050U, which is the uni-directional 50A version.
I did not have a regulated 5V supply, but did have a 3.3V regulated supply, so was powering the IC from 3.3V DC, hence I needed their characteristics at 3.3V. It is noted in the data sheet that the output specifications will vary if the unit is supplied with 3.3V and that “Customers that plan to operate the device from a 3.3 V regulated supply should contact their local Allegro sales representative regarding expected device accuracy levels under these bias conditions.”
I tested two sensors by putting two of them in series through a 1ohm 200W dump load. I used a 5-16V 20A supply, so I could vary the current. Here is my test set-up:
The first thing to take note of is the output voltage when the current is zero. This is NOT zero.
The data sheet explains:
So the output voltage for 0A is 0.12 x Vcc. With Vcc at 5 V the output will be 0.6V and at 3.3V the output voltage will be 0.396V.
I tested the outputs of two sensors with no current flowing. Here are my scope traces at 5V and 3.3V:
Traces with 5V power supply and 0A. The yellow and blue lines are outputs from two sensors. The average outputs are 0.597V and 0.592V, so quite close to the 0.6V calculated, but still a bit off. This might be due to variation in the input power supply voltage.
At 3.3V supply a slightly weird thing happens, the output voltages at 0A are different. The calculated output voltage is 0.396V, but I am seeing 0.376 V (yellow) and 0.391V (blue).
As the power supply voltage is reduced, we see that the normal 0A offset voltages start to vary from each other. This would be fine if they were the same, as we can just put an offset in to the code, but each one is slightly different. There is a 15mV difference, which is within the data sheet tolerances, but causes bad results if the same conversion algorithm is applied to each sensor.
This suggests that each sensor will need to be calibrated separately, which needs thought at the code stage.
Once the offset voltage is known and calibrated we now want to calculate the current from out output voltage. The sensitivity is shown in the data sheet:
For this IC it is 60mV per amp. I rigged up some test loads and tried to calculate the current from the output voltage.
This was not working until I realised that the sensitivity is ratio-metric to the input voltage. This means that the sensitivity at 5V input is 60mV, but it will be less at 3.3V input. The difference will just be the difference between the power supply voltages: so 3.3/5.0 = 0.66 or 66%.
This means the sensitivity at 3.3V is 60mV/A x 0.66 = 39.6mV/A.
Reading data with Arduino
So if we want to read the data from one of these current sensors we can attach it to an Arduino analog pin and then we will need to:
Find the reading at zero amps (we will call this zero offset)
The current will then be = (current reading – zero offset ) * (Vref/1024) / ((Vsupply/5.0) x (60/1000))
We are supplying the ACS758 with 3.3V, our zero offset reading was 112 and our ADC reference voltage is 3.3V as well.
We are taking a reading 184 from the analog pin. This means our current is:
(184-112)*(3.3/1024)/ ((3.3/50)*(60/1000)) = 5.859A
I took this reading when I had 6A flowing. This means there is still some offset/calibration to do, but its within 2.5%.