4 x INA219s on the same NodeMCU - Devices all see same data

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
robatbentley
Normal user
Posts: 69
Joined: 18 Mar 2017, 22:13
Location: Newcastle/UK

4 x INA219s on the same NodeMCU - Devices all see same data

#1 Post by robatbentley » 24 May 2017, 21:25

I have configured one of my NodeMCUs with 4 INA219s so that I can measure the current on my DIY 18650 battery charger. I've configured the INA boards so that they all have different I2C address (0x40, 0x41, 0x44 and 0x45) as confirmed by the I2C Scan but I can't figure out how to assign the individual I2C addresses to specific boards. Any advice on this? ...or is this setup not allowed? I would have expected some way of selecting the I2C address for each of the devices so that it could then be associated with the Domoticz IDX number to steer the right data to the right display.

The I2C Scan display the following...
0x40 SI7021 Temp/Hum Sensor, INA219, PCA9685
0x41
0x44
0x45
...but not sure what this is telling me as it appears to saying that the devices could be one of the 3 types. I'm sure I've just missed something but some guidance would be appreciated.
RobUpNorth

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: 4 x INA219s on the same NodeMCU - Devices all see same data

#2 Post by Shardan » 24 May 2017, 21:48

It is correct, this adress is used by several sensors so ESPEasy I2C-scan shows
all of them as the firmware can't decide which one you've connected.

But indeed I don't see a choice for selecting wich one is used in the task

As far as I can see there is no option in the R12x - R14x version source code.
With the new ESPEasy 2.0.0devX there are options but they are still commented out,
for what reason ever.

I'm no programmer at all so i can't say why.
This is a question for the demvelopers i think.

Regards
Shardan.
Regards
Shardan

robatbentley
Normal user
Posts: 69
Joined: 18 Mar 2017, 22:13
Location: Newcastle/UK

Re: 4 x INA219s on the same NodeMCU - Devices all see same data

#3 Post by robatbentley » 24 May 2017, 22:22

Thanks for getting back to me. It's a real shame I can't get this configured with 4 INA219s as it'd be the perfect way of monitoring how each battery is charging. Back to the drawing board to see if there's a different way of doing this.
RobUpNorth

krikk
Normal user
Posts: 118
Joined: 28 Feb 2017, 07:57
Location: Austria
Contact:

Re: 4 x INA219s on the same NodeMCU - Devices all see same data

#4 Post by krikk » 24 May 2017, 22:30

in the ESPEasy 2.0.0devX version you are able to select the adress of the sensor!! so everything you want is possible...

@shardan: nothing commented out there :)

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: 4 x INA219s on the same NodeMCU - Devices all see same data

#5 Post by Shardan » 24 May 2017, 23:39

as said, i'm no programmer...
i interpreted this:

Code: Select all

      
        /*                                      <----
        String options2[4];
        options2[0] = F("0x40 - (default)");
        options2[1] = F("0x41");
        options2[2] = F("0x44");
        options2[3] = F("0x45");
        */                                      <----
        int optionValues2[4];
        optionValues2[0] = INA219_ADDRESS;
        optionValues2[1] = INA219_ADDRESS2;
        optionValues2[2] = INA219_ADDRESS3;
        optionValues2[3] = INA219_ADDRESS4;
        addFormSelectorI2C(string, F("plugin_027_i2c"), 4, optionValues2, choice2);
as being commented out.
Regards
Shardan

robatbentley
Normal user
Posts: 69
Joined: 18 Mar 2017, 22:13
Location: Newcastle/UK

Re: 4 x INA219s on the same NodeMCU - Devices all see same data

#6 Post by robatbentley » 25 May 2017, 09:20

Thanks to both of you. I'll give the ESPEasy 2.0.0devX a go later this morning and I'll let you know how I get on. :)

Okay, I updated to ESPEasy 2.0.0devX (ESPEasy_v2.0.0-dev8.zip), re-configured various settings (can't see a way of attaching the config.dat file) but now not seeing any current or voltage measurements when I try battery recharging. All the readings for the four INA219s are the same. i.e. 32.76V with -0.00Amps (see screen shot). I've confirmed that my wiring is correct and that I'm using the correct SDA and SCL pins. Any suggestions as to what else I should try?

I've attached a few screen shots in case they're of any use.
Attachments
Log20170525.jpg
Log20170525.jpg (46.55 KiB) Viewed 9464 times
I2CScan20170525.jpg
I2CScan20170525.jpg (33.61 KiB) Viewed 9464 times
hardware20170525.jpg
hardware20170525.jpg (80.55 KiB) Viewed 9464 times
Devices5-8.jpg
Devices5-8.jpg (83.82 KiB) Viewed 9464 times
Devices1-4.jpg
Devices1-4.jpg (83.52 KiB) Viewed 9464 times
Last edited by robatbentley on 25 May 2017, 15:27, edited 2 times in total.
RobUpNorth

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: 4 x INA219s on the same NodeMCU - Devices all see same data

#7 Post by Shardan » 25 May 2017, 13:35

I've checked meanwhile with a 2.0.0-Dev, it works.

Regards
Shardan
Regards
Shardan

robatbentley
Normal user
Posts: 69
Joined: 18 Mar 2017, 22:13
Location: Newcastle/UK

Re: 4 x INA219s on the same NodeMCU - Devices all see same data

#8 Post by robatbentley » 25 May 2017, 16:35

I used the ESPEasy_v2.0.0-dev8_normal_4096.bin version. Which one did you use? Other options seem to be...ESPEasy_v2.0.0-dev8_dev_4096.bin or ESPEasy_v2.0.0-dev8_test_4096.bin?
RobUpNorth

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: 4 x INA219s on the same NodeMCU - Devices all see same data

#9 Post by Shardan » 25 May 2017, 17:33

I've used a 4096-normal self compiled from the github sources.

Regards
Shardan
Regards
Shardan

robatbentley
Normal user
Posts: 69
Joined: 18 Mar 2017, 22:13
Location: Newcastle/UK

Re: 4 x INA219s on the same NodeMCU - Devices all see same data

#10 Post by robatbentley » 25 May 2017, 19:54

Been playing around with this setup and found that I can get it to partially work.

I reflashed the ESPEasy_v2.0.0-dev8_normal_4096 build using the Tools/Flash option. ...and then deactivated all four of my INA219s and then cumulatively activated them one at a time. The first three, when activated, worked properly. i.e. Gave sensible and different values for the charging voltage and current, but as soon as added the 4th INA219 device all 4 devices reverted back to the original 32.76V at -0.00Amps. I then deactivated the 4th INA again, rebooted the NodeMCU and the 1-3 INAs started working again. Looks like there's a problem with adding the 4th device. Any advice or guidance on this?

Have to say that despite setting all the readings to 3 decimal places, it looks like most of the values are within 0.001V or amps of each other. This makes my highly suspicious as I don't believe the batteries or seperate PSU links would provide that much consistency.
...and just to complete the picture, none of the Domoticz meters work configured with the appropriate IDX numbers.

Well, it's a step in the right direction... :(

Update: I replaced the 0x45 INA unit with a new one - same problem! I also tried swapping the leads from one of the other 3 units (i.e. 0x40, 0x41 and 0x44) - same problem! It appears to be the 0x45 resouce that's causing the problem. I'd welcome comment on this.
Last edited by robatbentley on 26 May 2017, 13:45, edited 5 times in total.
RobUpNorth


Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: 4 x INA219s on the same NodeMCU - Devices all see same data

#12 Post by Shardan » 25 May 2017, 20:33

Indeed there is a tutorial in the wiki... exactly two tutorials.

For a newcomer i'd suggest to use the Arduino IDE for compiling, see
https://letscontrolit.com/wiki/index.ph ... are_Upload
Platformio is better for developers in several ways but i think it's not that easy to handle.

For downloading the 1.6.12 version which is tested with ESPEasy go to
https://www.arduino.cc/en/Main/OldSoftw ... s#previous
and download the "Windows" file, not the "Windows Installer"!

With this package follow the steps in the tutorial, no witchcraft needed ;)

For flashing i'd recommend to use the ESP-Flasher delivered with the source files from github (Folder "dist") instead of the Arduino IDE.
Inside Arduino do not chose "upload" but "Export binary file" to compile. This creates a binary inside the folder containing the source files.
You may feed this file to the ESPFlasher.

Regards
Shardan
Regards
Shardan

ckapucu
New user
Posts: 1
Joined: 21 Sep 2017, 09:09

Re: 4 x INA219s on the same NodeMCU - Devices all see same data

#13 Post by ckapucu » 22 Sep 2017, 09:08

Same problem for me too. I let the ina219 with address 0x45 begin first, then others began. First the problem has gone and i read busvoltage and the others more than ten thousands. But next day the problem occured again and i saw the value 32.76 again. When i pull out the one of the four ina219, (0x40, 0x41, 0x44 or 0x45 doesn't matter) the others work perfect. Any clue on this?

Drum
Normal user
Posts: 300
Joined: 07 Feb 2016, 11:56

Re: 4 x INA219s on the same NodeMCU - Devices all see same data

#14 Post by Drum » 24 Sep 2017, 06:16

Do you have a pull-up resistor on the i2c data pins? The esp does not provide unlimited power (ma) to those pins, you may be exceeding that power. You might also look to see if anyone has tried to test how many i2c devices it can reliably handle.

Easiest fix, use 2, with 2 INA219 each.

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests