EEVblog Electronics Community Forum

Electronics => Microcontrollers => Topic started by: jwbrooks on November 15, 2013, 10:52:43 pm

Title: Arduino voltmeter and ammeter
Post by: jwbrooks on November 15, 2013, 10:52:43 pm
Hello,

I'm a little out my depth, and I was hoping I could get some pointers or in the very least a few links to relevant material.

My Objective
I need to build a "unit" that measures both voltage and current of the power passing through it, and passes these values on to my microcontroller.   I'm looking to use ICs or breakout boards instead of full multimeters.  Please, refer to the attached picture. 

Specs
The power source will be AC stepped down and rectified to ~50V DC.  The current will likely be on the order of 0.25 to 1.5 amps.  The two meters will need have a minimum of 12 bit resolution (16 would be better) and be as noise free as possible.  The sampling rate can be as slow as 1Hz.

My questions
1.  What ADCs or breakout boards do people recommend?
2.  Do these ADCs measure voltage and current directly, or do i need to build an additional circuit to support the ADCs? 
3.  Is rectified or unrectified AC easier to measure?  For my end application, it doesn't matter which I provide.  I just want the cleanest and most precise measurement. 

Thank you.  I appreciate whatever feedback you can offer. 

Title: Re: Arduino voltmeter and ammeter
Post by: timb on November 16, 2013, 12:35:04 am
1) The Arduino has built-in ADC inputs (Eight 10-bit channels on the 328P). You could double them up to improve the resolution, otherwise I'd just get a 16-bit ADC from TI and solder it onto a SOIC breakout board yourself. It may be a good idea to run the input through a high performance instrumentation OP-amp first as well.

2) Normal ADCs measure voltage. To measure current what you'll need to do is use a shunt resistor (or series resistor). If you want to "cheat" you could use something like an ACS712 (https://www.sparkfun.com/products/8883) current sensor, which you place in-line with what you want to measure and it outputs a voltage to measure (e.g., 1mV = 1mA).

3) You'll have to rectify the voltage to measure it with an ADC. You'll also need to attenuate the voltage down to what the ADC can handle as well. What you want to do is rectify the voltage and then run it through a voltage divider. (This is how multimeter's work, when you change ranges you're changing the voltage dividers the input goes through.)

Can you explain what you end goal is? Why can't you use a multimeter? Getting clean, noise free, precise voltage measurements at 16-bits is going to be really hard without designing a custom PCB (with separate analog and digital supplies and proper ground planes). You can buy a $30 multimeter on Amazon (http://www.amazon.com/TekPower-TP4000ZC-RS232-Interaced-Ranging-Multimeter/dp/B000OPDFLM/ref=sr_1_1?ie=UTF8&qid=1384562074&sr=8-1&keywords=TP4000ZC) that has an RS-232 output, which you could bring into the microcontroller a hell of a lot easier than you're going to build this circuit.
Title: Re: Arduino voltmeter and ammeter
Post by: dannyf on November 16, 2013, 01:09:48 am
Quote
1.  What ADCs or breakout boards do people recommend?

16-bit on current measurement is quite difficult: most current sensors are good to 1% (~8 bits).

Quote
2.  Do these ADCs measure voltage and current directly, or do i need to build an additional circuit to support the ADCs? 

ADI and Microchip have some of those chips.

Quote
3.  Is rectified or unrectified AC easier to measure?

Measuring AC is generally beyond what most people are capable of doing.
Title: Re: Arduino voltmeter and ammeter
Post by: Jon Chandler on November 16, 2013, 02:30:59 am
Look at the TI TMP512/513 chips.  They'll handle up to 28 volts and have a high resolution ADC to measure current with a shunt resistor.  It's an I2C interface.
Title: Re: Arduino voltmeter and ammeter
Post by: Kappes Buur on November 16, 2013, 04:58:20 am
For a first experiment take a look at these:

http://startingelectronics.com/articles/arduino/measuring-voltage-with-arduino/ (http://startingelectronics.com/articles/arduino/measuring-voltage-with-arduino/)
http://startingelectronics.com/projects/arduino-projects/arduino-4-channel-LCD-voltmeter/ (http://startingelectronics.com/projects/arduino-projects/arduino-4-channel-LCD-voltmeter/)

Title: Re: Arduino voltmeter and ammeter
Post by: johnboxall on November 17, 2013, 10:13:07 pm
http://www.linear.com/product/LTC2945 (http://www.linear.com/product/LTC2945)
Title: Re: Arduino voltmeter and ammeter
Post by: synapsis on November 18, 2013, 04:58:13 am
I used this on a programmable load project. You can read current, voltage, and power from the single device.

http://www.ti.com/product/INA226 (http://www.ti.com/product/INA226)
Title: Re: Arduino voltmeter and ammeter
Post by: jwbrooks on November 19, 2013, 08:56:44 pm
Thanks for the feedback!

I've done a bit of research on peoples suggestions, and I think I'd prefer (for the time being) to not reinvent the wheel and use one of these "power monitor" ICs.

What do people think about something like this?  I could keep the 120VAC as it is (no step down or rectification). Is the 24 bit resolution for real?
http://www.ti.com/lit/ml/slyt428/slyt428.pdf (http://www.ti.com/lit/ml/slyt428/slyt428.pdf)
Title: Re: Arduino voltmeter and ammeter
Post by: jwbrooks on November 19, 2013, 09:56:31 pm
Or this one?
http://media.digikey.com/PDF/Data%20Sheets/Maxim%20PDFs/MAXQ314.pdf (http://media.digikey.com/PDF/Data%20Sheets/Maxim%20PDFs/MAXQ314.pdf)
Title: Re: Arduino voltmeter and ammeter
Post by: NANDBlog on November 23, 2013, 10:22:06 am
I would use the DC value.
Divide the 50 Volt by 15-20 with a resistor divider, buffer it with an opamp, connect it to ADC. Put a shunt on the high side, and connect a high side current sense amplifier to it, connect it to a ADC.
http://nandblog.com/types-current-sense-amplifiers/ (http://nandblog.com/types-current-sense-amplifiers/)
If you can tell us not only the resolution, but also the accuracy, maybe we can give you more detail.
Title: Re: Arduino voltmeter and ammeter
Post by: timb on November 25, 2013, 11:15:54 pm
Thanks for the feedback!

I've done a bit of research on peoples suggestions, and I think I'd prefer (for the time being) to not reinvent the wheel and use one of these "power monitor" ICs.

What do people think about something like this?  I could keep the 120VAC as it is (no step down or rectification). Is the 24 bit resolution for real?
http://www.ti.com/lit/ml/slyt428/slyt428.pdf (http://www.ti.com/lit/ml/slyt428/slyt428.pdf)

The MSP430AFE won't take straight 120VAC... You need to use a resistor divider to bring it down to under 400mV (which is the range of the ADC). For current you'd need expensive current transformers or shunt resistors. You'd also need to add filtering for voltage spikes and some form of over voltage clamping.

Then you'd need to optically/magnetically isolate the data output to your PC/second microcontroller.

That's way too complex for what you want to do I think.
Title: Re: Arduino voltmeter and ammeter
Post by: timb on November 25, 2013, 11:17:37 pm
Seriously, just get one of these: http://www.amazon.com/TekPower-TP4000ZC-RS232-Interaced-Ranging-Multimeter/dp/B000OPDFLM (http://www.amazon.com/TekPower-TP4000ZC-RS232-Interaced-Ranging-Multimeter/dp/B000OPDFLM)

$35 Multimeter with an RS-232 interface. The protocol is available online (I've got a copy if you need it) so you could easily interface it with a computer/microcontroller or whatever. Boom, done.
Title: Re: Arduino voltmeter and ammeter
Post by: SixD on December 16, 2013, 06:48:44 pm
I found this page http://arduinoprojects101.com/arduino-voltmeter/ (http://arduinoprojects101.com/arduino-voltmeter/)
maybe it can be any help.