how to measure current in the range 1uA upto 0.5A using ADC

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

Hi guys,

            I'm trying to create an analog circuit based current measurement unit, similar to the one used on the SAML21 Xplained Pro board which uses a SAMD20 to measure the current consumed by the SAML21. I understand that it (SAMD20) uses 4 current ranges to cover the entire current range upto 400mA. Can someone give me an idea as to how the range of the resistors and the switching between resistors must be designed pls.

 

Thanks in advance,

This topic has a solution.
Last Edited: Fri. Feb 23, 2018 - 10:35 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Charlie8 wrote:
how the range of the resistors and the switching between resistors must be designed

 

Surely, this is a General Electronics question - nothing to do with ASF?

 

With any measurement, you need to make sure that you are operating in the "optimum" region of the measurement cicuits.

 

  • Too low, and you'll be lost in the noise of the analogue parts, and won't have any digital resolution;
     
  • Too high, and you will overload stuff.

 

 

Perhaps take a look at this: https://www.eevblog.com/projects/ucurrent/ - the blog article describes the design.

 

 

EDIT

 

add bullets

 

 

EDIT 2

 

Try a google search for terms like, "wide range current measurement" ...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Thu. Feb 22, 2018 - 02:00 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Charlie8 wrote:
Can someone give me an idea as to how the range of the resistors and the switching between resistors must be designed pls.

 

Ohms Law would be a good place to start!

 

 

Jim

 

Click Link: Get Free Stock: Retire early!

share.robinhood.com/jamesc3274

 

 

 

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

Thanx for the reply.

True it is a General Electronics question but I post it here because I'd be glad if some one who has worked on the SAM Xplained Pro and has gone through the current measurement unit's schematic would leave a comment .

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

I'd say something like:

 

 

But I looked at the schematic, and it's completely different. They used a bunch of opamps. First, and this is the interesting part of the circuit, they divide the current in 2 equal parts if the current is low, or if it's high they take 1/1000 of the current to be measured and let the rest continue through:

Then they just have 2 non-inverting amplifiers (with filters), one has 2x gain and the other has 15.7x gain (they say it's 16x in the schematic). This part is basic opamp stuff so I won't copy it here.

 

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

I have used a MAX4173, the choice of current sense resistor and gain version should give you the range you need.

 

Jim

Click Link: Get Free Stock: Retire early!

share.robinhood.com/jamesc3274

 

 

 

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

A few months ago, in another thread there was a similar question.

1 : .5e5 is quite a range and difficult to do without switching between multiple shunts.

Back then I made a little schematic in KiCad to show how to swtich between multiple shunts with mosfets without the RdsOn having infuence on the current measurement.

I'll post it again:

 

Note that the MosFet's are not between the ADC terminals.

The idea is that only one of the MosFets is conducting during a measurement.

The resistors on the right side of the conducting MosFet do not conduct current and have no voltage drop.

The ADC shown here is just a random component from KiCad's database to show the connections.

I've been thinking to build something like this with an HX711 or ADS1117 for a while now, but getting the STM32F103C8T6 to work to my liking has a higher priority.

Paul van der Hoeven.
Bunch of old projects with AVR's:
http://www.hoevendesign.com

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

Paulvdh wrote:
A few months ago, in another thread there was a similar question.

Great, thanks! - I was thinking of that one, but couldn't find it.

 

smiley

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

At 20na, the fets may have a problem, since they will have microscopic leakages (even when off)...for 20na setting prob best to use a dedicated circuit.

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

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

El Tangas wrote:
I'd say something like:
El Tangas wrote:
I looked at the schematic...

So, looking at the schematic of the OP's ideal example device is marked as the "solution".  Now why didn't I think of that?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

So, looking at the schematic of the OP's ideal example device is marked as the "solution".  Now why didn't I think of that?

Probably because it's no good if you really want to measure 20na...there's even a 100k (R701) connected to the signal path to a logic control.   Of course for higher current, these errors fade into the electron fog.l 

 

edit:Oh, I see, he mentions 20na, but his  title mentions 1ua  ..a 50X difference!...much better

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

Last Edited: Thu. Feb 22, 2018 - 06:27 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:
Probably because it's no good if you really want to measure 20na...t

So the Xplained board really doesn't really work?

 

Charlie8 wrote:
I understand that it (SAMD20) uses 4 current ranges to cover the entire current range from 20nA upto 400mA.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

Charlie8 wrote:

I understand that it (SAMD20) uses 4 current ranges to cover the entire current range from 20nA upto 400mA.

 

Well, that's not actually what the User Manual says - is it?

 

http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-42405-SAML21-Xplained-Pro_User-Guide.pdf

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:

So, looking at the schematic of the OP's ideal example device is marked as the "solution".  Now why didn't I think of that?

 

Well, the OP asked to "go through the schematic" in #4, from which I deduced he wanted an explanation of what the circuit does. You will notice that I annotated and commented on the schematic, I didn't just "look" at it.

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

El Tangas wrote:
You will notice that I annotated and commented on the schematic, I didn't just "look" at it.

Oh, yes, indeed -- you went above and beyond.

 

My snarky post was meant to be another way to say "did you RTFM first?".  I can only surmise that OP wasn't able to (or cared not to) dig out the Xplained schematics.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

I did go through the schematic of the Current measurement unit. I posted this in the forum, cuz I couldn't make head or tails as to how current meadurement was carried our in the schematic.

My objective was to replicate as closely as possible to the current measurement circuit that was provided. The reason I'm sticking with this method is cuz it uses minimum no. of resistors compared to the other methods that were suggested.

So yeah I was hoping that someone would explain specifically the current measurement circuit implemented using SAMD20 and El Tangas solution does just that and that's why its marked as the solution to my question.

Thanks for all ur replies.

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

You r rite @awneil. But the doc. also does not mention the lower boundary of current that can be measured so I took it for granted . My mistake it would make no sense for it to hav 20nA as lower bound especially cuz it has a error of 300nA below 1uA.

I edited my original post. Thanks for pointing it out My mistake.

Last Edited: Fri. Feb 23, 2018 - 10:49 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
Great, thanks! - I was thinking of that one, but couldn't find it.
https://www.avrfreaks.net/forum/measuring-resistance-mcp3551-adc?skey=current%20%20measurement%20paulvdh%20mosfet

avrcandies wrote:
At 20nA, the fets may have a problem,
For nAmp measurements you're getting into the "art" realm. EEVblog did a teardown of a Keithley Femto Amp meter some time ago. I also have some service manuals of old HP measurement equipment with a lot of details on how they get to measure uA with 6 digit resolution. But this tread does not seem to be about that subject.

Paul van der Hoeven.
Bunch of old projects with AVR's:
http://www.hoevendesign.com