For the purposes of discussion I’m going to divide current measurement up into three parts: Analog to Digital Converter, Sensor, Amplifier. This is the approximate order I picked out components and design patterns; however there was a fair amount of iteration in each area before reaching the final configuration. The sections function pretty much as described. The analog to digital converter makes the analog measurement useable by the digital micro controller. The sensor converts the parameter we’re trying to measure into a voltage. And the amplifier matches the output range of the sensor to the input range of the converter. Since the amplifier is the most detailed it’s getting its own post.
Analog to Digital Converter
I’ve wanted to try a high bit external analog to digital converter (A/D) for a while and this seemed like a good opportunity. Additionally, while the Arduino does have an onboard A/D, it’s only 10 bits. Based on the target measurement range (1-400 mA) a 10 bit A/D means there’s two bits per mA making conversion the limiting factor in measurement resolution which is usually something you’d try to avoid. After looking at a couple of different options I picked out a NAU7802 24 bit A/D for three reasons: 24 bit is plenty of resolution for this project, it communicates via I2C which should be relatively easy to communicate with the Arduino, and it is very cost competitive.
Step one with the A/D is to have it talk to the microcontroller and take some readings to see how well behaved it is. I wired up the converter using the recommended circuit from the datasheet except I replaced the Wien bridge with my Heathkit variable output power supply to provide a range of voltages to the measurement pins. I quickly discovered that Vin1N pin needed to be connected to Vref/2 since the output was a signed 24 bit number, and to get negative numbers the voltage on Vin1P needed to be less than the voltage on Vin1N. I also noticed some other anomalies near the extremes of the input voltage range.
I didn’t dig too far into the source of these anomalies. They represent a range reduction of <10% and I was only planning on using 80% of the range anyway; so, I designed around the anomalies. This was accomplished in two parts first I would have the amplification stage linearly bias the measurement by ~100 mV so that operation was always in a region above the lower anomaly and then I’d set the sensor amplification so that 400 mA resulted in an input to the A/D of ~2.5 V.
Three common sensors for current measurement are a current sense transformer, a Hall effect sensor, and a current sense resistor. The goal hear is to measure the mA being consumed by the load attached to each output channel. It’s expected that the loads will be primarily DC so the current sense transformer won’t be useful. Since three sensors are required price is a concern and hall effect sensors tend to run few dollars each where as current sense resistors are $0.25-$0.50. So what is a current sense resistor? Well it’s a resistor it converts current to voltage using Ohm’s law. While any resistor can be used for current measurement typically to be classified as current sense a resistor three factors will be considered. low resistance (< 100 mΩ) so that minimal voltage drop out occurs between the source and the load, tight tolerance (< ±1%) so that measurements are consistent across circuits and relatively high power (> 0.5 W). Additionally if you’re measuring a wide current range you may look for one made using a low thermal coefficient of resistance material. A wide range of measured currents means the resistor will operate over a wider range of temperatures, and having a stable resistance over a range of temperatures means readings will be more stable. For this project I picked a 50 mΩ ±0.5% 0805 chip resistor.