Because I would like to combine a bigger number of sensors I am thinking of one master-controller collecting data from different slaves (each reading its BMP-280 via SoftI2C).
A BMP-280 module with voltage regulator and level shifters for SDA and SCL can be used with a 5V Arduino board. Then you can use it either with the hardware I2C bus or with a software I2C library.
Since I would like to use buttons to reset measurements locally, or to turn on and off the backlight of displays, I would prefer the idea with different i2c-networks and use extenders like "PCA9515"! The master of the "global"-i2c-network mainly would collect data from the different sub-networks and insert it into a sql-database.
Does the Adafruit library work in a normal way with the Arduino Wire library ? You should test that before trying the software I2C.
Do you use a 5V Arduino board --- have not already blown the sensors.
If you do not include the Arduino "Wire.h", the hardware "Wire" object is not created.When you use the SoftWire class and create a object called "Wire" with it, then most of the code can be used without changing it. That is a valid way to use a software I2C. I see no problem, I think you did it right.
Do you have a logic analyzer ?
Please give a link to where you got the SoftWire files from. Again, we want you to proof to us that you use valid files, and not some old version you found somewhere on the internet.
As a rule of thumb, the I2C bus can be up to 0.5 meters.
Since I use a level shifter from 5V to 3,3V like for SD-card-readers the connection should be fine.
I deleted the "Wire.h" and inserted the "SoftWire.h" to the script instead. However I used the same name "wire" for the object created in "Adafruit_BMP280.cpp", because I was afraid to miss any modification in the code. And I kept the Pins A4 and A5 even when using SoftWire, so no change in wiring should be required.In addition I changed the "#include" from braces like <> to "xyz" to use files in the working-directory.
It is two different worlds. Can you show a photo of your I2C level shifter ?
Did you see the list ? https://github.com/Testato/SoftwareWire/wiki/Arduino-I2C-libraries.As far as I know, everyone of them should work.
When the I2C Scanner can not detect a I2C sensor, then the I2C bus is not working. In that case take another step back, and use the normal I2C Scanner with the normal hardware Arduino Wire library: https://playground.arduino.cc/Main/I2cScanner. Wiggle some wires, let it run for a while. It should be working 100%.When both I2C scanners from the software I2C libraries work perfect, and the BMP280 does still not work... then you might have run into a very nasty bug and the software I2C is somehow incompatible with the BMP280 and the Adafruit library. In that case, try another BMP280 library.
#include <Wire.h>#include <CommonSensorClass.h>CommonSensorClass <TwoWire> sensor( Wire);
To be honest you are true - It would be nice to increase the distance to several meters (5-6m) if possible. If this does not work I will have to move the Hub or transfer the data via WLAN instead of LAN.
// Ignore 'quantity', since SoftI2CMaster::requestFrom() just sets the start of read adresses, // so it's the same for any number of bytes.