BH1750FVI Ambient Light Sensor example

The BH1750FVI is an digital Ambient Light Sensor IC for I2C bus interface. This IC is the most suitable to obtain the ambient light data for adjusting LCD and Keypad backlight power of Mobile phone. It is possible to detect wide range at High resolution.

This is the module I used

BH1750 module
BH1750 module

For those that are interested I found this schematic online for the module

BH1750

Connection

A fairly standard connection being an I2C device.

VCC  –  Wemos 3.3v
GND – Wemos Gnd
SCL – Wemos D1
SDA – Wemos D2

Code

You will need this modified library, I could not get the original Arduino one to work – BH1750-master

[codesyntax lang=”cpp”]

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


BH1750 lightMeter;


void setup(){
  Serial.begin(9600);
  lightMeter.begin();
  Serial.println("Running...");
}


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

[/codesyntax]

 

Open the serial monitor and cover the sensor, shine some light on it and so on. You should see the lux value change

Links

 
You can pick these sensors up for about $4 a piece
 

BH1750 Chip Light Intensity Light Module

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here