شحن مجاني للأوردرات فوق
1000 ج
رمضان كريم
High-Precision Ambient Light Sensing for Arduino Projects
The GY-302 BH1750 is a digital ambient light sensor that measures illuminance in lux (lx) with high resolution (1-65535 lx). This I2C interface module operates from 3V to 5V and is ideal for automatic brightness adjustment in displays, smart lighting systems, and environmental monitoring.
Key Features1-65535 lx measurement range
1 lx resolution at low light levels
0.12mA active current (0.01μA standby)
Close to human eye sensitivity
| Measurement Range | 1 – 65535 lx |
|---|---|
| Resolution | 1 lx (at 0-5461 lx range) |
| Accuracy | ±20% (typical) |
| Supply Voltage | 2.4V – 3.6V (5V tolerant I/O) |
| I2C Address | 0x23 (default) or 0x5C (ADDR pin high) |
| Interface | I2C (up to 400kHz) |

| Pin | Label | Description | Arduino Connection |
|---|---|---|---|
| 1 | VCC | Power (3.3V recommended) | 3.3V |
| 2 | GND | Ground | GND |
| 3 | SCL | I2C Clock | A5 (Uno) or SCL |
| 4 | SDA | I2C Data | A4 (Uno) or SDA |
| 5 | ADDR | Address Select | GND (0x23) or VCC (0x5C) |
// Basic Connections: // VCC → 3.3V (or 5V with level shifting) // GND → GND // SCL → A5 (or SCL) // SDA → A4 (or SDA) // ADDR → GND (for default address 0x23)
#include
#include
BH1750 lightMeter;
void setup() {
Serial.begin(9600);
Wire.begin();
lightMeter.begin(BH1750::CONTINUOUS_HIGH_RES_MODE);
Serial.println("BH1750 Test");
}
void loop() {
float lux = lightMeter.readLightLevel();
Serial.print("Light: ");
Serial.print(lux);
Serial.println(" lx");
delay(1000);
}
// Set different measurement modes
lightMeter.begin(BH1750::CONTINUOUS_HIGH_RES_MODE); // Default
// Other options:
// CONTINUOUS_HIGH_RES_MODE_2
// CONTINUOUS_LOW_RES_MODE
// ONE_TIME_HIGH_RES_MODE
// ONE_TIME_LOW_RES_MODE
// Use alternate I2C address (ADDR pin to VCC)
BH1750 lightMeter(0x5C);
// Adjust measurement time (69 default)
lightMeter.adjustMtreg(138); // Double sensitivity
// Range: 31 (min) to 254 (max)
// Power down sensor between readings
lightMeter.begin(BH1750::ONE_TIME_HIGH_RES_MODE);
// Takes measurement then auto-powers down
No account yet?
Create an Account
Recent Comments