Jump to content
43oh

Volt/Amp/Watt meter


Recommended Posts

  • 2 months later...

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?

 

 

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.

Link to post
Share on other sites
  • 7 months later...
  • 3 weeks later...

@@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.
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.

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

Link to post
Share on other sites
  • 4 weeks later...
  • 1 month later...
  • 4 months later...

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.

 

The compiler will in-line optimise the methods if required (helps if declared "inline") - if the ports definitions are const (which they are) the optimisations should be exactly the same as a templated class - you instantiate a static instance of the LCD class anyway... not sure what, if anything, is gained from using templates here other than a whole bunch of typing... just wondering...

 

Further, using an initialiser list in the LCD constructor would allow class-local constants to be fixed during construction which is somewhat neater than using blank namespace or static consts and creates better encapsulation (compile -O3 or -finline-functions).

 

There should be no extra costs in memory/stack/efficiency in using this method, but there'd be a bunch less text and the code would arguably be a load clearer   :smile:

 

Nice project, BTW.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...