oPossum

Volt/Amp/Watt meter

27 posts in this topic

This is a simple voltage and current meter that uses the TI INA219 chip. Voltage measurement range is 0 to 26 volts with 4 mV resolution and current measurement range is -4 to +4 amps with 1 mV resolution (when using a 0.01 ohm shunt). The specs are inferior to a pair of quality multimeters, but it is a fraction of the price and shows wattage in addition to voltage and current. The Nokia 5110 display is used so the firmware could be enhanced to do simple graphing. Sending the measurements to a computer could also be done.

 

Using the INA219 makes for a very simple circuit.

post-2341-135135558819_thumb.png

 

The normal display is three lines with voltage, amperage and wattage.

post-2341-135135558794_thumb.jpg

 

Pressing the P1.3 switch will show the 6 registers in the INA219 in hex and signed decimal.

post-2341-135135558806_thumb.jpg

 

The code is written in C++ and uses templates for the LCD, IIC and INA219. Software SPI and IIC is used for maximum portability.

vam.zip

Share this post


Link to post
Share on other sites

Interesting use of templates... is that just to save on stack space vs passing the values as arguments to the function?

Share this post


Link to post
Share on other sites

Using templates allows the compiler to do compile time optimization that is not possible with C or C++ classes. It knows the pins and ports won't change at run time, so it can generate optimal code for I/O. This results in code that is smaller, faster and uses less RAM.

Share this post


Link to post
Share on other sites
Using templates allows the compiler to do compile time optimization that is not possible with C or C++ classes. It knows the pins and ports won't change at run time, so it can generate optimal code for I/O. This results in code that is smaller, faster and uses less RAM.

Nice technique. Now, I think you should put the method definitions of Nokia5110 inside the struct/class, to avoid repeating the whole template <...> before every definition. I don't know MSP compiler internals, but if you use -Os, it most likely won't inline the calls.

Share this post


Link to post
Share on other sites

The accuracy is +/- 0.2% typical. That is similar to a low cost 3 1/2 digit DMM.

 

It alternates between current and voltage samples. It only has one ADC.

 

For 12 bit resolution it takes about 1 millisecond to sample both current and voltage, so about 1000 samples per second. The resolution can be adjusted down to 9 bits for an almost 10x increase in speed. It is also possible to average up to 128 samples.

 

Full details are in the spec sheet linked in the first post.

thanhtran likes this

Share this post


Link to post
Share on other sites

Thank you for sharing this oPossum.

 

Is there a reason not to use hardware SPI when talking to 5110 besides compatibility with older chips? Or are there other issues, such as the D/C signal somehow getting in the way?

 

Also, am I correct to assume that 5110 is no longer manufactured and that the displays that we buy from ebay come from recycled phones? Is there a similarly cheap / easy to use display that is still in production and can be bought outside of ebay (e.g. from Mouser)?

Share this post


Link to post
Share on other sites

Very nice work! I just duplicate this. It makes a very nice meter for my bench power supply :) Still trying to see if my shunt resistor (0.01ohm .5%) is wrong or what but my amp meters (fluke 179 and a clamp meter) show 0.5A less than what the INA219 gives the code. I had to parallel a 0.1Ohm with the 0.01 to get the reading closer to my meters.

 

It looks sophisticated with the memory dump too :)

 

Thanks

 

-Thanh

Share this post


Link to post
Share on other sites

Was just looking at the code, and I have to ask, how are you getting anything for registers 3, 4, and 5 (Power, Current, and Calibration), if you never set the calibration register? On power-on, the calibration register should be blank, as should the power and current (because anything multiplied by 0 is 0)?

Share this post


Link to post
Share on other sites

First post , looks like a great forum so far. I have been looking to make a simple voltmeter that outputs to a binary style display using Led's , that would end up being up to the 16's place. Basically long story short , I'm looking to make a test light for automotive wiring (low load preferable , but I have a great multimeter for CMOS lines) .

 

Any idea how to output from the 430 to a binary display?

 

 

Thanks

-hov

Share this post


Link to post
Share on other sites

The accuracy is +/- 0.2% typical. That is similar to a low cost 3 1/2 digit DMM.

 

It alternates between current and voltage samples. It only has one ADC.

 

For 12 bit resolution it takes about 1 millisecond to sample both current and voltage, so about 1000 samples per second. The resolution can be adjusted down to 9 bits for an almost 10x increase in speed. It is also possible to average up to 128 samples.

 

Full details are in the spec sheet linked in the first post.

Opossum.. can I use this in conjunction with the DP ATX breakout board to detect an over current situation (by sampling current)

 

This would help me to:

- Adjust the current threshold.

- Relay the voltage rail off when current reaches threshold.

Share this post


Link to post
Share on other sites

I have a doubt about the INA219 resolution. The bus voltage measurement has two full-scale ranges: 16V or 32V, but for what i understand from the datasheet the resolution is allways 4mV. This makes sense with the 16V range because it has a 12 bit adc, so 16/4096=0.0039 V

The 32 range should have twice that resolution, wright?

 

 

Share this post


Link to post
Share on other sites

The resolution of the bus voltage register is always 4 mV. The resolution of the ADC is programmable up to 12 bits. So in some cases the lower bit(s) of the bus voltage register may not change. The ADC reading is shifted internally as necessary to maintain the same reading granularity in the register.

juani_c likes this

Share this post


Link to post
Share on other sites

@@oPossum.... i tried to build the circuit as it is shown in the vam_meter_schematic picture file. but the LCD do not show anything. may i know if the capacitor u used in this is a ceramic ones or electrolytic capacitor?

The back light is working but it did not display the power up logo---> msp430 and INA219 

Edited by bluehash
[ADMIN] Issued opossum call.

Share this post


Link to post
Share on other sites

Ordinary ceramic monolithic caps.

 

Make sure your LCD module does not have a pullup resistor on the reset line - some do, some don't. If it does, you will have to remove it. The LCD reset circuit used by this project will not work with a pullup resistor on the LCD reset line.

Share this post


Link to post
Share on other sites

I packed an INA219 and a MSP430G2553 with a 128x64 OLED screen into a compact 6x3cm box to measure the volt-amp-watt of my fischertechnik models.

 

One simple bulb lamp uses almost 1W! So large models can easily add up to various amps... putting the batteries under heavy stress.

 

post-12238-0-42007000-1387313073_thumb.jpg

 

The screen comes from Digole and features an I

post-12238-0-20752400-1387313108_thumb.jpg

post-12238-0-18915400-1387313648_thumb.png

post-12238-0-90457800-1387313759_thumb.png

Rickta59, cde, reaper7 and 1 other like this

Share this post


Link to post
Share on other sites

Hi,

 

if I want to use two or three INA219's, do I need to worry about the V- and GND or when two V- are have the same starting point but V+ ( of course ) not, visa versa?

 

I wil do another display of course.

 

Thank you

Share this post


Link to post
Share on other sites

may I know how do u guys connect the V+ and V- of this project to the load?
the shunt im using is 0.05ohms...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now