Shunt resistor w/o amp, use of Vref

Go To Last Post
22 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

 

i am planning a circuit and was wondering if i could use shunt resistor to measure current consumption whithout amp and jsut use MCUs Vref input as is shown in the attached circuit diagram. The current i willll be sensing is 100mA to 2A and Rshunt = 0.01 Ohm. So at I=100 mA, Vsens would be 0,001 V and at I=2 A, Vsens would be 20 mV. So in total at max current the powerloss in shunt would be around 40mW, which is important since whole thing is battery powered. The load is max 10W. The ADC is 12bit so it has 0.24 mV step, so the resolution of read should be fine. I can also change ADC to a 14 or 16bit if i will have to.

 

Would it be a better idea to go for lower shunt resistance of 5 mOhm or even a 0.1 mOhm, to reduce powerloss and going whit a 20 bit ADC or even higher?

 

Thanks for any help in advance.

This topic has a solution.

Last Edited: Tue. Sep 26, 2017 - 06:26 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Nope.

 

You haven't mentioned which AVR, but from the pinout it looks like ATmega48 family.  Although you say:

The ADC is 12bit

... so maybe not.

 

Anyway, for most AVR, the minimum AREF is 1.0V:

 

 

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

Last Edited: Mon. Sep 25, 2017 - 02:21 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Hang on, I just noticed your placement for the shunt above the load to VCC, rather than below the load to GND.  So you'd stay within spec for AREF.  But why is ADC0 connected to VCC?  If you're planning on reading VCC that way, you should know that you can't read an input which is higher than AREF.  It will saturate at ADCMAX.
 

I think you need to provide somewhat more detail.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I would place the current sensing shunt on the low side of the load/shunt series. And no connection to Aref. Just measure the voltage developed with respect to ground.

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

As the others have said - put the "shunt" on the Ground side!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Use Vcc as reference and measure the low side of the shunt with ADC.

 

Your big problem is ADC0 input is always above or equal to Vref. The ADC will not produce a meaningful result in this case.

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Use Vcc as reference and measure the low side of the shunt with ADC.

I'd use VBG as the reference, then ADC resolution would be about 1 mV for a 10-bit ADC.  However, OP mentions a 12/14/16-bit ADC?  Shows an unspecified AVR schematic, and no mention of which actual device s/he's asking about.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Vbg won't work with a high-side current shunt because the voltage is above the reference.

 

IF this is really a 10-bit ADC, and if Vcc is used as the reference,  then the reading of N (0 to 1023) will indicate an input voltage of Vcc * N / 1023 (or, is it 1024?). The voltage drop is Vcc - Vcc * N / 1023 = Vcc * (1023 - N)/1023 and the current is simply 

 

I = (Vcc/R_SHUNT) (1023 - N) / 1023

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Vbg won't work with a high-side current shunt because the voltage is above the reference.

Obviously.  I hadn't read what you'd said (and what I'd quoted!) carefully enough:

Use Vcc as reference and measure the low side of the shunt with ADC.

I was assuming a low-side shunt.  In any event, given the OP's figures for shunt voltage, a low-side shunt with VBG will give better resolution than a high-side shunt and AVCC.

 

We need to hear from the OP.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

What OP needs to do is just swap those pins.  AREF should be connected to Vcc and the ADC0 input to the resistor junction.

 

Then it'll probably work.  Depends on the resistor values.  The AVR will need 5V on Vcc too.  S.

 

PS - "EP" on Pin 29?  Is this 'external package' or something?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Too many unanswered questions:

OP mentions a 12/14/16-bit ADC?  Shows an unspecified AVR schematic, and no mention of which actual device s/he's asking about.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Agree - Excessive confusion level on all sides. OP needs to clarify.

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

We don't 'alf have a knack for confusing things.  All the grumpy about spec sheets and ref voltages would have just gone away if you swap the pins.  Precision remains a problem - I dunno if the very low resistance values the OP wanted would have created a useful measurable voltage difference (thinking no, not really.  And smaller resistance values just makes things worse).  S.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I’d suggest a acs712 or a ina199.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Hello,   I recommend using the IRA219 INA219 power-meter module board available on eBay for a few dollars:

http://www.ebay.com/itm/1Pcs-Pow...

 

I have used the free downloadable Adafruit library that is available for this device.  It works well.  It measures the voltage and current across the 0.1ohm shunt resistor.  Then it converts these values to readings using programmable gains and offsets.  The resulting values are accessible through the standard I2C (TWI) interface.  Valid up to 3.2 Amps and 27 volts, (with an IC variant extending to 32 V),  about 1mA resolution.

 

Everyone concentrates on "re-inventing the wheel",  that is, doing the basic electronics over and over again from scratch.  I recommend downloading the work that others have done, using the inexpensive ICs developed and sold specifically for this one application.  Put all your development talent into creating a powerful, robust, and easy-to-use interface for your customer.

Last Edited: Tue. Sep 26, 2017 - 12:30 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry i was afk yesterday. Thanks for a looot of responses. To answer some questions: the MCU is not yet selected, i can go whit any AVR, SAM or LPC series.  I was just wondering about basic cricuit and the low side shunt resistor does fix this for me. I also tried it this morning and whit a 12bit ADC in SAM D20, i get great resolution. Also compared whoel setup whit a multimeter and current measurement is more then what i need. I also apologize for the mistake of misconnecting Vref and ADC input on the circuit diagram, ofc i can not measure anything above Vref.

 

Thanks again for all the help.

Last Edited: Tue. Sep 26, 2017 - 06:34 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

From my experience,

 

I would suggest you to put the Shunt resistor after the Load, because it is easier to handle it. I mean to connect it's one side to GND (Not to 5V). If the Load is LED then you should better use an opamp connected as an amp. and also put a small cap (depends on the frequency), for some filtering in parallel with R2 (amp) resistor.

 

 

Michael.

User of:
IAR Embedded Workbench C/C++ Compiler
Altium Designer

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

powerloss and going whit a 20 bit ADC or even higher?

 

The answer is probably NO!!!...try to avoid problems & use the LARGEST voltages possible.   Why creep lower & lower until you are completely buried in radio noise, line noise & digital logic noise??  Your $200 Fluke meter is probably good to around a millivolt...what are you expecting to do with a $4 circuit?  That's not to be said it can't be done.  Also noise and response time can easily be traded off....if you wait seconds you can get down & play with microvolts.

 

Below about 10 milliohms, you will start to have a lot of issues, since just various wires, solder joints, connectors,  traces, etc can easily be a few milliohms each.  Going below this level requires extreme care & precision in all of your efforts.  In this case you might do well to use a Kelvin 4-wire resistor as your sensing element (the extra 2 wires do not draw "any" current, hence their circuit paths are "immune" to producing unwanted voltage drops being added to the measurement).

 

 Also, take a look at some of the new GMR current sensors...tech like this didn't "exist"  only a few years ago (now you can purchase such a chip for $1 and apply it). 

When in the dark remember-the future looks brighter than ever.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank, i will stick whit 5miliOhm resistor, i added a ton of diodes, L and C filters on right places to reduce any noise, the whole PCB is in a shielded case, cpu rubs at 1MHz, and also the ADC IC pin is like 2mm away from shunt resistor to minimise trace resistance (trace is also 1mm wide). In addition i also take 3 seconds of average data (i mathematicly ignore any noise/spikes/errors), so the measurement is surprisingly accurate and stable even on breadboard so according to my previous experiences it only gets better when i design fully working PCB.

 

Thanks for advice

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:
use a Kelvin 4-wire resistor as your sensing element

Or, at the very least, ensure that you have a Kelvin 4-wire connection to whatever you use as your sensing element ...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Klemko wrote:
i added a ton of diodes

doesn't sound very hopeful!

 

Simply throwing loads of components at a problem is not, generally, a great design approach!

Especially where noise is a concern - as more components add more noise!

 

Perhaps you should post your schematic for review ... ?

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i added a ton of diodes

Don't build anything you can't transport away from your bench

When in the dark remember-the future looks brighter than ever.