This instructables show how to make a simple power meter using 3 components: ATtiny85, INA219 and OLED module.
It can continuous measure the voltage(V), current(mA) and accumulated power usage(mWh). And also plot a simple graph to visualise the figures.
Step 1: Why?
While developing IoT device, power consumption does matter, especially if it cannot wired. A simple multi-meter is not enough for continuous monitoring the voltage and current at the same time. And also the accumulated power consumption (mWh) is very important for deciding how big a battery required in the IoT project.
So I use the components in hand to create this ATtinyPowerMeter.
Step 2: Preparation
The power meter should not drain too much power itself, it is the major criteria to choose the components:
ATtiny85 only draw less than 1 mA while running at 1 MHz and 8 KB program flash can well fit a power meter program.
Power Monitor Module
INA219 module is the only module I can found that can monitor voltage and current at the same time (leave comment to me if you known other modules). It draws around 1 mA power.
SSD1306 OLED display module drain few mA for display, it is the major power consumption. It should be better if using mono LCD display, but I only have this I2C display module in hand, so I will use it this time.
According to the data sheet, the above 3 components can operate at 3 V to 5.5 V, 2 rechargeable AAA battery is not enough, 3 AAA battery is better, 1 Lipo battery also ok. But in this project I am testing a new type battery, Lithium iron phosphate (LiFePO4 or LFP) battery. It is the same as AAA battery in size, but can provide 3.2 V 600 mAh. It should be good enough for most electronic project but I am still testing it.
A 380 hole breadboard, some breadboard wire, a breadboard friendly battery holder, a 3 pins screw terminal block and a switch. And also a ISP for programming the ATtiny85.
Step 3: Download Source Code
Download source from GitHub:
If you are not familiar GitHub, simple press "Clone or download" button and then "Download ZIP".
Step 4: Program ATtiny85
Use Arduino compile and program the source to ATtiny85.
You may find more details in these instructables:
Step 5: Circuit Design
Here is the connection summary:
Battery +ve -> switch -> ATtiny85 pin 8, INA219 module Vcc, OLED module Vcc Battery -ve -> ATtiny85 pin 4, INA219 module GND, OLED module GND, screw terminal block middle pin ATtiny85 pin 5 -> INA219 module SDA, OLED module SDA ATtiny85 pin 7 -> INA219 module SCL, OLED module SCL INA219 module Vin- -> screw terminal block left pin INA219 module Vin+ -> screw terminal block right pin
Step 6: Testing
- Turn on the switch, you should see V and mA figure is 0.
- Connect testing power source +ve and -ve to screw terminal right pin and middle pin respectively, you should see V figure become the power source Voltage value and mA still 0
- Connect testing loading device +ve and -ve to screw terminal left pin and middle pin respectively, you should see mA figure become the loading device drawing current value
Step 7: Self Test
You want to know how much power draining this power meter itself? In my measurement it draws around 3 - 6 mA, just for your reference.
Step 8: Happing Measuring!
It is the time to design and testing your device power consumption now!
P.S. My source code configured measure maximum 16V and 800 mA, you may change the configuration at "INA219.h".
We have a be nice policy.
Please be positive and constructive.