How to measure Current being drawn by Arduino Platform

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,
Muhammad

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?

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)

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.

CrossRoads:
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?

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.

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.

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.

CrossRoads:
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.

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.

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

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?

I would do it like this

Use a rail-to-rail output single supply op-amp
[edit - corrected signal names]

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.

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 ...

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,

Start with a multimeter in mA mode, connect in series with the +5V power lead to the chip.
Then look into opamp circuits like above.