TABLE OF CONTENTS
2. Bill of Materials
5. ME Cad design
6. Final Thoughts
7. Download Original files
This is a fun little project that actually took me awhile to put together. What makes this project interesting and useful is that it will display your voltage, current, and power of any device you plug it into. What also makes this project useful is that it will calculate the efficiency of your device for example a dc dc converter.
The heart of this project is two INA219 high side current sensors from Texas Instruments. With this sensor you can measure up to 26V DC and up to +/-3.2A with a 0.1ohm shunt resistor (if you swap out the shunt with a 0.01ohm shunt you can measure up to +/-32A)
BILL OF MATERIALS
Click Here for bill of materials
Here you can see a block diagram showing how I connected the different boards to create this project. Since I used my CNC machine to create the boards, it’s always much easier to separate the circuits into different boards for routing.
The main board consist of an arduino pro mini to keep the footprint as small as I can and also host a 5V boost converter being power from the 18650 lithium ion battery. In order to charge the battery without having to remove it from the enclosure, I decided to add a lithium ion charger board that connects in parallel with the battery. Its powered by a 5V USB mini connector and can be bought on amazon.
The second board host x2 INA219 high side I2C current, voltage, and power sensor by Texas Instrument. This IC is an amazing little thing because it takes a lot of the number crunching away from the Arduino and just sends the data over I2C that you need.
The final piece of this is the I2C liquidcrystal display for the arduino. I used this library here for the display. Make sure you connect the display and run an i2c address scanner on the examples for arduino because sometimes the displays have a different address than the default one listed.
* Name: Steven Guzman
* Date: 2018/03/18
* Description: This is a DC power meter that measures input and output
* power and calculates the efficiency of the system.
* It can also measure voltage and current of one or two
* voltage sources
LiquidCrystal_I2C lcd(0x3F,20,4); // Set the LCD address
* Below are the array values to store the measurements
* and then used to convert float to string
char float_volt1; // voltage 1 array
char float_volt2; // voltage 2 array
char float_current1; // current 1 array
char float_current2; // current 1 array
char float_eff; // efficiency variable array
char float_batt; // battery voltage array
// Analog sampling number
int sample = 20;
// Inialize current sensors.
// ina219_A default address is 0x40
// Variables to store current sensor data
float busvoltage1 = 0;
float busvoltage2 = 0;
float current_mA1 = 0;
float current_mA2 = 0;
float batt = 0.00;
float xbat = 0.00;
batt = analogRead(A0);
xbat = xbat + batt;
// Read voltage levels from the voltage address
// of the IN219 on both ICs
busvoltage1 = ina219_B.getBusVoltage_V();
busvoltage2 = ina219_A.getBusVoltage_V();
// Read current levels from the current address
// of the IN219 on both ICs
current_mA1 = ina219_B.getCurrent_mA();
current_mA2 = ina219_A.getCurrent_mA();
// Average out the analog measurements
// for the lithum ion battery voltage
xbat = xbat/sample;
float battery = xbat * (5.00/1024);
char temp3 = “V”;
// Convert float values into an char array to
// better update on the lcd screen without
// having to use the lcd.clear function
char temp2 = “V”;
char temp1 = “V”;
// Convert mA to A readings
float C1 = current_mA1/1000;
float C2 = current_mA2/1000;
char temp4 = “A”;
char temp5 = “A”;
float power1 = busvoltage1 * C1;
float power2 = busvoltage2 * C2;
float eff = (power2/power1)*100;
* Display on LCD screen all the values.
* I used char arrays to update the values on the
* screen. Using the lcd.clear caused flickering
* and was annoying. With char array you can include
* the units and it will update properly and not
* overright the units.
There might be some issues with how wordpress displays the arduino code but I attached the original files at the end this tutorial.
As mentioned before, the libraries used here I obtained from other sources:
ME CAD DESIGN
I designed the enclosure in fusion 360 and printed the both with matterhackers pro series PETG red. I used a monoprice maker select v2 to print this enclosure.
Here is the step file for the enclosure
This was one of my favorite projects yet because the design alone makes me feel accomplished learning everything on my own. I still feel like I can make some upgrades to how I mount the internals and to be honest, I really rushed this part because I wanted to finish it.
Some upgrades I’m considering is using the arduinos internal 1.1V reference with a voltage divider to measure the battery voltage because it wasn’t as accurate as I wanted it to be.
Thank you for visiting and reading my project. if you have any questions or comments or suggestions please don’t hesitate to ask.