ESkopal / USB-Power-Gauge

Code for the Adafruit USB Power Gauge mini kit
http://www.adafruit.com/products/1549
3 stars 1 forks source link

Replacing the Device Original Source Code #2

Open vahid-dan opened 8 years ago

vahid-dan commented 8 years ago

Hi;

I am using the Adafruit USB Power Gauge to measure the Raspberry Pi 3 power consumption and based on my observations, it is not accurate at all while working with the original code. Probably it has some serious calibration issues. I'd like to replace the original source code with yours, which you claim is more accurate. Could you please tell me what the best way to do so is? I'd be really thankful.

Cheers, Vahid

wbphelps commented 8 years ago

Vahid,

I suggest you do some research on the Adafruit web site. I'm sure if you look there you will find instructions on how to do this.

William

On Wed, Jul 13, 2016 at 10:55 AM, Vahid Daneshmand notifications-at-github.com |github/Allow William| < 7h5fdys47t@sneakemail.com> wrote:

Hi;

I am using the Adafruit USB Power Gauge to measure the Raspberry Pi 3 power consumption and based on my observations, it is not accurate at all while working with the original code. Probably it has some serious calibration issues. I'd like to replace the original source code with yours, which you claim is more accurate. Could you please tell me what the easiest way to do so is? I'd be really thankful.

Cheers, Vahid

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ESkopal/USB-Power-Gauge/issues/2, or mute the thread https://github.com/notifications/unsubscribe/AAow8lDa8TJd8uCTFrLz70MJoulZscOuks5qVSacgaJpZM4JLrl_ .

(sent from an alien in the Andromeda Galaxy - read at your own risk!)

vahid-dan commented 8 years ago

Hi William and thanks for your response.

You're right. The Adafruit website has suggested a way to do that: https://learn.adafruit.com/adafruit-usb-power-gauge-mini-kit/hack-it

The method needs another set of kit. I was wondering if there is an easier way to do that.

Thanks again. Vahid

asmagill commented 8 years ago

I don't know that I'd call it easier, but...

What you require is an ISP to program the gauge. I did so myself with an Arduino UNO I already had, using https://www.arduino.cc/en/Tutorial/ArduinoISP as the starting point. I've seen pages describing how to do so with a Raspberry Pi (https://learn.adafruit.com/program-an-avr-or-arduino-using-raspberry-pi-gpio-pins/overview is one also at the adafruit site, but a search will find many others as well), but I've never done so myself.

Which ever route you choose, be aware that sites like the one I've mentioned, assume you're working with another Arduino, so you'll need to take that into account when specifying the AVR target type ( forget what it is for the gauge, but I don't think it's atmega328p, so you'll need to check the site where you bought it or the documentation) and when determining where the wires go on the USB gauge board. They do share the same pin names, though, so it's just a matter of matching to the right name, rather then matching to pin numbers.

Hope this helps!

ESkopal commented 8 years ago

You need a programmer for the AtTiny chip. I use the adafruit programmer USBtinyISP AVR Programmer Kit (USB SpokePOV Dongle) - v2.0 https://www.adafruit.com/products/46

There is no programming port, but the required pins are available. You have to make up your own programming cable.

You linked to the appropriate steps. You can also do it with another Ardiuno as the previous commenter pointed out.

..Eugene..

vahid-dan commented 8 years ago

Thank you guys for your replies. This is probably the last question: Having the programmer device in hand, approximately how long should it take to replace the original code with yours?

Thanks again. Vahid

ESkopal commented 8 years ago

I haven't really written a "how-to" to get this working. It was more of an effort to share what I had discovered. I had honestly expected Adafruit to pick it up and incorporate it into their product as it made it so much more useful.

You have to read through the comments to see what I have done. You have to setup a Arduino environment that supports the AtTiny and edit or overwrite the Boards.txt file with my updated version to support more memory. This can take a lot of your time to figure out, but that is part of the fun, at least for me.

Actually writing the updated firmware takes a few seconds.

If there is suddenly enough interest, I can certainly add a step-by-step tutorial on how to do it.

..Eugene..

vahid-dan commented 8 years ago

Thank you guys for taking time to answer me. I really appreciate it.

We are using a couple of Adafruit USB Power Gauges in a set of experiments in an academic lab to measure the Raspberry Pi 3 power consumption. We didn't expect the device to be super accurate; But the outputs seem too inaccurate. For instance, It shows the voltage around 6v which must be around 5.15v for the Raspberry Pi 3 and also the current is around %25 above the actual current that we measure using a multimeter. I guess most of this inaccuracy is related to the firmware and calibration problems. We have spent too much time so far for these setups and now the findings won't be publishable. I took a look at your codes and it seems much better than the original. If you can say your firmware should get reasonable results out of the device, we definitely spent more time to update the firmware to yours and publish the findings in academia.

Thanks again for your time.

Vahid