Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I2C connection in not working on Wemos D1 (Esp8266) + INA226 #29

Closed
ukrduino opened this issue Oct 12, 2018 · 5 comments
Closed

I2C connection in not working on Wemos D1 (Esp8266) + INA226 #29

ukrduino opened this issue Oct 12, 2018 · 5 comments
Assignees
Labels
question Further information is requested

Comments

@ukrduino
Copy link

ukrduino commented Oct 12, 2018

HI Arnd!
I have INA226 and Wemos D1 mini. They are propperly connected and working with example code

but when i try to use your example DisplayReadings i can make them connect.
I have looked though code of INA.cpp in place:

if (_DeviceCount==0)                                                        // Enumerate devices in first call  //
  {                                                                           //                                  //
    #ifndef ESP8266                                                           // I2C begin() on Esplora problems  //
      Wire.begin();                                                           // Start I2C communications         //
    #endif                                                                    //                                  //
    #ifdef __STM32F1__                                                        // Emulated EEPROM for STM32F1      //
      uint8_t maxDevices = EEPROM.maxcount() / sizeof(inaEE);                 // Compute number devices possible  //
    #else                                                                     // EEPROM Library V2.0 for Arduino  //
      uint8_t maxDevices = EEPROM.length() / sizeof(inaEE);                   // Compute number devices possible  //
    #endif                                                                    //                                  //
    #ifdef ESP32                                                              //                                  //
      EEPROM.begin(512);                                                      // If ESP32 then allocate 512 Bytes //
      maxDevices = 512 / sizeof(inaEE);                                       // and compute number of devices    //
    #endif                                                                    //                                  //
    for(uint8_t deviceAddress = 0x40;deviceAddress<0x80;deviceAddress++)      // Loop for each possible address   //
    {                                                                         //                                  //
      Wire.beginTransmission(deviceAddress);       ```



seems it does everything correct but still no connection ... 
Could you advice something, please. 
I2C scanner shows address of INA226 - 0x40
@ukrduino
Copy link
Author

https://github.com/jarzebski/Arduino-INA226/tree/master/INA226_simple - this example works as well.

@SV-Zanshin
Copy link
Collaborator

SV-Zanshin commented Oct 13, 2018 via email

@SV-Zanshin SV-Zanshin self-assigned this Oct 13, 2018
@SV-Zanshin SV-Zanshin added the question Further information is requested label Oct 13, 2018
@SV-Zanshin
Copy link
Collaborator

If that works I'll update the code for both ESP8266 and the ESP32 and update the documentation to make sure that the developer issues a call to "Wire.begin()" in their setup() function.

@ukrduino
Copy link
Author

ukrduino commented Oct 13, 2018 via email

@SV-Zanshin
Copy link
Collaborator

I've modified the wiki page https://github.com/SV-Zanshin/INA/wiki/begin() and changed the code so that the developer needs to issue the appropriate Wire.begin() call prior to calling the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants