To build or not to build?
Why would I want to build it myself instead of buying one? Well, first of all, is a good exercise to realize exactly what's inside of an electronic voltmeter and ammeter, then is the practice of writing some c++ code that will integrate the mathematical formulas for the shunt and for the voltage divider.
Challenge
If i was about to build this device, I wanted it to be able to read voltages between 0 and 40V, currents up to 10A and to achieve a low power consumption. I wanted to obtain a good precision and to have the possibility of calibrating the device.
Advantages of having a device you built
-Having a device that you built, is always good because you can personalize it. You can put your name on it, you can display other messages, you can choose your own display colors, you can create your own font, etc...
-You can display the desired range, number of decimals, and particular order of your readings. You can make personalized measurements (as power readings at certain voltages). You can display warning or error messages if some readings are exceeding certain values. You can program it to display min/max values at your choice, depending of your needs and your applications.
-You can make a design that is perfectly adapted to your needs.
-It is a good exercise and you can learn a lot from building it. It takes you back to the school years of designing and calculating a shunt, calculating the factor of an OpAmp and integrating the values into the MCU through the ADC. It is a lot of play and a lot of fun.
The case files can now be downloaded from here:
https://cults3d.com/en/3d-model/tool/16x2-lcd-panel-meter-case
A less ugly way of averaging eight(or more) integers
int x=0;
for(int 0; i<9; i++){
x+=whateverfunctiongetsthevalue;}
x=x/8;