close-circle
Close
0%
0%

USB Power Meter

A Powermeter for USB Devices / Gadgets

Similar projects worth following
Since USB has become more and more a power delivery standard, it would be nice to have a convenient way to measure the power consumption these devices need. Of course there are already power meters out there, but they are just boring or don't have all the features I like.

To measure the Voltage and the voltage drop I needed a stable reference voltage. This means I can not power the ATtiny without regulation and use this voltage as a reference. Instead I've chosen to use the internal 1.1 volt reference the ATtiny offers. This way I need to split the voltages down so the are around that 1.1 volt area instead of the +5 volts of USB.

This Powermeter has a section of Testpoints where you can easily attach probes to different pars of the system, so it can be used to tap off any of the USB lines.

Also there is a switch that acts as a power switch for the meter and disconnects the shunt resistor so you can use your own multimeter to measure everything

View all 12 components

  • Video Demo

    Daniel Grießhaber12/22/2015 at 22:25 0 comments

    I already uploaded a couple images as a proof of concept for the board and the firmware, but I just made a quick demo video that shows the thing in action:

  • Programming difficulties

    Daniel Grießhaber12/22/2015 at 19:54 0 comments

    I received the boards 1 week ago and started programming the firmware today. For the 7 segment version of the meter I used a standard 0.1" header for the ICSP but since the OLED version is smaller, i used 0.05" SMD pads instead.

    Originally I wanted to use Pogo Pins and build a small programming adapter that you could attach to the back that presses the spring loaded pins on to the pads. But since it took a bit longer for the boards to arrive I now simply soldered the wires directly to the board: -> cheap and hacky but works like a charm :)

    the unpopulated boards with the programming header on the back

    soldered wires to the programming header

    As I said it works quite well but after some programming I lost the reset pad because I did not tack the cables down. This was not a problem since I could still attach the reset line to the pullup resistor but as I said this is a hacky solution.

    In the end I also lost part of the the 5V pad. Again, I can reattach the cable o another component so the board still works fine.

  • Finally Working

    Daniel Grießhaber12/22/2015 at 19:34 0 comments

    I just finished the first Version of the Firmware. It isn't pretty by any means but it shows the basic functionality working.

    I currently only show 3 readouts:

    • supply voltage
    • current drawn
    • power

    there is currently only one mode so I use the mode switch to flip the display.

    As I said the firmware only shows a proof of concept of the functions and the used libraries to proof a working PCB to the judges of the square inch contest. More functionality is planned (e.g. graphing of current, power, voltage, all together?)

    But thats all for now folks.

    my logo displayed when powering on

    the readouts

    ripped off the reset pad while programming

  • New Measuring method

    Daniel Grießhaber11/24/2015 at 18:12 0 comments

    While writing the firmware for the 7 segment version I noticed a design flaw in my layout. I was using a resistor network to attenuate the voltages measured at the shunt by a factor of 5. I thought this might be necessary because I was using the 1.1V reference of the ATTiny85. This would get me a dynamic range at the ADC in single ended mode of which would be enough to measure the ~5V that USB should give us. However, for the current measurement I use the differential mode of the ADC which has a switchable gain of 20. The formula to calculate the current given a measured digit count is therefore

    with

    and

    Even with the gain switched on, I would get a dynamic range in the current domain of

    which would result in a resolution of

    which is OK but far from being good in the <100mA range. This also would enable me to measure up to

    when the gain is switched off. Since the meter does not support USB-C I do not expect such high currents (Even USB-C cant handle 275W@5V).

    So what I did was to remove the attenuation network. However, this means I can not measure the supply voltage with the 1.1V reference, and would result in always reading 1024 when applying the expected 5V to the input. Not be able to measure the input voltage however would mean I would not be able to measure the power consumption either which would make the device a current meter only. Thats kind of useless, however I did not have any more free pins on the ATTiny so what should I do?

    After a bit of thinking I finally came to a solution and I want to say it is quite clever because I only have to attach one component. The only pin that was not doing anything important was the input pin for the mode selection switch. However I did want to have a switch to select the current mode rather than cycling through the modes on a fixed interval.

    So what I came up with is using the 10k pull-up resistor that was already there as one part of the attenuation divider. All I had to add was another 2k resistor to ground. This gives me a high impedance, x5 attenuator. The function of the switch is not influenced either. If the button is pressed, the 2k resistor is bridged, shorting the input to ground, meaning I should get a really low value while reading the pin with the ADC. If the button is not pressed, I should always read a value greater than, lets say 256 which would mean that I only get 1.5V from the USB port. At this supply voltage I can expect that the meter and the device do not work properly anyway so nothing to worry about false-positive button switches.

    Here is the circuit before the mod:

    and here with the added resistor:

  • Boards populated

    Daniel Grießhaber11/19/2015 at 17:50 0 comments

    Here are just some Photos of the (mostly) populated board (without the Display). Now I have to write some firmware...

  • Boards arrived

    Daniel Grießhaber11/17/2015 at 19:47 0 comments

    Today finally the boards in v0.9 arrived. They are just beautiful, but before I will post some pics, I want to share the story of my hassle:

    After I ordered the boards, I quickly realised that PayPay did not allow me to complete the transaction. After a long (but friendly) phone call I knew that the security system somehow stopped the transaction until all other of my transaction are completed. The problem maybe was that I ordered too much stuff for a small amount in a short time, and the automatic fraud protection did kick in for my account. After 9 days finally the payment was completed. Turn time at OSHPark was really short with 5 days until they were shipped. Shipment time was another 16 days until today which sums up to a total of 30 days!

    However, now they finally arrived and they are BEAUTIFUL. Checkout them out:

    Frontside

    Backside


  • Stencils

    Daniel Grießhaber11/07/2015 at 15:27 0 comments

    As I just wrote in a Log in my DIL-Duino Project, I just tried out the OSHStencil service and ordered a set of stencils. While I was at it I also thown in a set of stencils for this project. I don't think it is really nessecary to use a stencil for this board, but it may help me while assembling the boards.

  • Design, Sleep, Check, Repeat

    Daniel Grießhaber10/29/2015 at 19:14 0 comments

    In the last 4 Days I fixed several mistakes in my board and I did was checking the board from time to time and rethink some parts.

    A big mistake I noticed just today is that I swapped PB2 and PB0 as data and clock for the I2C bist over the USI.

    I learned this lesson the hard way a while back. If you have the time, use it to check your design, but don't force yourself into finding errors. The best time to do it is while you're needing a break from something else. Another thing I do quite often is print out the project (the board, schematic or even a headerfile or hand scribbled UML diagrams) so you can always have a quick look at your project. It is then when you find the most obvious errors you missed previously.

    Also it is a good way to take some time each day to check everything for correctness. You most likely won't find all errors on one day and you may have a complete different look on the things at another day

  • 1"² Version for the square inch contest

    Daniel Grießhaber10/25/2015 at 19:47 0 comments

    I decided to make a new version of the board that fits on a single square inch to enter this project to the Hackaday square inch contest.

    Since the old form factor was mainly influenced by the 7 segment display, I decided to switch to a 0.96" OLED Display that fits the form factor of a square inch board quite nicely.

    The board is a complete redesign, however the schematic is mostly the same. I only needed to add 2 10kΩ pull ups to the I2C line of the display.

    With the new display I am also able to implement much cooler features. I think about a graphing function that plots the voltage / power / current over time and different UI setups. However I was not able to fit all the testpoints from the old version due to the smaller perimeter. Now only VIN and VOUT have a dedicated testpoint

    I will still finish the other version of the board and can use it to verify the current and voltage sense circuit. I think that the 1Ω shunt resistor is way to big, however I will need to double check that when the boards are back

  • 3dD Printed Case

    Daniel Grießhaber10/24/2015 at 16:59 0 comments

    I soon have the chance to use a 3D Printer. I want to create a case for this project so I've come up with this. I hope it will fit, since I'm still waiting for the boards.

View all 12 project logs

Enjoy this project?

Share

Discussions

Jono Spiro wrote 04/11/2016 at 21:50 point

Nice to see someone trying to make a useful meter. The ones on the market are no good for measuring small currents and are not at all hackable.

  Are you sure? yes | no

alpha_ninja wrote 12/07/2015 at 01:10 point

[verified: no design files missing]

  Are you sure? yes | no

alpha_ninja wrote 12/02/2015 at 00:44 point
This is your one-week reminder to upload design documents: https://hackaday.io/project/7813-the-square-inch-project/log/28566-design-deadline

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates