You Reply: Hi,
I too have had an issue trying to use SEN0390 with another I2C device, SEN0385 (SHT31 temp + humidity). Here is what I found and noted for future reference.
---------------------------
I ran the i2c_scanner (with both sensors connected to my M4’s SDA/SCL) and confirmed the SHT31 is by default on 0x44 and the Ambient Light is 0x4A. So that’s all cool.
I have got my project working though and it was two issues that needed to be addressed, and they are somewhat related.
1. Typos in the DFRobot Library
I too had another look at the DFRobot library for the Ambient Light Sensor (GitHub - DFRobot/DFRobot_B_LUX_V30B) and noticed a couple of errors in their code.In that library in DFRobot_B_LUX_V30B.cpp they seem to very manually toggle or bit bang the I2C protocol onto the pins. Seems odd but anyway, in two of the functions they incorrectly reference the pins, they use “SDA” instead of “_SDA”, so they are messing with pins referenced outside their library. So to fix that you need to change any instance of “SDA” in their library to “_SDA”.This alone did not fix the issue, see item 2 below.
2. Keep the Ambient Light Sensor on dedicated SDA/SCL pins
The DFRobot library has the ability to let the user specify which pins are used for SDA and SCL (as it seems intent on bit banging the I2C Proto).For example you can tell it to use pin 6 for SCL and pin 5 for SDA with the following (ignore the 13 for now)DFRobot_B_LUX_V30B myLux(13,6,5);If you do that, and wire it there appropriately, then everything works. I can read from the SHT31 and the Ambient light sensor in the same sketch. I’m sure just a better library for the Ambient Light Sensor would allow it to coexist on the main I2C but that’s beyond my skill level.
Thanks,Paul
Note: I have the Ambient Light Sensors SDA and SCL connected to pins 5 & 6 respectively on my Feather M4 now, and have the SHT31 still using the built in SDA/SCL pins.