Giter Site home page Giter Site logo

usb-power-gauge's Introduction

Code for the Adafruit USB Power Gauge mini kit

This little USB port go-between is like a speed gauge for your USB devices. Instead of hauling out a multimeter and splicing cables, plug this in between for a quick reading on how much current is being drawn from the port. Great for seeing the charge rate of your phone or tablet, checking your battery chargers, or other USB powered projects.

There are a few USB power meters out there, The Practical Meter and the USB Spypow. We wanted something that was made for makers: Reprogrammable micro-controller, analog output, TTL serial output for debugging / datalogging and of course, open source.

Data is passed through transparently from end to end, so you can use it with any USB device at any speed. The power line has a 0.1 ohm current sense resistor and an INA169 high-side current sensor that is tracked by a little ATtiny85 chip. The microcontroller is programmed to read the current draw as well as the bus voltage and light up the strip of LEDs on the side.

The blue LEDs will light up, one for each Watt of power draw (which is ~200mA at 5V nominal), with a couple levels of PWM dimming for increasing current. You can measure up to 1A of current draw - most USB ports are rated for 500mA. It's safe to use this with something that draws up to 2 A of current, it'll just 'max out' the LEDs.

The green LED is helpful to tell if you have too much droop on your power line. It stays lit as long as the voltage is higher than 4.5V, most devices won't charge effectively once it goes below that so if the green LED goes out, you know you should check your port, shorten the USB cable, or reduce the current draw.

As an awesome extra, we also print out the voltage, current and wattage data as readable text on the TX pin at 9600 baud. Connect an FTDI friend, USB console cable, microcontroller, XBee, whatever you want that can read 9600 baud TTL serial data for datalogging, plotting or display.

Comes as a mini kit with an assembled & tested PCB plus a separate USB jack and plug as shown above. Before use, solder the jack and plug. It'll only take you a few minutes and can be done with any soldering iron. Or, advanced users can splice it between a USB extension cable.

Please note: this is a handy gadget but it isn't a multimeter! We do some basic calibration during test, but the serial output readings are not precise and should be used as a basic guide rather than lab-grade data plots. Assume a variance of at least 0.1V and 50mA due to noise, thermal changes, etc.

License

Adafruit invests time and resources providing this open source design, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Designed by Adafruit Industries.
Creative Commons Attribution, Share-Alike license, check license.txt for more information All text above must be included in any redistribution

usb-power-gauge's People

Contributors

ladyada avatar hoffmannjan avatar

Stargazers

Russell O'Connell avatar Nathan Paul Simons avatar Chen Zhicheng avatar Lantern Master  avatar  avatar  avatar  avatar Jeremy Impson avatar Darryl Ruggles avatar  avatar Vadim Tkachenko avatar Linards avatar Claes Backstrom avatar Byungwoo Kim avatar Sayanee Basu avatar ericosur avatar Willie Scholtz avatar ddm avatar Michalis™ avatar Paul avatar JT5D avatar Feri Beke avatar ZakMcKraken avatar  avatar Allen Baker avatar Russ Herrold avatar

Watchers

Kevin Townsend avatar Justin Cooper avatar Brent Rubell avatar Becky Stern avatar William Phelps avatar James Cloos avatar Paint Your Dragon avatar ZakMcKraken avatar  avatar Tyler Cooper avatar John Edgar Park avatar  avatar  avatar  avatar Abraham avatar Guillermo Kirsch avatar Alex avatar  avatar Eva Herrada avatar

usb-power-gauge's Issues

Editing source with USBTinyISP

Can you explain how to use USBTinyISP and avrdude to load the files in this repo onto the power gauge?

The command avrdude -c usbtiny -p t85 is giving me

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e930b

avrdude: safemode: Fuses OK (H:FE, E:D5, L:F1)

avrdude done.  Thank you.

but I'm not sure what to call the hex files when writing to the power gauge.

inaccurate current readings possibly caused by shared calibration value

I'm confused by the way the calibration value is used:

int readVCC(void) {
ADMUX = 0x0C; // read VBG
...
int readCurrent(void) {
ADMUX = 3 | _BV(REFS1); // read PB3 (output from sensor)

So:
readVCC() uses Vcc as the voltage reference and VBG as the input.
readCurrent() uses the internal 1.1v reference and PB3 as the input.

So, they both have different reference and input sources. How is it possible to use the same calibration value for both?

I'm also seeing current values that disagree by about 20% with my multimeter. I hacked the code and separated out the calibration values for current and VCC, and generated a new calibration value to match what my multimeter sees. This appears to track the current much more accurately now.

Am I missing something?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.