PDA

View Full Version : Measuring current and/or wattage with Arduino



SXRguyinMA
12-17-2010, 08:48 PM
I've been trying to figure out how to set this up. I want to be able to read current or wattage of 3 different DC lines (3v, 5v and 12v) and displaying them to an LCD screen.

This will be used in conjunction with my LCD voltmeter and project Power house. I want to be able to push a button and switch the display between volts and current or volts and amps or maybe even all 3.

I've been looking into precision resistors and also hall effect sensors. what would be the best way to go about hooking this up?

x88x
12-18-2010, 01:53 AM
What you want to do is get a current sense resistor (http://www.mouser.com/Passive-Components/Resistors/Current-Sense-Resistors/_/N-7fjcf?FS=True) (also called a shunt). It will have a very, very low resistance. Then, measure the voltage drop across the shunt, apply I=V/R, and you're done. :D Also, if you want to show power use, just multiply the voltage by the current (P=IV).

EDIT:
If you want to do it really cheaply or need to pass a very large amount of current, you could also just drop in a length of large-gauge wire. Just measure the resistance and use that in your calculations. High current shunts are just sheets of metal of a known resistance, so it's basically the same thing and doesn't require you to buy more components.

EDIT2:

volts and current or volts and amps
Same thing. Current == phenomenon. Amps == unit. ;)

SXRguyinMA
12-18-2010, 09:03 AM
ok so that will work for the 3.3v line as it's well within the Arduino's reading range. According to this guy (http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1205745528/27#27), I'll need an opamp stage or two for both the 5v and 12v sections (as I needed voltage dividers for both) to get the readings within spec. Off to Google I go lol

This is all the stuff I'll be learning once I get my prerequisites out of the way and actually get into my Electrical Engineering course :D

oh and I meant volt and amps or volts and watts, but ideally, be able to cycle through all 3

Konrad
12-19-2010, 10:50 PM
Opamp stages for what? Preamp? Sorry, I'm not familiar with Arduino parts ... aren't these functions built into the ADC inputs?

x88x
12-19-2010, 11:55 PM
The link was saying that the voltage drop on the heftier rails probably won't be enough for the arduino to pick up, thus the signal amplification.

Konrad
12-20-2010, 06:51 AM
Ah. Choosing a better Arduino part (or a better non-Arduino part) isn't an option?

If you're gonna stick a bunch of extra logic in there anyhow then maybe cannibalize an inexpensive DMM instead ... achieving basic DCV accuracy of <±0.5% across the full DMM range is easy for even the lousiest cheap DMM, plus you get the display and whatever logic is needed to drive it (and some other cool parts like the rotary lock switch and probes and jacks) ... check out this cheap beauty ($18 at Wal-Mart (http://www.walmart.com/ip/Equus-3300-Hands-free-Digital-Multimeter/14644665#Specifications), $12 at Amazon (http://www.become.com/equus-3300-handsfree-digital-multimeter--compare-prices--sc1087575353)) or even this ultra-cheap Shenzhen special ($3.49 (http://www.harborfreight.com/7-function-digital-multimeter-90899.html?utm_term=90899&utm_medium=cse&utm_source=become&hft_adv=10013)) ... these would probably work well for this application and might cost less than proper Arduino parts. Then again, an LM324 (or whatever) probably only costs two bucks ... still, if you've got an old junkmeter lying around ...

SXRguyinMA
12-20-2010, 11:01 AM
well I'm going to be integrating a multimeter into the project (see Power House in my sig), but I would like to have a real-time readout on the LCD of exactly what is being used by each output without having to probe them. The Arduino components are the easiest for me, as it's the only thing I'm familiar with at the moment :D

x88x
12-20-2010, 05:54 PM
This could be a cool addition to this. 640x200 monochrome display, $2 at Electric Goldmine.
http://www.goldmine-elec-products.com/prodinfo.asp?number=G14876

I did some searching the other day and found a guy who wrote an AVR driver for it...unfortunately it needed, iirc, 32KB of SRAM to drive the whole display, so you would need to figure something out with a display buffer. I'm planning on picking up a few of them in a week or two to see how they work out.

SXRguyinMA
12-20-2010, 06:05 PM
awesome idea but I'm already cramming everything in spacewise lol

SXRguyinMA
12-22-2010, 10:59 AM
well I think I've found a simple and inexpensive current monitoring device :D

http://www.goldmine-elec-products.com/prodinfo.asp?number=G16976

I'll pick up 3 of these and hook them to the arduino, and run one power supply line through each

Konrad
12-22-2010, 03:19 PM
Inductors ... ick. I found a decent linky here (http://www.linear.com/ad/current_sense.jsp).

SXRguyinMA
12-22-2010, 05:03 PM
cool I'll check that out. thanks!

x88x
12-22-2010, 07:44 PM
If you're still looking for a shunt, I've been looking around out of curiosity, and weirdly, I can't seem to find many. All of the ones on Mouser top out around 140A and are pretty expensive. I found these that are priced quite nicely (http://www.lightobject.com/Shunt-and-AC-Coil-C27.aspx) and you can get from 20A ($6.50) up to 500A ($16.50). I've never heard of the store though, and I didn't see any reviews of them in a quick search. Really though, like I mentioned, it's just a chunk of metal with a very low, known resistance, so a bundle of 12ga wire or some grounding braid should do the job just as well (come to think of it, maybe that's why I can't find many :P ). In fact, one of the ones I found for sale on eBay was just that..some copper grounding braid with metal hookup clamps on either end.

SXRguyinMA
12-22-2010, 07:52 PM
well I was looking through konrad's link and it looks like my best bet is to go with a classic positive supply rail current sense setup. the only problem I'm running into is finding 0.2Ohm precision resistors, and finding the LT1637CN8 in quantities less than 2500 :facepalm: lol

this link, first page top right is the setup
http://www.linear.com/ad/02-high_side.pdf

Konrad
12-23-2010, 03:16 AM
200mOhm resistors ... that seems a bit odd. Can you rework the circuit for a more common resistor value?

You can try this (http://www.edaboard.com/thread17066.html) if extreme precision isn't absolutely required.

An alternative would be SMT resistors, like this one (http://www.cascadesurplus.com/catalog/product_info.php?products_id=506), or a 5% RMCF0805JTR200, or a 1% CSR1206FKR200. They'd have very low wattage capacities, though.

Another alternative is to build a network from precision resistors to gain your final 200mOhm value ... again, precision may not be great if the combined tolerances are all factored in. You might be able to hand-match specific pieces, although you'd want to measure their values across the entire expected temperature operating range to assure best precision.

You might gain best accuracy for such a low-voltage application by using a Wheatstone bridge (http://www.allaboutcircuits.com/vol_1/chpt_8/10.html) (or similar balanced bridge) circuit.