Arduino(15): Illumination sensor GY-30 BH1750FVI

There is not enough light near my desk, but I can’t tell how bright or dark it is. Scientific data is needed. In this implementation, I use the light sensor GY-30 BH1750FVI sensor module to measure the brightness near my desk. degree. Another application is the detection of brightness lighting in a room or garden, and automatic control of light switching or brightness adjustment.


[GY-30 BH1750FVI Light Intensity Module]

The specifications of GY-30 BH1750FVI are as follows:
  • Power supply: 3-5v
  • Illumination range: 0-65535 lx
  • Built-in 16-bit AD converter in the sensor: Direct digital output without complicated calculations
  • Spectral characteristics close to visual sensitivity High-precision measurement of 1 lux for a wide range of brightness
  • Standard NXP IIC communication protocol

Lux is the international unit of illuminance, Lux (Lux, usually abbreviated as lx) is an international unit of illuminance, 1 lumen (lm) For every square meter of area, it is 1 lux.
  • 1 lm (spherical degree) = 1 cd (candle light) x sr (spherical degree)
If a light source emits 1 candlelight with a luminous intensity within the range of 1 solid angle, then the total emitted luminous flux to that solid angle is 1 lumens (lm ). The luminous flux received per unit area is called illuminance.

[Install BH1750 Library]

The BH1750 library provides a digital light sensor module for reading the illuminance using the BH1750FVI IC .
First go to Github to download Claws / BH1750 , click the green option "Clone or download" on the right, and then select "Download ZIP".

  • Decompress the downloaded compressed file and place it in the libraries directory under the Arduino main program. For my computer, Arduino is installed in C:\Program Files (x86)\Arduino. Click into the directory and there is a library subdirectory , After downloading, unzip the directory, put the whole into the libraries directory, and restart Arduino.

[Material]

  • Arduino Uno x 1
  • GY-30 (BH1750FVI) x1
  • Wire x N

[Wiring diagram]

ArduinoGY-30 BH1750FVI
5V(VCC)VCC
GNDGND
A4(SDA)SDA
A5(SCL)SCL


[Code]

#include <Wire.h>
#include <BH1750.h>

BH1750 lightMeter;

void setup(){

  Serial.begin(9600);

  // Initialize I2C 
  // If it is an esp8266 device, you can use SCL and SDA to use
  Wire.begin();
  lightMeter.begin();
  Serial.println(F("BH1750 Test"));
}

void loop() {
  float lux = lightMeter.readLightLevel();
  Serial.print("Light: ");
  Serial.print(lux);
  Serial.println(" lx");
  delay(1000);
}

[Result]



[Reference]

Post a Comment

Previous Post Next Post