For an Arduino Uno, there is also a SoftwareWire library (in the Library Manager). After creating the object, it is compatible with the Wire library. So you can take the library from Adafruit, copy it in your project, replace the Wire with myWire (or a define WIRE) and it should work. The SoftwareWire is not yet a finished mature project.
The total cable length (every piece of wire added together) is maximum 50cm. Some can do 2 meters, other say they can do 8 meters (ignore that).
The I2C bus was not designed to be used with a cable at all. There are special chips that convert the I2C into a signal for twisted wire cable.
Step one: The distance. Do you really need 10 meters distance ? Do you want to use special chips ? or a slow RS-232 or a fast RS-485 ? Perhaps wireless ? What about two ESP8266 modules ?
Step two: How to connect all the sensors, that depends on step one.
The BME280 has a LOT of addresses. Read the datasheet. However, when I tested one, I could not get it to work on all of those addresses like the datasheet says.
10m is definitely too long for I2C unless you use bus-extender chips.
MorganS, I didn't know that, so I read the datasheet. I can read that it can be two I2C addresses, no more.
According to the datasheet : "The 6 MSB bits are fixed. The last bit is changeable by SDO value and can be changed during operation".
For an Arduino Uno, there is also a SoftwareWire library (in the Library Manager). After creating the object, it is compatible with the Wire library. So you can take the library from Adafruit, copy it in your project, replace the Wire with myWire (or a define WIRE) and it should work. The SoftwareWire is not yet a finished mature project.
sounds good! but you say for only Uno?
The total cable length (every piece of wire added together) is maximum 50cm. Some can do 2 meters, other say they can do 8 meters (ignore that).
The I2C bus was not designed to be used with a cable at all. There are special chips that convert the I2C into a signal for twisted wire cable.
well, damn.
that ruins the whole concept of my project! i may have to use DHT22's instead... (i am currently USING DHT22's but the accuracy advertised by the BME280 is much better and the DHTs need one GPIO each.)
Step one: The distance. Do you really need 10 meters distance ? Do you want to use special chips ? or a slow RS-232 or a fast RS-485 ? Perhaps wireless ? What about two ESP8266 modules ?
yeah, i COULD use four or five ESP8266's (i have this many already for other projectgs)
Step two: How to connect all the sensors, that depends on step one.
i guess wirelessly?
but since i am using www.blynk.cc to contol this, i have to inspect if Blynk can 100% accomodate that many ESP8266 nodes... (from what i understand, it should...)
MorganS:
The BME280 has a LOT of addresses. Read the datasheet. However, when I tested one, I could not get it to work on all of those addresses like the datasheet says.
In BME280_MOD-1022.h
Comment:
//#define addrBME280 0x76
and add:
extern int addrBME280;
In your sketch use
int addrBME280=0x76; // or 0x77;
you can change it during execution
I guess, that differences in the calibration parameters are not significant.
If not, you could make recalibration at each addressing to particular sensor.
Also you can powerup each couple of BME280(one 0x76, another 0x77) via separate ESP8266 pin. So, you'll have several branches which can be switched alternatively.
For an Arduino Uno, there is also a SoftwareWire library (in the Library Manager). After creating the object, it is compatible with the Wire library. So you can take the library from Adafruit, copy it in your project, replace the Wire with myWire (or a define WIRE) and it should work. The SoftwareWire is not yet a finished mature project.
The total cable length (every piece of wire added together) is maximum 50cm. Some can do 2 meters, other say they can do 8 meters (ignore that).
The I2C bus was not designed to be used with a cable at all. There are special chips that convert the I2C into a signal for twisted wire cable.
Step one: The distance. Do you really need 10 meters distance ? Do you want to use special chips ? or a slow RS-232 or a fast RS-485 ? Perhaps wireless ? What about two ESP8266 modules ?
Step two: How to connect all the sensors, that depends on step one.
long time no post, but i finally got around to needing two BME280's on one set of I2C pins and I have got it running with the Cactus library.
BUT i am running two BME280 on a 13 meter of CAT5e cable with on a Arduino Mega board.
year old post...
as with any digital signal, there is timing between pulses in the signal.
I have read of people going much further with slower timing.
if you needed say 35 meters, or even 75 meters, you would need to take some extraordinary steps.
but, once you get into those ranges, the cost of a simple wifi makes using wireless more attractive.
I was mostly posting for people who search BME280 and find this thread and might need to know that what koepel said about I2C cable length doesn't seem to be entirely accurate...
and as i have done , experiment for your scenario and see what works...
I have the same sensors you have and trying to wire them both in I2C;
I tested one with cactus library and it works, but I don't know how can I manage to have two of them wired on the same I2C pins (Arduino UNO).
Since my goal is to get two sets of different inputs from the sensors (temperature,humidity and pressure from two different rooms), how do I manage to create two BME280 library objects in the code, with two different addresses?