Measuring differential voltages across shunt resistors - Page 1
Forum section: electronics / beginners

author: Károly
author_rank: Newbie
timestamp: June 06, 2023, 06:25:52 pm
content: Dear EEVblog forum,I am working on a university project where I need to measure the power consumption of a computer (total power as well as power on HDD and SSD). Unfortunately, I have encountered a problem that is beyond my expertise and was hoping that I could get some help for sorting it out. In theory the task seems simple, I need to measure the voltage of three separate power rails (12V, 5V and 3,3V) as well as the voltage drops across some small current shunts using a PCIe DAQ card made by National Instruments (https://www.ni.com/docs/en-US/bundle/pcie-usb-6353-specs/page/specs.html).Here are some pictures as visual reference:(you can make out the shunts on the bottom right from the big fan in the computer as well as the shunts on the HDD next to the electrical tape.)(shielded twisted pair cables soldered onto shunts on a PCIe riser for the SSD)The problem is that "Maximum working voltage for analogue inputs (signal + common mode)" of my DAQ is +-11V so when I try to measure the 12V rail or the drop on the shunts the measurement just clips. So the 5V and 3,3V rail seem to work fine, it is only the 12V rail that I need to scale down somehow for the DAQ card.Here's a simplified schematic of the original approach I wanted to take to get around this issue:(as you can see ai1-3 are single ended voltage measurements and the others are differential measurements across the shunts)Unfortunately, as before 5V and 3,3V but 12V is incorrect. Since I am a beginner in this field I did not realise that the resistance of the input load into the DAQ will be far too large this way. I did not consider the fact that since this is a multiplexing amplifier it also has a significant input capacitance next to the large input impedance. When the DAQ is multiplexing between the inputs, that capacitor needs to charge and discharge to the new input value before it can be measured. This takes time and that time depends on the output resistance of the measured load. Figure 1 of the specification of the DAQ shows data for this.Now with this in mind here's a schematic that shows more data about what needs to be done showing just the problematic 12V rail:As you can see all I need is three amplifiers that can change the differential voltage across the three shunts to values that my DAQ card can measure. People over the National Instruments forums recommended that I should use "high side current shunt amplifiers" but nobody was yet able to recommend me something specific that is guaranteed to work in this application.Please bear in mind that I'm a computer science student trying to finish a delayed project that outgrew me and I don't really have much experience selecting such components and I am under extreme time pressure. I don't wanna risk building up something that is not gonna work. Considering this, could somebody please recommend me and help me pick a suitable amplifier? Is it possible to build up such a circuit on a matrix board without much trouble? Please also bear in mind that I do not have enormous budget or industry skills, so probably the simplest way to make it work is the best even if it slightly sacrifices accuracy.My rough requirements are the following:- I cannot make my shunts bigger easily so I have to stick with these.- The schematic above shows the currents I'm expecting (70A total can be reduced to 49A if necessary). With this, the voltage drops on the shunts could be anywhere between 0V to 0,161V- The common mode is about 12V- I am taking continuous samples with a rate of 10 measurements per second per channel. But this could be reduced if it is necessary.- The amplifier needs to come in a package that I can hand solder wires to, either by itself on a matrix board or with some dip converter board. If I understand everything correctly I would need to connect three of these one to each shunt (or find a three channel one).- Are there any other factors that I should consider for picking the right component? Something I did not think of yet?With these in mind, I have stayed up all night researching amplifiers as I am not very knowledgeable at this topic. I looked at the TSC103IPT and to me it seems all right (even has features I don't need like adjustable gain) but maybe a bit too small to hand solder wires to. Two other potential candidates I found are the INA282AIDR from TI and MCP6C04 from Microchip and maybe something from analogue devices maxim amps (https://www.analog.com/en/technical-articles/highside-currentsense-measurement-circuits-and-principles.html#/if you look at the sidebar they have many options listed) although I'm sure there are even many more options I did not even consider. Do you, forum members, think any of these could satisfy my demands or can you recommend an alternative even better option that I did not consider?Thank you,Károly

author: larsdenmark
author_rank: Regular Contributor
timestamp: June 07, 2023, 06:41:40 am
content: Maybe you can use a chip that is made for current sensing or current sense aplification.E.g. something like the INA254 (that even comes with its own shunt resistor):https://www.ti.com/lit/ds/symlink/ina254.pdfNote that there are many versions of such chips. Some have analog output (like this one) others have digital outputs.For your voltage sensing circuitry I would choose some smaller resistors than 10M in order to increase the speed.

author: Károly
author_rank: Newbie
timestamp: June 07, 2023, 08:43:28 am
content: I was actually considering the INA240 and INA282 from TI. The INA254 seems a bit different, how would you wire it up onto my circuit? Why do you think it would be better than the other options that I mentioned?

author: larsdenmark
author_rank: Regular Contributor
timestamp: June 07, 2023, 02:57:13 pm
content: The solution depends on what you are trying to achieve. It the purpose of your exercise to learn about current sensing and IO-boards? Or is a practical exercise to see how a PC behaves under different conditions?There are a number of current sense options. There are probably a lot that fits your requirements. You'll just to pick the one that you like the most - and is available.Note that a low of motherboards and PC power supplies can measure power. For more info read this:https://www.techspot.com/guides/2641-measuring-power-guide/

author: Károly
author_rank: Newbie
timestamp: June 07, 2023, 03:07:27 pm
content: The goal is to build up a system that could be used to study the power behaviour of SSDs and HDDs.Some potential chips that I think could work:MAX4372 and MAX4173 from analogue devicesINA240 and INA282 from texas instrumentsMCP6C02 and MCP6C04 from microchipTSC103 from STCan you help me determine if these would work based on the above requirements? How would you derive the required specifications for bandwidth etc from the requirements?EDIT: I can use converter boards from surface mount to dip so package size is not an issue anymore

author: Terry Bites
author_rank: Super Contributor
timestamp: June 07, 2023, 06:30:33 pm
content: You dont need or want an input impedance of 10meg, a few k is high enough for milliohm shunts. 1k ll 1m is only 1ppm error so no worries there.High source impedances seen at the DAQ inputs will cause signifcant DC errors. Z source should be << than Zin of your DAQ. For 10meg your DAQ would need an input impedance well over a Gohm! Add a few pF of stray capacitance across your 10megs and your measurement bandwith will crash to near zero. f=1/(2(pi()CR) so 1pf across 10meg puts you down in the few Hz region.The current waveforms you're measuring will be complex and wideband, DC to MHz. Do you want to average, do you want this to happen pre or post AQ?I would keep my options open. An analog integrator (LPF) on the input side can accurately sift out the typical power usage from instantaneous power consumption.High side sensing can be tricky- if your DAQ can mange 11V of CMV then you shouldn't encounter too many problems.A 1mR shunt gives you 1mV per amp, thats very insensitive. Using the DAQ amplfiers (if any) will add gain and offset error. Its worth calculating an "error budget" and checking that your system error, including bandwidth, falls within. People love to know how certain you are of your uncertainty, a budget fit is a real Kudos earner. Needless to say a higher value of shunt resistor adds a "voltage burden" to the measurment - volts that fail to appear across your load. The tempco of the shunt resistors (generally awful) will create another error term.I've used LTC6101 and LTC6102s, they're fast as well. Very easy to apply. I'd be going for a full scale output from a shunt amp of a volt to feed the DAQ. ADCs love a solid volt.

author: Károly
author_rank: Newbie
timestamp: June 07, 2023, 08:01:41 pm
content: Dear Terry,Thank you for all the useful insight, as I said I'm a beginner computer scientist so I'd lie if I claimed that I understood everything but I'm processing the information.QuoteRegarding resistor sizes, I already decided to change the bridge for measuring the voltage rail potential to 1k resistors. Unfortunately I cannot do the same for measuring voltage drops across shunt resistors as those bridges would draw significant current which would disturb measurement accuracy.QuoteCurrently I am recording 10 samples per second on each rail and then calculating a single average power consumption figure in python after the measurement. Seems to return correct values for the 5V and the 3,3V rail so if I can also figure out a way to wire the 12V rail into my DAQ probably that would work too. I am also using the system to monitor instantaneous power consumption so ideally I would like to keep the averaging until after the measurement.QuoteAs you can see on the second schematic I decided to mitigate this problem by changing it to 2,3mΩ. Unfortunately I cannot increase it any further as it would drop too many volts at max current draw and would go out of spec for the computer load.QuoteOn a first look these seem very similar to the chips that I was considering. Biggest difference I see is that they output current instead of voltage so I would need additional resistors to convert their output into a voltage that my DAQ can measure. Can you please elaborate a bit on why would you prefer these over the other chips that I've suggested before? For reference here's a comparison of the properties I thought were important (if you think I've missed something please do let me know):

author: Terry Bites
author_rank: Super Contributor
timestamp: June 08, 2023, 10:51:56 am
content: I only have a preference for current output types because of the easy custom gain setting.The choice of amplifier depends on your alowable CMV, gain, dynamic range, resolution, required and bandwidth. Then you have to take into account gain, offset and linearity errors. In a real-world measurement scenario, measuring to an accuracy better than 1% will be hard to achieve. You may have to curb your enthusiasm. Don't belive the datasheet headline specs and design around the worst case small print.Its not a bad idea to buy in a selection of amps and check out their performance. There wont be any magic know how or perfect part for the job. You'll only gain the problem solving skills through debug experiences. Get aquainted with free simulation software like LTspice or microcap among others. If your pally with NI, press them for thier Multisim package. Sims will at least let you do a sanity check.No one can offer a guaranteed solution; you may have circuit bugs that no one else can possibly know about.Implemnetation screw ups are very likely if you take your eye off the ball. What I can offer is an illustration based on your information and the pricipals at play. It can be applied to a wide range of high side amps.If the amps and shunts meet your spec and your wiring is sound then that’s mostly it. Make sure each amp has a bypass cap. Deal with all gain errors and offsets in software.Low side measurement is not verboten. The burden voltages are often trivial sources of error in high current schemes. Volt drops in PCB traces feeding your devcies may well be greater.You often see devices that are powered directly from the load's supply. For your application I'd power all the amps from one clean supply. You can steal that from the DAQ 5V output terminal.If you have look at the INA28x data sheet you'll see that current summing is possible. This may apply to other amps as well. That could solve your problematic 12V rail issue.But it would be easier to sum in software, no?I'm not clear about what the problem is about "wiring in the 12V" . Isn't that just the application of a potential divider? and 18k, 2k divider will reduce the input by a factor of 10.Your might want to get 1V per rail say. Kelvin connections are a must as is a correct grounding scheme as shown. No power currents should flow in your measurement circuit grounds or shields. Shields only connect to ground at the DAQ end. Use the gamut of DAQ differential inputs for all circuit sections to reduce ground errors and noise.Poor wiring will lead to a fail.See Application Note 105 from LT/ AD for a cornucopia of current monitoring ideas.

author: EPAIII
author_rank: Super Contributor
timestamp: June 10, 2023, 08:33:18 am
content: I did not read all the responses so I may be missing something. But here is what I see in your circuit:You have a 1 mOhm shunt for the 12V and you are trying to divide the two Voltages on each side of that shunt with two 10 MOhm resistors. That is a 10^10 difference in the values. So the 10 MOhm resistors would need to be accurate to 10^-12 or 0.0000000001 percent to produce any kind of accurate readings for the current.I salute your desire for accuracy, but doubt that you can obtain the needed resistors.I suggest either a much larger shunt, perhaps 1 Ohm and much smaller Voltage dividing resistors, perhaps two 5K Ohm resistors. Actually two 5K Ohm resistors for one side and a 10K pot (multi-turn, perhaps 20 turn) that can be adjusted to provide the correct reading with a known load resistor. This could probably be adjusted to provide 0.1% accuracy or better, depending on the accuracy of the load resistor used for calibration.If you want to more accurately monitor the conditions for the load (the computer and drives), then be sure to take your 12 V Voltage reading on the load side of the shunt. Actually, all of your Voltage readings should be taken on the load side of the respective shunts instead of the supply side as shown in your drawing.Quote from: Károly on June 06, 2023, 06:25:52 pm

author: py-bb
author_rank: Regular Contributor
timestamp: June 10, 2023, 08:34:59 am
content: Use an instrument amp (google it, can be made out of 3 op-amps)

author: langwadt
author_rank: Super Contributor
timestamp: June 10, 2023, 09:13:35 am
content: Quote from: py-bb on June 10, 2023, 08:34:59 ammuch simpler an more accurate to get an ic made for it like INA1xxsomething like thishttps://www.adafruit.com/product/1164remove the 100mR shunt and add wires

author: MrAl
author_rank: Super Contributor
timestamp: June 10, 2023, 09:55:07 am
content: Quote from: Károly on June 06, 2023, 06:25:52 pmHello there,Some of this applies when using resistor dividers to measure the voltage across the shunt, some of this is more general and applies to almost any circuit.One thing you can do is average the current and multiply by the voltage to get the average power. This works because the voltage is constant. If the voltage was not constant this would not work.Because you can average the current, that means that you don't have to have high bandwidth, unless you try to do it all digitally. If you kick in a little analog, you can average the current with a resistor and capacitor creating a simple RC low pass filter that will average the current. That's of course after you measure the current usually, which means the amplifier used would still have to have high enough bandwidth. What you could try doing is averaging the voltage that appears right across the shunt resistor, then amplify it. That would mean an RC low pass filter across the shunt. This would help to lower the bandwidth requirement of the amplifier or ADC. It's still not perfect, to get that you'd need very high bandwidth, but it should help. You can do a few tests to see how well it works.Since you are using divider resistors, you could probably just average the output of the two dividers using an RC filter. That's still before amplification.For the differential measurement across the 12v shunt you can probably get away with 1k resistors, if you account for the extra current in the software, if in fact you do have to account for that. In most cases you probably dont have to account for that because the load is on the 12v supply before you measure the current, not after. In other words, the current drawn by the actual load should not be increased by using 1k resistors. The current from the 12v supply will increase by 12/2k+12/2k (12ma) but that will not appear in the measurement. The only drawback then is the 12v supply gets a little extra load.Usually when you want to measure a differential signal you use a differential amplifier.When you have significant input offset you end up with significant output offset, but if you are using an ADC to measure you can usually get away with just subtracting that amount from the reading. For example, if you have 1mv input offset and a gain of 10, that gives you 10mv output offset. If your ADC resolves 5mv as 1 bit, you can subtract 2 from the ADC count. If your ADC outputs instead the actual 10mv, then just subtract 0.010 from the readings.Don't be afraid to experiment. Try a few different ways of making the measurements and see what works best for your application. For example, in one application i am using right now i originally started with low value resistors in a resistor divider to divide 12v down to 5v max in order to use a microcontroller ADC input that ran with a 5v supply voltage. I went up to 10k and didn't see much change. Some years later i went up to 100k and still didn't see much change. That's because i didn't need fast readings, and the error in the ADC count with higher-than-normal resistor values is due mostly to the DC input leakage current, which changes with temperature. If you don't have too much temperature change, you don't see much difference. In this application i had to ensure low power in the form of very low quiescent current. If i used 1k it would have drawn 12ma which would have been 12 times the actual operating current, and if i chose 10k it would have drawn 1.2ma which would even be more than the normal circuit current. By going to 100k i was able to reduce the current to around 120ua which was much better, being about one-tenth of the normal operating current of the rest of the circuit.