Hi, I currently have my Arduino project up and running but my idiot engineer brain says what happens if the sensor is bad. What I want to do is run three then through code compare the outputs and throw out one if it is out of range.
Is it possible to run three of the same sensors on the SDA/SLC bus and assign them to different variables, or is this not feasible since they all will have the same hardware address when I send the command to request the vectors ?
This is the code i use to request the vectors, I would need each sensor on a different address to make this work?
Thanks for any help !
imu::Vector<3> euler = bno.getVector(Adafruit_BNO055::VECTOR_EULER);
Is it possible to run three of the same sensors on the SDA/SLC bus
Did you mean an I2C bus? (In which case it would be "SCL")
The BNO055 has an I2C address select input (COM3).
Connect those inputs to Arduino output pins, so that you can control which sensor is addressed at the standard address, at any one time. See the device datasheet for the details.
ok doing some reading of the data sheet it looks like i can set the Com 3 pin to High, Low or "x"
I2C COM3_state I2C address
configuration
Slave HIGH 0x29
Slave LOW 0x28
HID-I2C X 0x40
once i set them and change the I2C address how would i call the individual sensors for readings. In my current code i set the sensor up with
Adafruit_BNO055 bno = Adafruit_BNO055(); // Use object bno to hold information
then
if (!bno.begin()) // Attempt communication with sensor
{
//Serial.print("BNO055 NOT detected ... Check your wiring or I2C ADDR!");
lcd.print("BNO055 NOT DETECTED");
lcd.setCursor(0,1);
lcd.print("Check Bus Wiring");
}
bno.setExtCrystalUse(true); // Tell sensor to use external crystal
imu::Vector<3> euler = bno.getVector(Adafruit_BNO055::VECTOR_EULER);
int iYaw = (int) (euler.x() + 0.5); // convert float to integer and round correctly to whole number
int iRoll =(int) (euler.y() + 0.5); // convert float to integer and round correctly to whole number
int iPitch = (int) (euler.z() + 0.5); // convert float to integer and round correctly to whole number
What i do not see is any where that the address of the sensor is set?
Thanks again for any guidance that you guys and gals provide!
The address is probably defaulted in either the constructor or the "begin" method.
Take a look at the library documentation.
I am reading through the library, I think i would need to add something to this line to tell it which sensor to look at via the hardware address setting but i am not seeing anything in the libraries that points to this ? Thanks !
imu::Vector<3> euler = bno.getVector(Adafruit_BNO055::VECTOR_EULER);
You can address only one sensor at any one time.
This means that at most, you can have two BNO055s at different I2C addresses, or have only one BNO055 be "active". You select the "active" BNO055 by setting the COM3 pins appropriately.
There is no need to use a library other than the Wire library. All the basic functions to address the BNO055 can be put together out of simple calls to Wire functions.
I suggest to rethink the need for 3 sensors. It is easy to implement two sensors at different addresses, and if one goes "bad" the chances are it won't work at all. Easy to detect.
I think I found a solution I am going to play with a I2C Multiplexer so i can address each sensor independently. I will report back how well it works. Thanks Again
Switch IC Development Tools TCA9548A I2C Multiplexer