TroubleshootingArduino

SEN0390 ambient light lux sensor with multiple I2C

userHead Duncan.Wilson 2023-06-19 01:56:53 2197 Views7 Replies

When using a single SEN0390 with a MKR1010 board I get good readings from the sensor. When I also connect an HDC1080 sensor via I2C I am getting a lux value of -1 and the default non reading on the HDC1080. If I use the HDC1080 by itself it works fine.
 

When I do an I2C scan using https://playground.arduino.cc/Main/I2cScanner/ the address for the SEN0390 seems to be 0x4A (I thought it would be 0x94 based on library on GitHub (line 35 of DFROBOT_B_LUX_V30B.h) at https://github.com/DFRobot/DFRobot_B_LUX_V30B

 

Not sure what else to try - any suggestions?

 

Code I am trying on MKR1010 is below:

 

#include <DFRobot_B_LUX_V30B.h>

#include <Wire.h> // used for HDC1080 temp / hum sensor

#include "Adafruit_HDC1000.h"

DFRobot_B_LUX_V30B myLux(13);

Adafruit_HDC1000 hdc = Adafruit_HDC1000();

 

void setup() {

 Serial.begin(115200); 

 myLux.begin();

 if (!hdc.begin()) {

  Serial.println("Couldn't find sensor!");

  while (1);

 }

}

 

void loop() {

 Serial.print("Light: ");

 Serial.print(myLux.lightStrengthLux());

 Serial.print(" - Temperature: ");

 Serial.print(hdc.readTemperature());

 Serial.print(" - Humidity: ");

 Serial.println(hdc.readHumidity());

 delay(1000);

}


 

2026-04-29 17:19:12

Hello,


 

I am currently working with an Arduino MKR WAN 1310 (SAMD21, 3.3V) and I am trying to use the DFRobot SEN0390 ambient light sensor in its I2C version (B-LUX V3.0).


 

I followed the official DFRobot library (DFRobot_B_LUX_V30B) and tested multiple configurations. However, I am facing serious communication issues:

- The sensor does not respond correctly on the standard I2C pins (SDA/SCL).

- I found several forum posts indicating that the library uses a software (bit-banged) I2C implementation and requires dedicated SDA/SCL pins on Arduino UNO.

- Unfortunately, this workaround does not seem compatible with the MKR WAN 1310 architecture.


 

My questions are:

1) Is the SEN0390 I2C officially compatible with the Arduino MKR WAN 1310?

2) If yes, what is the recommended wiring and configuration on SAMD21-based boards?

3) If not, is there an alternative light sensor (I2C, 3.3V) that you recommend for MKR boards?


 

I am quite stuck at this point and would really appreciate any guidance.


 

Thank you very much for your help.

userHeadPic zc09
2023-06-19 19:44:39

SEN0390 is sealed by software IIC, and can not be used with other equipment or sensors using hardware IIC. Its address is 0x94.

userHeadPic jenna
jenna wrote:

I checked the library and this function can define the sensor pins.

For example:

 

sensor ——> board

VCC——>VCC

GND——>GND

SCL——> 7(digital pin)

SDA——> 8(digital pin)

EN——> 13(digital pin)

 

 

#include <DFRobot_B_LUX_V30B.h>

#include <Wire.h> // used for HDC1080 temp / hum sensor

#include "Adafruit_HDC1000.h"

DFRobot_B_LUX_V30B myLux(13,7,8);

Adafruit_HDC1000 hdc = Adafruit_HDC1000();

 

void setup() {

 Serial.begin(115200); 

 myLux.begin();

 if (!hdc.begin()) {

  Serial.println("Couldn't find sensor!");

  while (1);

 }

}

 

void loop() {

 Serial.print("Light: ");

 Serial.print(myLux.lightStrengthLux());

 Serial.print(" - Temperature: ");

 Serial.print(hdc.readTemperature());

 Serial.print(" - Humidity: ");

 Serial.println(hdc.readHumidity());

 delay(1000);

}

2023-06-19 23:43:10
Duncan.Wilson wrote:

Ah! Thanks for the tip. That works beautifully!

2023-06-20 02:34:33
Galang.Prab wrote:

Hello jenna, i try it but not work for me..

Can u help me for this??

2024-06-15 10:00:17
3 Replies
2023-06-19 06:34:29

I think you have to look inside the "Adafruit_HDC1000.h" and  DFRobot_B_LUX_V30B.h libraries. Maybe somewhere these two libraries are conflicting.Verify that the SEN0390 and HDC1080 have different I2C addresses. The I2C address of the SEN0390 should be 0x4A based on your I2C scan, and the HDC1080 default address is 0x40. If they have conflicting addresses, you might need to change the address of one of the sensors.

userHeadPic bidrohini.bidrohini
Duncan.Wilson wrote:

Thanks - have confirmed that SEN0390 seems to be 0x4A and HDC is 0x40 - therefore I believe that means they are not conflicting. 

2023-06-19 09:12:17
1 Replies