oPossum 1,083 Posted July 20, 2012 Share Posted July 20, 2012 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. The normal display is three lines with voltage, amperage and wattage. Pressing the P1.3 switch will show the 6 registers in the INA219 in hex and signed decimal. 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 pine, bluehash, gordon and 23 others 26 Quote Link to post Share on other sites
Arch_ETS 0 Posted July 20, 2012 Share Posted July 20, 2012 Just awesome. Thanks for sharing! Quote Link to post Share on other sites
Nytblade 24 Posted July 21, 2012 Share Posted July 21, 2012 Interesting use of templates... is that just to save on stack space vs passing the values as arguments to the function? Quote Link to post Share on other sites
oPossum 1,083 Posted July 22, 2012 Author Share Posted July 22, 2012 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. Quote Link to post Share on other sites
rbasoalto 10 Posted July 25, 2012 Share Posted July 25, 2012 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. Quote Link to post Share on other sites
oPossum 1,083 Posted July 25, 2012 Author Share Posted July 25, 2012 Yes, that is something I have to take a look at. Would clean it up quite a bit. Quote Link to post Share on other sites
pillum 0 Posted July 25, 2012 Share Posted July 25, 2012 How accurate is it at the fastest mode and how fast is the fastest mode of that chip? Quote Link to post Share on other sites
cde 334 Posted July 31, 2012 Share Posted July 31, 2012 How does it measure voltage and current at the same time? Quote Link to post Share on other sites
oPossum 1,083 Posted July 31, 2012 Author Share Posted July 31, 2012 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 1 Quote Link to post Share on other sites
MadhaV 0 Posted August 15, 2012 Share Posted August 15, 2012 Awesome work Buddy. Quote Link to post Share on other sites
kff2 22 Posted August 15, 2012 Share Posted August 15, 2012 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)? Quote Link to post Share on other sites
thanhtran 10 Posted September 11, 2012 Share Posted September 11, 2012 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 Quote Link to post Share on other sites
cde 334 Posted October 20, 2012 Share Posted October 20, 2012 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)? Quote Link to post Share on other sites
hova 7 Posted October 21, 2012 Share Posted October 21, 2012 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 Quote Link to post Share on other sites
bluehash 1,581 Posted November 17, 2012 Share Posted November 17, 2012 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. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.