Jump to content
oPossum

Volt/Amp/Watt meter

Recommended Posts

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

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.

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

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

×