GithubHelp home page GithubHelp logo

arduino-ina226's People

Contributors

board707 avatar jarzebski avatar neutronstriker avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

arduino-ina226's Issues

Problem using 2 module INA226 in I2C protocol

Hi.. I have a problem to use 2 module INA226 with protocol I2C.
I write this sketch but it doesn't work. the Arduino IDE give me errors. Can you help me?

`/*
INA226 Bi-directional Current/Power Monitor. Simple Example.
Read more: http://www.jarzebski.pl/arduino/czujniki-i-sensory/cyfrowy-czujnik-pradu-mocy-ina226.html
GIT: https://github.com/jarzebski/Arduino-INA226
Web: http://www.jarzebski.pl
(c) 2014 by Korneliusz Jarzebski
*/

#include <Wire.h>
#include <INA226.h>

INA226 ina_5V;
INA226 ina_3.3V(0x45);

void checkConfig()
{

Serial.print("Max possible current 5V: ");
Serial.print(ina_5V.getMaxPossibleCurrent());
Serial.println(" A");

Serial.print("Max current 5V: ");
Serial.print(ina_5V.getMaxCurrent());
Serial.println(" A");

Serial.print("Max shunt voltage 5V: ");
Serial.print(ina_5V.getMaxShuntVoltage());
Serial.println(" V");

Serial.print("Max power 5V: ");
Serial.print(ina_5V.getMaxPower());
Serial.println(" W");

Serial.print("Max possible current 3.3V: ");
Serial.print(ina_3.3V.getMaxPossibleCurrent());
Serial.println(" A");

Serial.print("Max current 3.3V: ");
Serial.print(ina_3.3V.getMaxCurrent());
Serial.println(" A");

Serial.print("Max shunt voltage 3.3V: ");
Serial.print(ina_3.3V.getMaxShuntVoltage());
Serial.println(" V");

Serial.print("Max power 3.3V: ");
Serial.print(ina_3.3V.getMaxPower());
Serial.println(" W");

}

void setup()
{
Serial.begin(115200);

Serial.println("Initialize INA226");
Serial.println("-----------------------------------------------");

// Default INA226 address is 0x40
ina_5V.begin();
ina_3.3V.begin();

// Configure INA226
ina_5V.configure(INA226_AVERAGES_1, INA226_BUS_CONV_TIME_1100US, INA226_SHUNT_CONV_TIME_1100US, INA226_MODE_SHUNT_BUS_CONT);
ina_3.3V.configure(INA226_AVERAGES_1, INA226_BUS_CONV_TIME_1100US, INA226_SHUNT_CONV_TIME_1100US, INA226_MODE_SHUNT_BUS_CONT);

// Calibrate INA226. Rshunt = 0.1 ohm, Max excepted current = 4A
ina_5V.calibrate(0.1, 4);
ina_3.3V.calibrate(0.1, 4);

// Display configuration
checkConfig();

Serial.println("-----------------------------------------------");
}

void loop()
{
Serial.print("Bus voltage 5V: ");
Serial.print(ina_5V.readBusVoltage(), 2); // valore a 2 cifre decimali
Serial.println(" V");

Serial.print("Bus power 5V: ");
Serial.print(ina_5V.readBusPower(), 3); // valore a 3 cifre decimali
Serial.println(" W");

Serial.print("Shunt voltage 5V: ");
Serial.print(ina_5V.readShuntVoltage(), 5);
Serial.println(" V");

Serial.print("Shunt current 5V: ");
Serial.print(ina_5V.readShuntCurrent(), 4); // valore a 3 cifre decimali
Serial.println(" A");

Serial.print("Bus voltage 3.3V: ");
Serial.print(ina_3.3V.readBusVoltage(), 2); // valore a 2 cifre decimali
Serial.println(" V");

Serial.print("Bus power 3.3V: ");
Serial.print(ina_3.3V.readBusPower(), 3); // valore a 3 cifre decimali
Serial.println(" W");

Serial.print("Shunt voltage 3.3V: ");
Serial.print(ina_3.3V.readShuntVoltage(), 5);
Serial.println(" V");

Serial.print("Shunt current 3.3V: ");
Serial.print(ina_3.3V.readShuntCurrent(), 4); // valore a 3 cifre decimali
Serial.println(" A");

Serial.println("");
delay(1000);
}`

Issue with setShuntVoltageLimit function

I have proposed some changes to the function:

void INA226::setShuntVoltageLimit(float voltage){// MODIFIED by GCAR
uint16_t value = voltage/2.5e-6;
writeRegister16(INA226_REG_ALERTLIMIT, value);
}

Lisence

Could you change lisence to MIT. GPL requires that also my code has to be under GPL, what it never will be. I changed my NMEA2000 library to MIT so that it can be used freely.

INA226 with Bluefruit NRF52

INA226 example code seems to work on ProMini hardware but not on the Bluefruit NRF52.

I have confirmed my Bluefruit NRF52 i2c functionality using a TMP100 sensor.

Any ideas?

Andy

uA Accuracy

To get the maximum accuracy for Current and Power, the following equation should be used.
Current_LSB = (float)((Maximum Expected Current)/(2^15))

I used it to measure 4 to 20mA current with this and I was able to achieve the accuracy of +/-2 uA which when compared to the readings on Fluke 787B.

Disable limits

Hello,

Thanks for this nice library. I see functions to set the limit alerts but no function to turn off alerts. Is this on purpose? Otherwise I would create at least one function to disable all alerts or all the individual functions to disable alerts.

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.