Pages: [1] 2   Go Down
Author Topic: How to measure Current being drawn by Arduino Platform  (Read 2598 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11730
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

[ I won't respond to messages, use the forum please ]

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 525
Posts: 26538
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Peoples Republic of Cantabrigia
Offline Offline
God Member
*****
Karma: 6
Posts: 719
Arduino happiness
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11730
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

[ I won't respond to messages, use the forum please ]

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 525
Posts: 26538
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11730
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

[ I won't respond to messages, use the forum please ]

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 525
Posts: 26538
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Ontario
Offline Offline
God Member
*****
Karma: 24
Posts: 862
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 525
Posts: 26538
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


* Current_measure.jpg (42.78 KB, 960x720 - viewed 63 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 525
Posts: 26538
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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]


* Current_measure_opamp2.jpg (51.44 KB, 960x720 - viewed 34 times.)
« Last Edit: April 04, 2012, 11:10:20 pm by CrossRoads » Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 525
Posts: 26538
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Full Member
***
Karma: 0
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1] 2   Go Up
Jump to: