Go Down

### Topic: How to measure Current being drawn by Arduino Platform (Read 4263 times)previous topic - next topic

#### Vik009

##### Apr 03, 2012, 12:25 pm
I have see some projects involving the measure of current and corresponding power being consumed by the Arduino board. Can anyone please share the links for work being done for measuring the current used up by Arduino. I want to have a look at both Hardware and software methods to measure current.

BR,

#### MarkT

#1
##### Apr 03, 2012, 01:13 pm
Intrigued by "software methods" - do you mean estimating the current consumption in software given a software model of the attached hardware and its current consumption in various modes?
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

#2
##### Apr 03, 2012, 04:19 pm
Easiest method is to put your multimeter into mA mode, and put it in series with the Positive power lead into the board.

Doing it in software, put a shunt in series with the power lead, use the arduino to do analog readings on both sides, and do the math: (Vhigh - Vlow)/shunt resistance, with Vhigh = analogreading * 5/1024 (or ~.00488)
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### Constantin

#3
##### Apr 03, 2012, 05:10 pm
FWIW, I vote for the external current meter. I have doubts regarding the availability of suitable shunts that have a low enough resistance to not be problematic yet accurate enough to be meaningful at a scale like this. A better direction IMO would be to use a dedicated hall-effect sensor like the Allegro series. Sparkfun sells a low-cost, low-power breakout board that seems like a pretty good bet since it incorporates an adjustable op-amp.

#### MarkT

#4
##### Apr 03, 2012, 06:19 pm

Easiest method is to put your multimeter into mA mode, and put it in series with the Positive power lead into the board.

Doing it in software, put a shunt in series with the power lead, use the arduino to do analog readings on both sides, and do the math: (Vhigh - Vlow)/shunt resistance, with Vhigh = analogreading * 5/1024 (or ~.00488)

And just how do you expect to read analog voltages that are out of range then?
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

#5
##### Apr 03, 2012, 06:36 pm
You address out of range when the question comes up of what voltage is being measured - if <=5V, no problem.  If >5V, add some voltage divider resistors to bring the value down into the 5V range.
Until told otherwise, I'm going with the power is being measured going into the 5V pin as that is how I run most of my designs - either from USB power, or a 5V wallwart.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### MarkT

#6
##### Apr 03, 2012, 06:53 pm
If the shunt is low side the Vlow is negative, if its high side you can use a voltage divider, but your formula made no allowance for that!

Commonly you would want some gain too as the voltage across a shunt is likely to be low (to avoid dissipation and efficiency issues) - using an op-amp as differential amplifier then provides whatever gain you need and will work with out-of-supply-range input voltages.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

#7
##### Apr 04, 2012, 04:37 am
Unless the system is using +/-12V or something, how would you get negative? Kinda lost me there.
Measure both sides, take the difference, divide by the shunt value.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### gardner

#8
##### Apr 05, 2012, 02:39 am

Unless the system is using +/-12V or something, how would you get negative? Kinda lost me there.
Measure both sides, take the difference, divide by the shunt value.

If the shunt is placed on the negative supply side, the shunt voltage will be negative relative to the ground and negative analogue reference of the Arduino.

#9
##### Apr 05, 2012, 04:48 am
Ok, so lets clarify the discussion here as a starting point.
In the example I assumed 9V battery and resistors with appropriate value to not exceed the Analog input.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### Nick Gammon

#10
##### Apr 05, 2012, 05:38 am
I'm interested in exploring this idea, because I am trying to come to grips with differential measuring.  Here is an earlier thread:

http://arduino.cc/forum/index.php?topic=97047.0

With your idea Bob, I see a problem with resolution. Say we are drawing 55 mA, and we have a 1 ohm shunt. That means we drop 55 mV over the shunt, which is then halved by the voltage divider (22.5 mV drop). The resolution of analogRead is about 5 mV, so we are only going to get 1 "count" per 5 mV (10 mA of current drawn).

I am wondering how you might connect up an op-amp to amplify the difference (eg. convert the 55 mV to 550 mV). What wiring would you use that wouldn't somehow short out the op-amp or something? And how would you set the gain up?
Please post technical questions on the forum, not by personal message. Thanks!

http://www.gammon.com.au/electronics

#11
##### Apr 05, 2012, 06:04 amLast Edit: Apr 05, 2012, 06:10 am by CrossRoads Reason: 1
I would do it like this
http://www.electronics-tutorials.ws/opamp/opamp_5.html
Use a rail-to-rail output single supply op-amp
[edit - corrected signal names]
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### Nick Gammon

#12
##### Apr 05, 2012, 07:58 am
Right, well I made up that circuit exactly as shown, except I used an LM358 and not a rail-to-rail opamp. The op-amp is powered by the +5V from the Arduino.

But I just don't get some of the figures.

The voltage drop over the shunt is 50 mV which would roughly equate to the the 58.6 mA measured. So far so good.

But then things go rather strange ...

• At the point V2/2, where I should have 4.5V, I measure 3.59V

• At the point V1/2, where I should have 8.95/2 = 4.475V, I measure 3.69V

• The inputs to the op-amp are 2.162 and 1.788, giving a difference of 0.374V. So why is the output 0.618V?

• V1/2 is larger than V2/2, however V2 is larger than V1.

If I power the op-amp from the 9V input the figures are largely unchanged.
Please post technical questions on the forum, not by personal message. Thanks!

http://www.gammon.com.au/electronics

#13
##### Apr 05, 2012, 08:17 am
With V1 > V2 I think the Op amp is just going to its lower limit and sitting there. The design is intended to have V2 > V1.

The 10K voltage divider resistors by the shunt, probably want to measure those and see how far out they are. I'm too tired to think how having 5% off might affect things for instance.  V1/2 should not be higher than V2/2 if V2 is > V1.

Use R3, R4  20K for a gain of 2.

I'm off to bed ...
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### Vik009

#14
##### Apr 05, 2012, 08:20 am
Hi,

Thank you all for so good and so much information. I am finding really interesting the analysis.

I did graduate in electronics but it was four years back and i am trying to get the grip of the things for my project. Can anybody share with me a circuit via which I can operate my ATMEL Micro controller alone. I mean the bare board implementation.

Secondly, How can i setup the current measuring circuits if i am to measure the current of the Arduino platform. What kind of circuit i would require for that ?

BR,

Go Up

Please enter a valid email to subscribe