In this part we will see how to connect and program arduino with BH1750 light sensor to get room light levels.
Circuit Diagram(Arduino + BH1750)
To mount the circuit, you would want to start off by disconnecting any source of power going into your Arduino as it may be a hazard when connecting wires to the BH1750 sensor. Now, we can start wiring the sensor to the Arduino. Before starting, make sure you have soldered the 5-pin header to the sensor for your connections. This sensor uses the standard i2c protocol wiring, so it may all be very familiar to you. Firstly, use one of your five jumper wires to connect the VCC pin of the sensor to the 5v pin on your Arduino board. Now, use another jumper wire to connect the GND pin of your BH1750 sensor to any of your GND pins on your Arduino. Next, connect the SCL (Serial Clock) pin of the sensor to A5 (analog pin 5) of your Arduino and the SDA (Serial Data) pin of your sensor to A4 (analog pin 4) of your Arduino. These four connections are all part of the standard i2c hardware connections for any i2c sensor. The hardware part of this project is now done!
Program To be Uploaded into Arduino
#include <BH1750FVI.h> // Create the Lightsensor instance BH1750FVI LightSensor(BH1750FVI::k_DevModeContLowRes); void setup() { Serial.begin(115200); LightSensor.begin(); } void loop() { uint16_t lux = LightSensor.GetLightIntensity(); Serial.print("Light: "); Serial.println(lux); delay(700); }
Blog #03 :arduino 33 iot interfaced with light sensor BH1750 that gives room light level in lux
Blog #04 :PC Program to Control Screen Brightness