Hi All,
I designed a PCB which features a Arduino that is controlling relays, reading currents, and sending data via RS422.
Today I "completed" the software, but i'm not totally happy with the current measurement. I'm looking for opinions on how to improve.
The PCB uses 3 types of current sensors.
- INA219 via external 200A/75mv shunt. (works fine)
- ACS712 via ADS1015 ADC. Needs to read currents up to 20A
- ACS756 via ADS1015 ADC. Needs to read currents up to 40...50A
My main problem is with the bidirectional behavior of the ACS hall sensors. The zero current output of these is 0,5 * VCC. The ADS1015 has a internal voltage reference.
This causes the readout of the ACD to be very different depending on the VCC. A few mV difference can results in a few 100mA readout results.
For my application i dont mind a few % deviation on full scale, but i do need 0A to be displayed as 0A (or at least close to this)
The schematic:
ACS current sensing.PNG (96.52 kB. 1010x855 - viewed 215 times.)
And here is the relevant code im using:
// For analog current sensors some math has to be done to convert raw ADC output to real voltage, and next to current. The formula for this is: (ADCvalue * LSBsize - 2,5) * const - offset
// LSB size depends on ADS1015 setting. A FSR (full scal range) of 6,144V (default) provides a LSB of 0,003 V. A FSR of 4,096 proveds a LSB of 0,002V, but limits the readable range of the current sensors
// The constant is based on scaling of current sensors: ACS712-20A = 10, ACS712-30A = 15, ACS758-50A = 25. Formula: 1000/sensitivity (mV/A). All sensors are bi-directional. Remove -2.5 for unidirectional
// The offset is to compensate for the behaviour of the ACSxxx sensor caused by fluctuations in VCC. Enter a float to set to zero
Isol = (ADS1015output.getSingleEnded(0) * 0.003 - 2.5) * 15 + IsolZeroOff; // Read ADC output, do math, and store to float. See text above for math explanation
Ichar = (ADS1015output.getSingleEnded(1) * 0.003 - 2.5) * 15 + IcharZeroOff;; // Read ADC output, do math, and store to float. See text above for math explanation
Isys = (ADS1015output.getSingleEnded(2) * 0.003 - 2.5) * 25 + IsysZeroOff;; // Read ADC output, do math, and store to float. See text above for math explanation
Iacc = (ADS1015output.getSingleEnded(3) * 0.003 - 2.5) * 25 + IaccZeroOff;; // Read ADC output, do math, and store to float. See text above for math explanation
With the offset set to 0 and a VCC of 4,964V I get the following output.
Isol: -0.1950 A. Raw ADC output: 829 (Raw ADC output at 0A should be 833 for 2,5V/0A. The LSB size is approx 0,003V and 0,03A)
Ichar: -0.1950 A. Raw ADC output: 829 (same as above)
Isys: -0.5500 A. Raw ADC output: 826 (Raw ADC output at 0A should be 833 for 2,5V/0A. The LSB size is approx 0,003V and 0,075A)
Iacc: -0.7750 A. Raw ADC output: 823 (same as above)
I can compensate for this using the offset, but this offset changes with every change in VCC. How can i do this in a better way?
- Use a very accurate 5V reference for VCC, so my 0A is stable
- Add a extra ADC to measure actual VCC and calculate a dynamic offset
I'm not a huge fan of both options, so now i'm considering changing the setup to shunt resistors and additional INA219 sensors.
There is however a disadvantage in using shunt resistors. Even with a low resistance like 50A/40mV, i have to dissipate 2W of power. There will be 2 of these 50A measurements, and there are 2 additional 20A/40mV shunt that will disipate up to 0,8W.
While its not likely to have all currents at maximum often, the dissipation can run up to almost 6W in total, but even at 2 or 3W i will be adding heat to a PCB that has to transfer a lot of current. I'm planning to do a dual 2oz trace on both sides, but this is barely enough.
Additionally, i have no experience at all with PCB mounted current shunts. What shunts with a 50A/40mV are available, and how accurate are these? I can imagine the (position of) soldering on the PCB will influence the resistance.
Also i like the ACS756 for their beefy solder legs. I guess a though hole shunt will be preferred to SMD type with a lot of vias between the layers.
What do you guys recommend? Stay with the hall effect sensors, or make new PCBs with shunt resistors?
If shunt resistors, Can you link any suitable shunts?