Multiple devices I2C bus?
Moderators: grovkillen, Stuntteam, TD-er
Multiple devices I2C bus?
As I understand it the I2C bus supports up to 121 devices connected to it. I would need 2 or maybe 3 is this supported by ESP Easy?
I'd like to use one INA219 sensor and BME280 and perhaps something more in the future.
,Olle
I'd like to use one INA219 sensor and BME280 and perhaps something more in the future.
,Olle
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Multiple devices I2C bus?
Should be little to no problem.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: Multiple devices I2C bus?
As long as the devices have different adresses and the overall capacitance is not to high, shouldnt be a problem. I can confirm 4 Devices working on I2C
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
Re: Multiple devices I2C bus?
awesome, thanks!
Re: Multiple devices I2C bus?
In the ESPEasy Wiki you will find a detailes explanation how I²C works and how to connect components.
Take a look:
https://www.letscontrolit.com/wiki/inde ... he_I²C_Bus
Take a look:
https://www.letscontrolit.com/wiki/inde ... he_I²C_Bus
Regards
Shardan
Shardan
Re: Multiple devices I2C bus?
On my testboard, I have been using 3x INA219 and one BME280 and OLED display.
Setting the address on most I2C modules will require some soldering.
Setting the address on most I2C modules will require some soldering.
Re: Multiple devices I2C bus?
hm...how did you get 3 INA devices working? I have dev12 MEGA and I seem to run into the same bug as this thread reports:
viewtopic.php?f=5&t=3479#p18796
The last configured i2c adress is used to both devices. And yes, I have soldered (bridged) A0 to get 0x41 on one of them.
Edit: Latest version (180524) solved the issue. Now I have another one My domoticz installation is now using 5 digit IDX values and EspEasy only allows for 4 digit values. I can't find any way to override this in domoticz, can this be solved from EspEasy instead?
viewtopic.php?f=5&t=3479#p18796
The last configured i2c adress is used to both devices. And yes, I have soldered (bridged) A0 to get 0x41 on one of them.
Edit: Latest version (180524) solved the issue. Now I have another one My domoticz installation is now using 5 digit IDX values and EspEasy only allows for 4 digit values. I can't find any way to override this in domoticz, can this be solved from EspEasy instead?
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Multiple devices I2C bus?
You can do it with rules, see this link: https://www.letscontrolit.com/wiki/inde ... th_own_IDX
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: Multiple devices I2C bus?
Hmm 5-digit idx values.
It is stored as an unsigned int and it doesn't look like a very limited variable in Domoticz.
Even if it is a 16-bit value, 5 digits shouldn't be a problem.
It's a simple change here in these lines:
https://github.com/letscontrolit/ESPEas ... 2171-L2174
Could you add an issue on Github about it?
Maybe someone else may have an suggestion on why it's a good idea, or more importantly, why not
It is stored as an unsigned int and it doesn't look like a very limited variable in Domoticz.
Even if it is a 16-bit value, 5 digits shouldn't be a problem.
It's a simple change here in these lines:
https://github.com/letscontrolit/ESPEas ... 2171-L2174
Could you add an issue on Github about it?
Maybe someone else may have an suggestion on why it's a good idea, or more importantly, why not
Re: Multiple devices I2C bus?
Works like a charm, there's always a solution around somewhere but as TD-er mentioned, perhaps ESPEasy should allow 5 digit IDX. I have a lot since I'm picking up huge amounts of my neighbors sensors with my RFXCOM device.grovkillen wrote: ↑05 Jun 2018, 23:28 You can do it with rules, see this link: https://www.letscontrolit.com/wiki/inde ... th_own_IDX
I may be in the wrong thread for this quesion but I'll give it a go since it's connected to the INA219 device.
I'm going to monitor power consumption on my boat and use the ina219 with an external shunt (50A 75mV). In the beginning I will send the data to my server at home via shared internet connection on a dedicated phone and a VPN. But to get a good grasp on power consumption I need to sample the current at least every 5 seconds. Is it possible to store several measurements with the rules function and send the accumulated data each 10 minutes or so to domoticz? The goal is to keep the traffic down.
Re: Multiple devices I2C bus?
@Olleman:
Nope it is not yet possible to do so.
I hope to add some support for such a feature. It could even be stored in SPIFF, since adding data is not really a problem, as long as you don't have to erase sectors (or have PUYA chips)
Nope it is not yet possible to do so.
I hope to add some support for such a feature. It could even be stored in SPIFF, since adding data is not really a problem, as long as you don't have to erase sectors (or have PUYA chips)
Re: Multiple devices I2C bus?
It would be a really cool feature! Are you responsible for the INA219 plugin? I'm starting to realize that a RPI Zero would be quite a good choice to have on the boat as well. All this data traffic seems a bit unnecessary and I plan on adding some more sensors as well.
Well, for now I have one wemos mini and two INA219s sending me voltages from my two batteries every minute via a mobile hotspot in the boat. Overkill but fun
Re: Multiple devices I2C bus?
Depends on the definition used
I did not write the initial plugin, I just made it possible to have more than one active at the same time.
Also, I am currently the most active developer on ESPeasy.
Re: Multiple devices I2C bus?
Hi Olleman
re the quote below
Well, for now I have one wemos mini and two INA219s sending me voltages from my two batteries every minute via a mobile hotspot in the boat. Overkill but fun
Im learning as a esp newbie, could you post how you run two INA219 on the one WeMos board and / or post the circuit / software as that is what I would like to do as well.
eg in espeasy you can set the SLA/SLD lines to the GPIO's in Hardware but only once ?
I'm also having some trouble getting any reliable voltage / current readings off my ebay IAN219 and suspect they are defective or my setting/ formula (im using %voltage%*300/1024 in espeasy are wrong (eg I get 9.6 volt regardless of what the voltage is of the battery I attach). Any easy test to use ?
I've managed to get my wifi to around 400m using a yagi ant out to my boat and can see/control the Wemos mini devices.
thanks in advance
re the quote below
Well, for now I have one wemos mini and two INA219s sending me voltages from my two batteries every minute via a mobile hotspot in the boat. Overkill but fun
Im learning as a esp newbie, could you post how you run two INA219 on the one WeMos board and / or post the circuit / software as that is what I would like to do as well.
eg in espeasy you can set the SLA/SLD lines to the GPIO's in Hardware but only once ?
I'm also having some trouble getting any reliable voltage / current readings off my ebay IAN219 and suspect they are defective or my setting/ formula (im using %voltage%*300/1024 in espeasy are wrong (eg I get 9.6 volt regardless of what the voltage is of the battery I attach). Any easy test to use ?
I've managed to get my wifi to around 400m using a yagi ant out to my boat and can see/control the Wemos mini devices.
thanks in advance
Re: Multiple devices I2C bus?
I2C sensors can all be used on the same SDA/SCL pins, as long as all have their own unique address on the I2C bus.
Most sensor boards have some pads available to set the address. You have to look into the datasheet of the sensor to see what addresses can be used and how to select them.
If you set the new address (other than default) it is advised to only connect that sensor and perform an I2C scan to see if it did accept the new set address and also what the address is.
Some things to keep in mind:
When using multiple I2C sensors on a bus, you may need pull-up resistors for the SDA and SCL lines. Something around 4k7 or 10k.
These must then be placed between the SDA and 3v3 line (the same for SCL and 3v3)
Use them if you experience issues with stable reading of the I2C sensors.
Do not use long cables for I2C. Try to keep them below 20 cm.
Not all plugins support multiple instances of the same plugin to be run on the same ESP node.
INA219 should be fine.
All sensors do consume power. Not all ESP boards have a proper voltage regulator on board.
When in doubt, use your own 3.3 Volt regulator and/or add capacitors.
Most sensor boards have some pads available to set the address. You have to look into the datasheet of the sensor to see what addresses can be used and how to select them.
If you set the new address (other than default) it is advised to only connect that sensor and perform an I2C scan to see if it did accept the new set address and also what the address is.
Some things to keep in mind:
When using multiple I2C sensors on a bus, you may need pull-up resistors for the SDA and SCL lines. Something around 4k7 or 10k.
These must then be placed between the SDA and 3v3 line (the same for SCL and 3v3)
Use them if you experience issues with stable reading of the I2C sensors.
Do not use long cables for I2C. Try to keep them below 20 cm.
Not all plugins support multiple instances of the same plugin to be run on the same ESP node.
INA219 should be fine.
All sensors do consume power. Not all ESP boards have a proper voltage regulator on board.
When in doubt, use your own 3.3 Volt regulator and/or add capacitors.
Re: Multiple devices I2C bus?
Thanks TD-er
I was wondering what the pads on the IDA219 were and read about bridging the pads to set the address. Thanks for suggesting the pull down resistors.
I also worked out that R120 I was using is a old ESPeasy version and the main page does not really mention the new mega versions (I've downloaded it mega-20190903) and will play around as it has a whole heaps of new useful function (once you sort of what all the filenames mean / do and even a 4mb blank file to erase the whole wemos when I "forgot" what I used as the admin password to start again)
Any hints on why the voltage is not reading (could all three INA219 boards be duds ?) - Do I need a voltage formula at all or is that optional ? when I leave the formula blank I get a reading of 32.72 volts (on a 9 volt battery) and the reading does not update if i pull the battery off (even at 2 second intervals)
Adding a formula eg %value%*300/1024 makes no difference eh still 32.72 volts
Would you have a page pic of a working INA219 voltage settings to copy
Ive attached mine below
I was wondering what the pads on the IDA219 were and read about bridging the pads to set the address. Thanks for suggesting the pull down resistors.
I also worked out that R120 I was using is a old ESPeasy version and the main page does not really mention the new mega versions (I've downloaded it mega-20190903) and will play around as it has a whole heaps of new useful function (once you sort of what all the filenames mean / do and even a 4mb blank file to erase the whole wemos when I "forgot" what I used as the admin password to start again)
Any hints on why the voltage is not reading (could all three INA219 boards be duds ?) - Do I need a voltage formula at all or is that optional ? when I leave the formula blank I get a reading of 32.72 volts (on a 9 volt battery) and the reading does not update if i pull the battery off (even at 2 second intervals)
Adding a formula eg %value%*300/1024 makes no difference eh still 32.72 volts
Would you have a page pic of a working INA219 voltage settings to copy
Ive attached mine below
Re: Multiple devices I2C bus?
No they should be pull-UP
32.7 Volt sounds like an overflow value. (32768)
So make sure you have the proper resistors in place to lower the range.
For this you should refer to the datasheet of the chip.
Re: Multiple devices I2C bus?
Thanks
Could you explain the overflow value a bit more ?
All the circuits I have seen do not have any resistors (at least for the V+ input) and I'm only measuring 9 or 12 volts where as the INA219 says it does up to 26 (or 32 volts depending of which specs you read) eg http://www.ti.com/lit/an/sboa194/sboa194.pdf and also https://www.letscontrolit.com/wiki/index.php/INA219
Also, I understood the voltage formula was supposed to allow you to adjust the voltage measurements (when I used R120 it did change them but not update) ?
Any suggested resistor values I should use (I saws 0.1 ohms on YouTube video) ? )
Any suggestions as to why the number does not update if I disconnect or put say 12 volts on the V+ ?
Thanks for the guidance
regards
Could you explain the overflow value a bit more ?
All the circuits I have seen do not have any resistors (at least for the V+ input) and I'm only measuring 9 or 12 volts where as the INA219 says it does up to 26 (or 32 volts depending of which specs you read) eg http://www.ti.com/lit/an/sboa194/sboa194.pdf and also https://www.letscontrolit.com/wiki/index.php/INA219
Also, I understood the voltage formula was supposed to allow you to adjust the voltage measurements (when I used R120 it did change them but not update) ?
Any suggested resistor values I should use (I saws 0.1 ohms on YouTube video) ? )
Any suggestions as to why the number does not update if I disconnect or put say 12 volts on the V+ ?
Thanks for the guidance
regards
Re: Multiple devices I2C bus?
Well the value of 32.7 just triggered the association with 32767 with me, which is a typical max.value for a signed 16-bit value.
A quick glance at the datasheet does show the max. value is either 4000 (x 4 mV) or 8000 (x 4mV)
So then any value over 32.0 should not occur.
Maybe it is a fault state?
Perhaps + and - swapped of the battery and set to 32V range (not allowing negative values).
The plugin only updates per set interval (default 60 sec) and most (not all) plugins only update a value if it is a valid value.
Resistor values of less than 1 Ohm are typically used as a shunt, to measure currents. (measure the voltage over that resistor)
It does not seem to be needed to add resistors for measuring voltage.
A quick glance at the datasheet does show the max. value is either 4000 (x 4 mV) or 8000 (x 4mV)
So then any value over 32.0 should not occur.
Maybe it is a fault state?
Perhaps + and - swapped of the battery and set to 32V range (not allowing negative values).
The plugin only updates per set interval (default 60 sec) and most (not all) plugins only update a value if it is a valid value.
Resistor values of less than 1 Ohm are typically used as a shunt, to measure currents. (measure the voltage over that resistor)
It does not seem to be needed to add resistors for measuring voltage.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 1 guest