| Electronics > Projects, Designs, and Technical Stuff |
| Reading high currents on PCB: Hall effect sensor vs shunt resistor |
| (1/7) > >> |
| superKris:
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: --- Code: ---// 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 --- End code --- 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? |
| nctnico:
The simplest solution is to make sure your ADC's reference is powered from the same supply as the HAL sensor chip. That way the midpoint of the HAL sensor is always aligned with the midpoint of the ADC reading. ADCs inside a microcontroller typically have this. BTW: did you think about measuring the voltage drop across a PCB trace? If you add an NTC to measure the temperature of the board you can compensate for the temperature coefficient of copper and still get a reasonably accurate reading. You'll need a (low offset) current sensing amplifier chip but it is a relatively cheap and reliable solution especially for very high currents (10s of Amperes). Something else you need to consider are significant digits. If your range is 50A and your accuracy is 2% then your resolution is about 1A. All in all you shouldn't display the current with a higher resolution than 1A. So a 400mA offset should be rounded to read 0. |
| guenthert:
You haven't told us, whether this is a one-off project or a larger production run. If the former, than I don't think you'd need a highly accurate 5V source for your sensors, just a stable one. The latter typically excludes post-production calibration and you'd have to get precision parts to stay within the error budget. Speaking of which -- "but i do need 0A to be displayed as 0A (or at least close to this)" -- how close is close? |
| superKris:
--- Quote from: nctnico on May 05, 2020, 04:00:45 pm ---The simplest solution is to make sure your ADC's reference is powered from the same supply as the HAL sensor chip. That way the midpoint of the HAL sensor is always aligned with the midpoint of the ADC reading. ADCs inside a microcontroller typically have this. BTW: did you think about measuring the voltage drop across a PCB trace? If you add an NTC to measure the temperature of the board you can compensate for the temperature coefficient of copper and still get a reasonably accurate reading. You'll need a current sensing amplifier chip but it is a relatively cheap and reliable solution especially for very high currents (10s of Amperes). --- End quote --- Thanks for your reply! Unfortunately the ADS1015 does not have a way to use a external reference. I would need to switch ACD but i really like this one for its great libraries and easy use. The ACD's on the uC are already in use, and i dont like their accuracy (Arduino nano). I'm not sure about using a PCB trace. I dont know how accurate these are and i want to use large copper areas instead of normal traces with al components very close together. --- Quote from: guenthert on May 05, 2020, 04:01:50 pm --- You haven't told us, whether this is a one-off project or a larger production run. If the former, than I don't think you'd need a highly accurate 5V source for your sensors, just a stable one. The latter typically excludes post-production calibration and you'd have to get precision parts to stay within the error budget. Speaking of which -- "but i do need 0A to be displayed as 0A (or at least close to this)" -- how close is close? --- End quote --- For now its just for me, but i am designing it as a commercially viable product that, if it works, i will try to sell of give away the design for free. Batch size will be low. A few pcs to 10 or a multiple of that. Lets say a error of 5% is fine, but 0 should be close to 0. I want to be able to see the difference between 0 and lets say 200mA. The current parts offer a resolution of 30/ 75mA. Maybe a 2* LSB accuracy would be acceptable but i do think the resolution is low enough to be spot on. |
| David Hess:
--- Quote from: superKris on May 05, 2020, 03:46:45 pm ---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) --- End quote --- The hall sensor is intended to be used as half of a Wheatstone bridge providing a differential signal insensitive to supply voltage. A voltage divider across the supply voltage provides the other signal and then either an ADC with a differential input is used or an instrumentation amplifier can convert the differential signal to a ground referenced signal. --- Quote ---- Use a very accurate 5V reference for VCC, so my 0A is stable --- End quote --- The supply voltage itself does not need to be stable. --- Quote ---- Add a extra ADC to measure actual VCC and calculate a dynamic offset --- End quote --- Or use an ADC with differential input, or use an instrumentation amplifier to produce a ground referenced signal. --- Quote from: nctnico on May 05, 2020, 04:00:45 pm ---The simplest solution is to make sure your ADC's reference is powered from the same supply as the HAL sensor chip. That way the midpoint of the HAL sensor is always aligned with the midpoint of the ADC reading. ADCs inside a microcontroller typically have this. --- End quote --- It is the offset which is changing with supply voltage and not the gain. |
| Navigation |
| Message Index |
| Next page |