Coder Social home page Coder Social logo

nathancheek / ina220 Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 3.0 165 KB

Lightweight Arduino library for the INA220/INA220-Q1/INA219

License: GNU General Public License v3.0

C++ 100.00%
arduino arduino-library ina220 ina220-q1 ina219 teensy texas-instruments

ina220's People

Contributors

nathancheek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ina220's Issues

Library crashes when using other I2C devices

This INA220 library is awesome and it is working perfectly. Or perfectly until I add another I2C device to the bus. The other device works but INA220 dies.

For example I have the INA220 (addres 0x40) and an ADS1115 AD board (address 0x48) connected to the same I2C line on my ESP32. When INA220 is alone it works perfectly with this library. But when both devices are initialized, INA220 dies. It gives the same strange values with each read request.

But if I skip INA library and read manually the INA registers with the Wire library, I get the correct reading while also ADS1115 is initialized.

I can have both devices physically connected to the I2C line at the same time. Problems start when I initialize the libraries for the devices (ads.begin(); and ina220.begin(...);). If I only initialize INA library (ina220.begin(...)) the device works properly.

What could cause this?

I found a bug

ina22o.h
I think enum ina_Adc_Mode the value should not be hexadecimal

{
INA_ADC_MODE_9BIT = 0x0,
INA_ADC_MODE_10BIT = 0x1,
INA_ADC_MODE_11BIT = 0x2,
INA_ADC_MODE_12BIT = 0x3,
INA_ADC_MODE_2AVG = 0x9,
INA_ADC_MODE_4AVG = 0x10,
INA_ADC_MODE_8AVG = 0x11,
INA_ADC_MODE_16AVG = 0x12,
INA_ADC_MODE_32AVG = 0x13,
INA_ADC_MODE_64AVG = 0x14,
INA_ADC_MODE_128AVG = 0x15
}; // of enumerated type

correct:

{
INA_ADC_MODE_9BIT = 0,
INA_ADC_MODE_10BIT = 1,
INA_ADC_MODE_11BIT = 2,
INA_ADC_MODE_12BIT = 3,
INA_ADC_MODE_2AVG = 9,
INA_ADC_MODE_4AVG = 10,
INA_ADC_MODE_8AVG = 11,
INA_ADC_MODE_16AVG = 12,
INA_ADC_MODE_32AVG = 13,
INA_ADC_MODE_64AVG = 14,
INA_ADC_MODE_128AVG = 15
}; // of enumerated type

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.