Current sense resistor measurement - contradicting results - Page 1
Forum section: electronics / projects

author: leonhart88
author_rank: Regular Contributor
timestamp: June 26, 2015, 04:31:07 am
content: Hi All,I have a project where I'm pulsing some IR LEDs to transmit wireless data. There are two LEDs, each pulsing at around 400mA at 3V. There are some capacitors which supply this pulse current, so not all the current is being provided by the regulator (which can only supply max 500mA continuously). Here is a rough sketch of the circuit.Currently, this design is running off a 5V power supply capable of supplying lots of current (if necessary). However, I want to see if I can run the device off 5V from a USB port. I know that I can get 500mA from a USB port (if the enumeration is done correctly) and I wanted to verify the max pulse current that my device is drawing. Now, perhaps the USB ports have output capacitors that can supply the pulse current I need and I don't need to worry about this (the pulses are only 5us long and the device only draws ~10mA average), but I wanted to double check anyway.So to check the current pulses, I put in various current sensing resistors in different locations to try and see what was going on. I get some interesting and confusing contradicting results here. The locations where I tested current are indicated by the numbers on my schematic drawing (1, 2, 3, and 4). In all cases, I was using a Rigol DS1052E scope and was measuring in differential mode with two probes. I've also simulated the circuit and based on those results, I should be expecting ~300-400mA current pulses from the source supply. After each test I did, I removed the sense resistors before trying a different test.The first thing I did was place a 3.3 ohm resistor in position 1. When I do this, I'm getting 1.22V (369mA). I also checked the voltage levels and everything going into the circuit and this voltage drop is OK, the dropout voltage of the regulator is very low.The next thing I did was measure the current across one of the 3 ohm LED resistors (position 4). This gives me 1.26V (420mA) which is close to what it was designed for.Next, I soldered a 0.1 ohm resistor in position 3 to see the current pulses coming out of the regulator after the capacitors. Here I was reading 86mV (860mA), which is roughly twice of the current measured from one resistor, this makes sense. I forgot to take a picture here.Next, I soldered a 0.1 ohm resistor in position 2 to see how much current is leaving the regulator only, knowing that with a linear regulator, the current out is equal to the current in. Here I was reading 36mV (360mA). After I got this data I thought...great! Everything makes sense, this matches closely with my first 3.3 ohm resistor measurement at position 1 and also matches what I expected from simulations.However, it's the next set of tests I did that really confuse me. I tried a 0.1 ohm resistor, 0.2 ohm resistor (2 x 0.1 ohm in series), and 1.65 ohm resistor (2 x 3.3 ohm in parallel) in position 1 and measured the voltage drop across each of the three cases. In all three cases I get different voltage drops, and they do not really make sense. For the 0.1 ohm resistor, I am reading 104mV (1.04A). For the 0.2 ohm, 168mV (840mA). And for the 1.65 ohm, 880mV (533mA). I'm extremely confused about these results and would appreciate if anyone can shine some insight on what's going on here. I've triple checked my measurements and I'm pretty sure I'm not measuring anything incorrectly...

author: coppice
author_rank: Super Contributor
timestamp: June 26, 2015, 04:50:51 am
content: If you are simulating your simulation should be showing you pretty much what you are getting. You didn't actually explain what you find odd about your results? With 1.65 ohms in series with the input to the regulator, you are dropping a big enough voltage across that resistor to substantially limit the current which the regulator can draw. Without doing detailed checks, your result looks in the right ballpark.

author: rs20
author_rank: Super Contributor
timestamp: June 26, 2015, 04:55:08 am
content: I think you're confusing yourself by making these assumptions:-- "The added resistors don't modify the behaviour of the circuit" (they do)-- "Peak currents should be constant throughout a linear supply system" (no, the whole point of capacitors is to smooth out peaks to make the wider but shorter)-- "No current flows out of ground of a linear regulator" (wrong)In particular, when you add a resistor to position 2, you're creating an RC circuit that causes the capacitors to actually power the circuit to a noticeable degree. So when you add a resistor to position 2, the peak currents through positions 1 and 2 willbothdrop. But when youtryto measure that, youmovethe resistor from position 2 to position 1 and by doing that, you're removing the RC circuit, the 3V regulator will aggressively keep the capacitors topped up, and the peak currents through positions 1 and 2 willbothrise together.But because you only ever measure the current through position 1 when a resistor is in position 1, and only ever measure the current through position 2 when a resistor is in position 2, the resultslookinconsistent. But they're totally different circuits that have no responsibility to behave identically.Edit: I agree with coppice; if you run simulations *with the current sense resistors in place*, the simulation should show you the same results you're seeing in real life.

author: nitro2k01
author_rank: Frequent Contributor
timestamp: June 26, 2015, 05:01:15 am
content: Your sense resistor have a pretty big resistance and are a non-trivial change to the circuit. If you have two LEDs with 3 ohm resistors, that gives you a parallel resistance 1.5 ohm for both the LEDs. Now you're adding up to 1.65 ohm in series. I'm not going to do the calculation for you, but if you take this into account, it should be obvious that the current will fall with higher series resistance and the numbers should work out.Putting a too large resistance on the input side of the LDO is also potentially non-trivial, if the voltage drop over the resistor ends up putting the input voltage below the allowed range of the regulator.You may also have an oscillation problem judging from some of the scope shots. LDO regulators are prone to self-oscillate if the decoupling capacitors on the input and output sides don't have an ESR (equivalent series resistance) within a specified range. It may be that your sense resistors are putting the effective ESR of the capacitors outside the limits. Consult the data sheet for information on these limits. (I couldn't find a voltage regulator with the model number CP2989. Is this a typo?)

author: leonhart88
author_rank: Regular Contributor
timestamp: June 26, 2015, 06:11:12 am
content: Quote from: coppice on June 26, 2015, 04:50:51 amHere is a screenshot of my simulation. Perhaps I'm doing something wrong here. Also, this isn't the exact same regulator that I am using, but it's a close enough equivalent that I can find on LTSpice. Also, I do not have a model for the IR LEDs so I am just putting a voltage source with the voltage drop at the specified current (via the datasheet table). I guess I'm just confused on what the ACTUAL current pulse values are because I'm obviously getting different values for that when I use a 0.1 ohm in position 1 vs a 0.1 ohm in position 2. We are talking about a 1.04A vs 0.36A difference and I don't know if that's what I can expect from a 0.1 ohm resistor. I assume that my results with the 0.1 ohm resistor in position 1 are the most likely since I'm not limiting the current as much as the other resistor values and also not creating an RC circuit?Quote from: rs20 on June 26, 2015, 04:55:08 amOK, I understand that the resistor will not only slow the charging to the capacitors, but will also cause the capacitors to power more of the circuit than if the resistor is not there. So what is the best method for physically measuring the peak currents that my device draws? Unfortunately when I plug in the values for the resistors that I am testing with in real life into the simulation, I get different results. Which means I either measured something incorrectly, or there is something wrong with the simulation.Quote from: nitro2k01 on June 26, 2015, 05:01:15 amSorry for my chicken scratch, the regulator is a Texas Instruments LP2989. Sorry, I may be misunderstanding something, but where in the circuit am I adding 1.65 ohm in series with the 1.5 ohm parallel resistance for the LEDs? I'm measuring the current across the 3 ohm resistor when looking at the current draw through the LEDs. I understand that if I add a 3.3 ohm or 1.65 ohm resistor, those are fairly large values, but I've used a 0.1 ohm resistor as well and the results are confusing (particularly the readings I get when I have a 0.1 ohm resistor in position 1 vs position 2 & 3).Also, I made sure to check that even with a 3.3 ohm resistor on the input side of the LDO, the voltage drop is not an issue. The input voltage is still above the allowed range of the regulator.Interesting note about the ESR...I also noticed the oscillation as well and wasn't sure where it was coming from. I will look into the datasheet on this.

author: leonhart88
author_rank: Regular Contributor
timestamp: June 26, 2015, 06:30:49 am
content: Perhaps it will make things easier to analyze just one scenario of the problem. For example, when I have a 0.1 ohm resistor at position 1, 2, or 3.When I have one at position 3, I'm measuring what I would expect, which is around 800mA. When I measure at position 2, I'm getting around 360mA. Now, perhaps putting that 0.1 ohm resistor in position two has now changed the circuit such that 360mA is actually lower than the circuit without the resistor because the 0.1 ohm is limiting the current leaving the regulator. So I need to figure out how much of an effect that 0.1 ohm resistor has in terms of current. I'll see if perhaps some calculations can tell me this.Lastly, with a 0.1 ohm in position 1, I'm getting around 1A. I'm struggling to understand this, as the circuit is only really supplying 800ish mA to the LEDs and a couple of mA to some other circuitry. So where is the other 200mA coming from? Is this from charging the capacitors? The regulator datasheet also states the peak current is 800mA so how can we be getting 1A on the input side?Anyhow...I hope some sleep and calculations that I try tomorrow may help clear my confusion. Thanks for everyone's comments thus far.

author: onlooker
author_rank: Frequent Contributor
timestamp: June 26, 2015, 11:16:08 am
content: It will help the understanding if you run the measurements with wide enough pulses such that the plateau/steady state starts to show at all you measurement locations (if the LEDs can withstand the wider pulse).

author: dom0
author_rank: Super Contributor
timestamp: June 26, 2015, 12:12:37 pm
content: ... and this is basically the reason why current probes are popular and expensive.

author: nitro2k01
author_rank: Frequent Contributor
timestamp: June 26, 2015, 01:41:12 pm
content: Quote from: leonhart88 on June 26, 2015, 04:31:07 amI'm sorry I misread the above paragraph and thought you tested these three resistor values in position 2 or 3, not position 1.If the schematic in LTspice is accurate to your circuit, you are doingone critical mistake. The bypass pin is supposed to bypassed to ground, not the output! (Page 16 of the datasheet) The point of decoupling the bypass pin is to stabilize the voltage across the internal bandgap reference. What you're doing is effectively injecting all sharp changes to the load into the reference part of the regulation loop. Not recommended! If this is different from the real circuit, this is a good reason for the simulation to differ drastically from reality.Furthermore, the datasheet stipulates a 2.2 uF cap on the input, with 1.5 uF actual capacitance being the absolute minimum for stable operation. (Page 17)You can also see in the graph (Page 18) that the maximum ESR for the output capacitor is 500 mOhm when sourcing any considerable amount of current.I would recommend the following: Connect a 2.2 uF (or slightly higher if you don't have that value) cap directly to the input of the regulator (ie not in series with any sense resistor). Put a 4.7 uF (or, again, slightly higher if you don't have that value) cap directly to the output of the regulator. Get rid of the 33 uF and 47 uF cap, at least temporarily. This should be high enough to provide stable regulation, while not smoothing the current too much. This should be a good start for measuring the actual active current without too much side effects, without having to do wider pulses like onlooker sugested. With this configuration, you should be able to sense the current on the input side, again making sure you don't put the sense resistor between the cap and the regulator.Also, your regulator (unlike the one in the simulation) has an error output (pin 7) which gives a logic low if the output voltage goes out of regulation. You could try triggering on falling edges on that to see if it gives you anything.

author: leonhart88
author_rank: Regular Contributor
timestamp: June 26, 2015, 04:42:18 pm
content: Quote from: onlooker on June 26, 2015, 11:16:08 amIt would be nice if I could do this, however, I'm limited to what the LEDs can handle (max 1A surge current at 100us - LEDs are part #VSMF3710). This also isn't a simple thing to change in the existing circuit, as the control pulse is a IRDA standard pulse which is at a specific pulse duration (3/16 duty cycle). I could perhaps increase the LED resistors and then hook up a function generator to the MOSFET with wider pulses but I'm not sure how that will help.Quote from: dom0 on June 26, 2015, 12:12:37 pmYes, unfortunately I can't afford one...I recently purchased the ucurrent though, but I'm not sure if that will help.Quote from: nitro2k01 on June 26, 2015, 01:41:12 pmThanks again for your help, appreciate it. In my actual circuit, I have the LP2989 bypass connected to ground. Here's a pic of how I've got it hooked up. The only reason bypass is connected to the output in my simulation is because the datasheet for that particular LT regulator says to do so. Again, that's the closest one to the LP2989 I could find in LTSpice. Perhaps I should try to simulate this with the Texas Instruments SPICE program instead so I have a more accurate depiction of the regulator I'm using. I'm curious what the results would look like in simulation if I put the bypass to ground. I'm using ceramic caps for the 33uF and 47uF, so I think I'm ok for ESR. I'm going to read the datasheet again to see if I can find any insights.So I understand now that putting the sense resistor between the regulator and capacitors is not a good idea and I should really be doing this on the input side (which I originally intended to do, but moved further down when I was getting confused from the other resistor values). What about my measurement from position 3 with the 0.1 ohm resistor? Can I trust the value that I read there? It seems to make sense, as it's around double what I read across the 3 ohm LED resistors.

author: leonhart88
author_rank: Regular Contributor
timestamp: June 26, 2015, 06:31:07 pm
content: Been thinking about this more....if I can measure the change in voltage across the capacitors, then using I = C*dV/dt, I can figure out the current being supplied from the caps when the LED is pulsing. Knowing that the total current I need to supply during these pulses is around 800mA, I can assume that if the current supplied by my caps (calculated from above) is only 600mA, then there is an extra 200mA being supplied from the regulator during these pulses. Then I know that during a pulse, the peak input current is 200mA.I would also need to check what the peak input current is during charging of the capacitors, which I can also check from measuring the voltage across caps, but now looking at the charge cycle and not the discharge cycle.Does this make sense?Also, I realized that upon start up, the capacitors act as a short circuit so the regulator is going to enter short circuit mode and try to supply 800-1000mA constant current. However, the USB ports can only supply 500mA. Would this be an issue? Or do USB ports also have external capacitors in order to handle inrush currents? I'll look into this as well when I have time.Thanks again everyone.