Giter Club home page Giter Club logo

adafruit_ina260's Introduction

Adafruit_INA260 Build StatusDocumentation

This is the Adafruit INA260 Current and Power sensor library

Tested and works great with the Adafruit INA260 Breakout Board

This chip uses I2C to communicate, 2 pins are required to interface

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

Written by Bryan Siepert for Adafruit Industries. BSD license, check license.txt for more information All text above must be included in any redistribution

To install, use the Arduino Library Manager and search for "Adafruit INA260" and install the library.

adafruit_ina260's People

Contributors

billpugh avatar evaherrada avatar hathach avatar jgromes avatar ladyada avatar richard-gemmell avatar siddacious avatar tyeth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit_ina260's Issues

Library Dependency Fatal error (PlatformIO 1.41.1)

Having used the library manager in PLatformIO V1.41.1 to download the Adafruit INA260 Library (V 1.3.2), on compiling a fatal error is generated concerning a library dependency of Adafruit_I2CDevice.h. This is including the provided examples, outside of my own project.

*** [.pio\build\nodemcu-32s\src\main.cpp.o] Error 1
In file included from C:\Users\Dave.platformio\lib\Adafruit INA260 Library_ID6239\Adafruit_INA260.cpp:37:0:
C:\Users\Dave.platformio\lib\Adafruit INA260 Library_ID6239\Adafruit_INA260.h:22:32: fatal error: Adafruit_I2CDevice.h: No such file or directory

Already having I2C devices operating in my project (ESP32s, framework Arduino), and not being able to find the specified library, is there a way around this issue?

How exactly would i measure voltage?

When ever i want to measure voltage it only give me 0.00125 volt or less. looks like noise tbh.

i tested a battery i had lying around that was 3.4V. i tested that with a multimeter.

When i attached the ends to the V+ and V- terminals and did the test with the ina260 it showed the very low voltage.
when i tested it with my multimeter it also showed a very little voltage.

now i checked the code of the ina and to my surprise it always measures current and voltage at the same time! which is so weird because a current measure will just short circuit the battery. this would explain the low voltage.

but how do i set the ina260 into a mode so that it only measures voltage?

Alarmlimit for power

I've see that reading of alarm limit level, of cause set too, will be multipled (divided in setAlarmLimit) with 1.25. But LSB of power isn't 1.25mW, it is 10 mW.

Memory Leak Issue

i2c_dev = new Adafruit_I2CDevice(i2c_address);
if (!i2c_dev->begin()) {
return false;
}
Adafruit_I2CRegister *die_register = new Adafruit_I2CRegister(i2c_dev, INA260_REG_DIE_UID, 2, MSBFIRST);
Adafruit_I2CRegister *mfg_register = new Adafruit_I2CRegister(i2c_dev, INA260_REG_MFG_UID, 2, MSBFIRST);
Adafruit_I2CRegisterBits *device_id = new Adafruit_I2CRegisterBits(die_register, 12, 4);
// make sure we're talking to the right chip
if ((mfg_register->read() != 0x5449) || (device_id->read() != 0x227)) {
return false;
}
Config = new Adafruit_I2CRegister(i2c_dev, INA260_REG_CONFIG, 2, MSBFIRST);
MaskEnable = new Adafruit_I2CRegister(i2c_dev, INA260_REG_MASK_ENABLE, 2, MSBFIRST);
AlertLimit = new Adafruit_I2CRegister(i2c_dev, INA260_REG_ALERT_LIMIT, 2, MSBFIRST);
reset();
delay(2); // delay 2ms to give time for first measurement to finish
return true;

There are a couple pointers that are dynamically allocated in the begin function that do not seem to ever be explicitly freed.

Although this may not be a problem for most projects because the object will probably stay around for the lifetime of the entire code execution, creating and destroying multiple Adafruit_INA260 objects could cause a memory leak.

Adding a simple destructor that frees these pointers if they have been allocated would address this issue.

Thanks,
Carl

Code Error in Adafruit_INA260.h ?

Line 30 and 31 in Adafruit_INA260.h is:
#define INA260_REG_MASK_ENABLE \
0x06 ///< Interrupt/Alert setting and checking register

Don't know if this will cause any issues with compilation or code functioning.

Should be?
#define INA260_REG_MASK_ENABLE 0x06 ///< Interrupt/Alert setting and checking register

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.