Tags: Light, Intensity, Illumination, Sensor, Gy, 30,

Light Intensity Illumination Sensor Gy-30

  • 17.00 AED
    • Ex Tax:17.00 AED
    • Product Code:
    • Availability: In Stock
    The GY-302 from CJMCU is an I2C board that allows you to measure the amount of light using the BH1750 photodetector. We will use the measured brightness to construct an ambient lighting quality indicator based on European Standard EN 12464-1. It is very easy to integrate the sensor GY-302 in an Ardu..

    The GY-302 from CJMCU is an I2C board that allows you to measure the amount of light using the BH1750 photodetector. We will use the measured brightness to construct an ambient lighting quality indicator based on European Standard EN 12464-1. It is very easy to integrate the sensor GY-302 in an Arduino project or ESP8266 using the library developed by Christopher Laws. It is available on this GitHub page.
    GY-30 Digital Optical Intensity Illumination Sensor BH1750FVI Module


    Power supply:3v-5v
    Illumination range :0-65535 lx
    The sensor built 16bitAD converter
    Close to the visual sensitivity of the spectral characteristics
    1 lux high-precision measurement of a wide range of brightness
    Direct digital output

    That there will be more luminous flux in some directions and it can increase the illumination of the target surface. 

    For example:
    Night: 0.001-0.02; 
    Moon light night: 0.02-0.3; 
    Cloudy indoor: 5-50;
    Cloudy outdoor: 50-500;
    Sunny indoor: 100-1000;
    Under the sunlight in summer afternoon: about 10*6 power; 
    Reading books for intensity of illumination: 50-60;
    Home video standard intensity of illumination: 1400.


    Arduino Sketch

    /*Sample code for the BH1750 Light sensor
     SCL-SCL(analog pin-5)
     SDA-SDA(analog pin-4)
     ADD-NC <-- to asign a different I2C address to the sensor
    #include <Wire.h> //BH1750 IIC Mode
    #include <math.h> 
    int BH1750address = 0x23; //setting i2c address
    byte buff[2];
    void setup()
       Serial.begin(57600); //init Serial rate
    void loop()
       int i;
       uint16_t val=0;
    int BH1750_Read(int address)
       int i=0;
       Wire.requestFrom(address, 2);
          buff[i] = Wire.receive();  // receive one byte
       return i;
    void BH1750_Init(int address) 
       Wire.send(0x10); //1lx reolution 120ms


    ADDRSelect I2C adresse. 0x23 by default. 0x5C if connected to 3V3

    For your Fritzing schemas, the component is available on GitHub here

    On an Arduino, connect the SDA pin to pin A4 and SCL on pin A5. On the ESP8266 Wemos d1 mini, SDA is in D2 and SCL in D1. 

    It is possible to manually assign the I2C bus pins using the Wire.h library. At the beginning of the program, the bookstore is declared

    #include <Wire.h>

    Then in the setup ()

    Wire.begin (SDA pin, SCL pin);

    On the basis of these different data, I constructed a 5-level indicator (too low, low, ideal, high, too high). You can adjust the values according to your habits and needs.

    #define _TOOLOW                       25
    #define _LOW                          50
    #define _HIGH                         500
    #define _TOOHIGH                      750
    #define LEVEL_TOOLOW                  "Too low"
    #define LEVEL_LOW                     "Low"
    #define LEVEL_OPTIMAL                 "Ideal"
    #define LEVEL_HIGH                    "High"
    #define LEVEL_TOOHIGH                 "Too high"

    How to use the BH1750 library

    The BH1750 library is used very similar to the BME280 library (or BMP180). At the beginning of the program, the library is called and the lightMeter object is initialized by indicating the address of the BH1750 on the I2C bus. By default the BH1750 is located at address 0x23. If you have a conflict with another component, you can assign the address 0x5C by feeding the addr pin to 3.3V.

    #include <BH1750.h>
    BH1750 lightMeter (0x23);

    The library supports the 6 modes of operation of the sensor. The sensor can measure continuous brightness

    • BH1750_CONTINUOUS_LOW_RES_MODE: Fast measurement (16ms) at low resolution (4 lux of precision)
    • BH1750_CONTINUOUS_HIGH_RES_MODE (default mode): High resolution (1 lux accuracy). The measurement time is 120ms
    • BH1750_CONTINUOUS_HIGH_RES_MODE_2: Very high resolution (0.5 lux accuracy). Measurement time 120ms

    These three other modes allow to realize a single measurement (One_Time) and then to put the sensor in energy saving. Accuracy and measurement time are identical.


    In the setup, the lightMeter object is started by using the function begin (uint8_t mode) by passing it as parameter the measurement mode. The configure (uint8_t mode) function is (called by begin) is also exposed.

    void setup(){

    The readLightLevel method reads the light intensity measured by the BH1750 at any time. The function returns the measurement directly to Lux.

    uint16_t lux = lightMeter.readLightLevel();

    Arduino Code / ESP8266

    Here is the complete code of the application you just need to upload. It works either on Arduino, ESP8266 or ESP32.

      Mesurer la qualité d'éclairage de votre habitation à l'aide d'un capteur GY-302 (BH1750)
      Measure the lighting quality of your home with a GY-30 (BH1750) sensor
      Code basé sur la librairie Arduino de Christopher Laws disponible sur GitHub
      Based on the Arduino library of Christopher Laws abailable on GitHub https://github.com/claws/BH1750
        VCC -> 5V (3V3 on Arduino Due, Zero, MKR1000, etc)
        GND -> GND
        SCL -> SCL (A5 on Arduino Uno, Leonardo, etc or 21 on Mega and Due)
        SDA -> SDA (A4 on Arduino Uno, Leonardo, etc or 20 on Mega and Due)
        ADD -> GND or VCC (see below)
      ADD pin uses to set sensor I2C address. If it has voltage greater or equal to
      0.7VCC voltage (as example, you've connected it to VCC) - sensor address will be
      0x5C. In other case (if ADD voltage less than 0.7 * VCC) - sensor address will
      be 0x23 (by default).
      https://projetsdiy.fr - https://diyprojects.io
    #include <Wire.h>
    #include <BH1750.h>
     * Niveau d'éclairage définit à partir de la norme EN 12464-1 
     * Lighting level defined from the standard EN 12464-1 
     * http://www.afe-eclairage.fr/docs/362-ext.pdf
    #define _TOOLOW                       25
    #define _LOW                          50
    #define _HIGH                         500
    #define _TOOHIGH                      750
    #define LEVEL_TOOLOW                  "Trop bas"      // Too low
    #define LEVEL_LOW                     "Bas"           // Low
    #define LEVEL_OPTIMAL                 "Idéal"         // Ideal
    #define LEVEL_HIGH                    "Elevé"         // High
    #define LEVEL_TOOHIGH                 "Trop élevé"    // Too High
    uint16_t lux        = 250;
    int      luxLevel   = 3;
    String   luxMessage = LEVEL_OPTIMAL;
      BH1750 can be physically configured to use two I2C addresses:
        - 0x23 (most common) (if ADD pin had < 0.7VCC voltage)
        - 0x5C (if ADD pin had > 0.7VCC voltage)
      Library use 0x23 address as default, but you can define any other address.
      If you had troubles with default value - try to change it to 0x5C.
    BH1750 lightMeter(0x23);
    void setup(){
        Each mode, has three different precisions:
          - Low Resolution Mode - (4 lx precision, 16ms measurment time)
          - High Resolution Mode - (1 lx precision, 120ms measurment time)
          - High Resolution Mode 2 - (0.5 lx precision, 120ms measurment time)
        Full mode list:
          BH1750_CONTINUOUS_HIGH_RES_MODE (default)
      Serial.println(F("BH1750 Test"));
    void loop() {
      lux = lightMeter.readLightLevel();
      if ( lux <= _TOOLOW ) {
        luxLevel = 1;
        luxMessage = LEVEL_TOOLOW;
      } else if ( lux > _TOOLOW && lux <= _LOW ) {
        luxLevel = 2;
        luxMessage = LEVEL_LOW;
      } else if ( lux > _LOW && lux <= _HIGH ) {
        luxLevel = 3;
        luxMessage = LEVEL_OPTIMAL;
      } else if ( lux > _HIGH && lux < _TOOHIGH ) {
        luxLevel = 4;
        luxMessage = LEVEL_HIGH;
      } else {
        luxLevel = 5;
        luxMessage = LEVEL_TOOHIGH;
      Serial.print("Light: "); 
      Serial.print(" lx, level: ");
      Serial.print(" , quality: ");

    There are no reviews for this product.

    Write a review

    Please login or register to review