It can continuous measure the voltage(V), current(mA) and accumulated power usage(mWh). And also plot a simple graph to visualise the figures. As simple hookup guide is splashed on the OLED screen on startup.
The code has been forked and modified for a smaller OLED Screen.
The breakouts are screw terminals; male pins screwed in make for easy connections.
I suggest you breadboard the project based on moononournation's Instructable first. I looked for optimizations but could not improve on his original design. I considered adding pullups on the I2C lines but "if it ain't broken, don't fix it".
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Materials and Tools
There is a full Bill of Material and Sourcing list.
- 3D printed casing (1)
- 1" Double sided protoboard (1)
- OLED Screen (1)
- INA219 Module (1)
- ATTINY85 20PU (1)
- 2P Screw Connector (1)
- 3P Screw Connector (1)
- LIR2450 Battery (1)
- LIR2450 Holder (1)
M2.2 x 6mm Countersunk screws (4)
Cyanoacrylate glue (1)
- Hookup wire (7)
- Solder Iron (1)
- Solder (1)
Step 2: Download Source Code
Download source from GitHub: https://github.com/IOT-123/ATtinyPowerMeter. If you are not familiar GitHub, simple press "Clone or download" button and then "Download ZIP".
Step 3: Program ATtiny85
Use Arduino compile and program the source to ATtiny85. You may find more details in these instructables:
Step 4: Protoboard Assembly
There are a few occasions where soldering on the other side of a through hole is obstructed. When this is the case, I soldered a dob on the target through hole, then from the side melt the solder and push the exposed hookup wire into center hole, hold and remove heat.
- From the bottom, insert pins from 2P connector in RED1 & RED2 with opening to outside. Solder pins off on topside.
- From the bottom, insert pins from 3P connector in RED3, RED4 & RED5 with opening to outside. Solder pins off on topside.
- From the bottom, insert pins from ATTINY85 in RED6 - RED13 with chip marker as shown. Solder pins off on topside.
- From the bottom, solder a blue wire from YELLOW1 to YELLOW2.
From the bottom, solder a green wire from YELLOW3 to YELLOW4.
- On the top, solder a black wire from RED1 to RED4.
- On the top, solder a black wire from BLUE1 to BLUE2.
- On the top, solder a black wire from BLUE3 to BLUE4.
On the top, solder a red wire from PINK1 to PINK2 (leaving plenty of excess wire as shown).
On the top, solder a red wire from PINK3 to PINK4 (leaving plenty of excess wire as shown).
On the top, solder a red wire from PINK5 to PINK6.
On the top, solder a red wire into PINK7 (leaving plenty of excess).
On the top, solder a black wire into PINK8 (leaving plenty of excess).
Solder 6P male headers onto the INA219 module as shown.
From the top, insert the INA219 pins into ORANGE1 - ORANGE6 and solder.
Solder 4P male headers onto the OLED module as shown.
Remove the plastic collar from the 6P pins.
Bend the pins into a slight S shape, dry fit to check boards are parallel.
From the top, insert the OLED pins into ORANGE7 - ORANGE10 and solder.
Step 5: Casing Assembly
- Insert assembled protoboard/INA219/OLED into 3D printed casing and secure with screws.
- Assemble SPDT with 3D printed switch surround, with Cyanoacrylate on contacting surfaces.
- Tin pins on SPDT.
- Fasten switch assembly to casing with Cyanoacrylate.
- Tin pins on LIR2450 holder.
Fasten LIR2450 holder to casing with Cyanoacrylate.
Solder loose black wire from protoboard to -ve pin on battery holder.
Solder loose red wire from protoboard to middle pin on SPDT switch.
Solder a red wire from +ve pin on battery holder to bottom SPDT pin (closest to large opening on casing).
Although not necessary, easier connection can be achieved by attaching male header pins to the screw connectors.
- Connect 1x2P male pins to 2P screw connectors.
- On a 2x3P male pins bend and solder pins on one row to there adjacent pins on the other row.
- Connect this to the 3P screw connectors.
Step 6: Next Steps
If using the LIR2450, once inserted power up by pushing the switch down.
The splash screen shows the connector usage.
2P Connector (this is used when not using the LIR2450):
- Outer PIN, Monitor Power Supply GND
- Inner PIN, Monitor Power Supply +ve
3P Connector (this is used for the device to be monitored):
- Inner PIN, Device +ve
- Middle PIN, Device GND, Device Battery GND
- Outer PIN, Device Battery +ve