Author Topic: Current sensing  (Read 1584 times)

0 Members and 1 Guest are viewing this topic.

Offline GromBeestjeTopic starter

  • Frequent Contributor
  • **
  • Posts: 285
  • Country: nl
Current sensing
« on: December 14, 2019, 11:23:58 am »
I am trying to design an USB power outlet with current monitoring. See the attached schematic.
I have places a current sense resistor on the low side, and a fuse on the high side.
I am amplifying the voltage across the current sense resistors with an opamp.
I intend the feed the output voltage of the opamp to an ADC of a microcontroller,
and display the current on some display. But that's a part for later, for now, I
am focussing on getting the current sensing part working.

I am using a 1K5 in stead of a 10K for R7 and R8.
I am using a TP2604 in stead of a LM358.

I am running into an offset problem:
Initial offsets ain't a problem, as I can compensate for that, but the problem is the right channel, where the output only starts changing after a certain current is flowing.


Current (mA)Left port (mV)Right port (mV)
013,773,8
2313,791,6
4513,7109,6
6630,0126,4
8746,7142,3
10762,9158,0

When first running into problems, I've tried to change the resistor values (my initial design has 900K for R5 and R6, thinking this was too high)
Then I tried replacing the opamp. My LM358 was from eBay, so I replaced it to rule out it's a fake.

Is there anything to look for to fix this problem. I'm thinking I possibly need a different type of opamp to operate so close to ground. I realise it only mentions real-to-real output, but doesn't say so about input. Might that be the source of this issue? If so, how to select a suitable opamp, what are the parameters to pay attention to?


Edit: fix table formatting
« Last Edit: December 14, 2019, 11:25:49 am by GromBeestje »
 

Offline OwO

  • Super Contributor
  • ***
  • Posts: 1250
  • Country: cn
  • RF Engineer.
Re: Current sensing
« Reply #1 on: December 14, 2019, 01:37:13 pm »
You probably want to sense the voltage across the CSR differentially because any currents flowing in the ground path between the opamp and the CSR will lead to errors. I would choose an op-amp with a lower offset voltage or a purpose built current sense amplifier like the INA199/TP199. If you really must use an op-amp you can bias the + input (while wiring it as a differential amplifier) to avoid saturation near 0V. GS8333 is a low cost option with rail-to-rail I/O and low input offset voltage.
Email: OwOwOwOwO123@outlook.com
 

Offline GromBeestjeTopic starter

  • Frequent Contributor
  • **
  • Posts: 285
  • Country: nl
Re: Current sensing
« Reply #2 on: December 14, 2019, 02:38:21 pm »
The TP199 looks promising. I didn't look at the INA199 datasheet as TI's website is down for maintenance, but as the TP199 datasheet mentions its a drop-in replacement for INA199, they'll be similar. I'll design a new PCB and order some.

However, I've still two opamp laying around that would fit the current design:
TLC2272. This one mentions "Common-Mode Input Voltage Range Includes Negative Rail" and "Low Input Offset Voltage (950 µV)"
GS8552: This one mentions "Rail-to-Rail Input / Output" and "Low Offset Voltage: 30µV"

Is it worth trying one of these, or should I go on with the new layout straight away?

I have attached the PCB layout. There is a ground plane on one side and a power plane on the other. Is this a potential source of error?

 

Offline OwO

  • Super Contributor
  • ***
  • Posts: 1250
  • Country: cn
  • RF Engineer.
Re: Current sensing
« Reply #3 on: December 14, 2019, 04:42:19 pm »
Depends how low of a current you want to measure. Assuming 10mA, 10mA * 0.01ohm = 0.2mV. So you need an op-amp with input offset < 0.2mV to guarantee that 10mA will kick it out of saturation. Alternatively increase your sense resistance or bias the op-amp (requires 2 resistors, one series and one shunt to Vcc on the in+ pin).

PCB layout isn't using kelvin connections to the CSR, but whether this is a problem or not is easy to check; simply check for "crosstalk" between the channels (see whether current on channel 1 affects channel 2).
Email: OwOwOwOwO123@outlook.com
 

Offline fcb

  • Super Contributor
  • ***
  • Posts: 2135
  • Country: gb
  • Test instrument designer/G1YWC
    • Electron Plus
Re: Current sensing
« Reply #4 on: December 14, 2019, 05:16:24 pm »
Depending on what you are trying to acheive budget wise, there are some quite tasty all-in-one IC's around.  The TI INA220 is quite cheap and will do lowside/highside and monitor voltage as well (it also has built in ADC and some maths processing) and I2C (4 addresses).

As others have said, you definatly want to use differential connections to your current sense resistor, you could correct the offset in firmware also. Don't go too low with your sense resistor else you'll end up needing alot of gain and that will compound the offset issue, and test at different temperatures - offsets on opamps can change radically over temperature.

https://electron.plus Power Analysers, VI Signature Testers, Voltage References, Picoammeters, Curve Tracers.
 

Offline GromBeestjeTopic starter

  • Frequent Contributor
  • **
  • Posts: 285
  • Country: nl
Re: Current sensing
« Reply #5 on: December 14, 2019, 07:22:18 pm »
I am hooking up USB ports with the data pins shorted, so basically, "charging ports". As one gets an "USB" charger with everything, I figured, hooking up a bigger power supply and having that charge all of them. I am adding this as part of my bench setup, and I would like to have an indication of power usage (like those USB current monitor things, but then integrated in my bench) And adding a fuse because of the bigger supply, if something messes up, it won't cause too much trouble.

As one of the applications would be charging mobile devices or powering a SCB, I don't want too much voltage drop at, say, 2 Ampère (This also includes drop across the fuse). I would like to be able to measure as much range as possible, but it should not interfere with being able to supply 2A.

When this works at 5 volts, I would like to create something similar for 12 and 24 volts. 

Looking at that INA220, that seems an interesting part. looks like it does everything, and it would also work at those voltages. (And I might be getting other ideas what I could do with it in other projects)
 

Offline FransW

  • Frequent Contributor
  • **
  • Posts: 270
  • Country: nl
PE1CCN, Systems Engineering, HP, Philips, TEK, BRYMAN, Fluke, Keithley
 

Offline GromBeestjeTopic starter

  • Frequent Contributor
  • **
  • Posts: 285
  • Country: nl
Re: Current sensing
« Reply #7 on: December 15, 2019, 04:29:45 pm »
I have this in use. Works fine. Maybe usable as example.

https://www.ebay.com/itm/USB-Charger-Doctor-Voltage-Current-Meter-Mobile-Battery-Tester-Power-Detector/352665764233?epid=15011997217&hash=item521c848189:g:KJcAAOSw5hdc3Rb0

There ain't much to see on there. a regulator, two caps, two displays, a sense resistor and a controller of which they've rubbed of the part number.
 

Offline FransW

  • Frequent Contributor
  • **
  • Posts: 270
  • Country: nl
Re: Current sensing
« Reply #8 on: December 15, 2019, 05:48:01 pm »
Thereareseveral types and they go from
0 - 30V & 0 - 5.1 A.
Probing the controller could solve some questions, I think.

Scaling up, including safeguards should not be unsurmountable.
PE1CCN, Systems Engineering, HP, Philips, TEK, BRYMAN, Fluke, Keithley
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf