The digital 16bit serial output type Ambient Light sensor IC develop by ROHM semiconductor. The BH1750 IC is a digital Ambient light sensor IC that drives on i2c / IIC 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 rated to 1 – 65535 LUX. Mostly used in Mobile Phone, LCD TV, PC, Portable game machine, Digital Camera, Video Camera, PDA, LCD Display.
Features:
- I2C/IIC bus interface (f/s mode support)
- Spectral responsibility approximately human eye response
- Illuminance to digital converter
- Wide range and high resolution (1 – 65535) LUX
- Low current by power down function
- 8v Logic input interface
- No need any external parts
- Light source dependency is little for example the incandescent lamp, fluorescent lamp, halogen lamp, white LED, and sun light.
- Can be selected 2 type of i2C/IIC slave address
- Adjustable measurement result for influence of optical window and can detec min .0.11LX max. 100000 LX by using this function
- Small measurement vibration (+/-20%)
- The influence of infrared is very small
- Supply Voltage VMAX 4.5 v
- Operating Temperature -40 to 85 degree Celsius
- Storage temperature -40 to 100 degree Celsius
- SDA Sink Current LMAX 7 mA
- Power Dissipation 260* mW
Required Component
- Arduino UNO, MEGA, NANO, PRO, DUE, LEO, AVR ESP8266,
- BH1750 Breakout Module
- i2C / IIC OLED Display Module (Optional)
- Jumper Wires / DuPont Wires
- Solder Less Bread Board
Wiring Diagram
Source Code / Sketch Code with OLED
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
#include <Wire.h> #include "U8glib.h" U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); int BH17_add = 0x23; byte buff[2]; void setup() { Wire.begin(); BH750_Init(BH17_add); delay(200); } void light(){ float valf=0; u8g.setFont(u8g_font_unifont); u8g.setPrintPos(0, 50); if (BH1750_Read(BH17_add)==2){ valf=((buff[0]<<8)|buff[1])/1.2; if (valf<0)u8g.print("> 65535"); else u8g.setPrintPos(0, 20); u8g.print("www.14core.com"); u8g.setPrintPos(0, 30); u8g.print("--------------"); u8g.setPrintPos(0, 40); u8g.print("Flux Meter"); u8g.setPrintPos(0, 60); u8g.print((int)valf,DEC); u8g.print(" LX/SI"); } delay(100); } void loop() { u8g.firstPage(); do { light(); }while (u8g.nextPage()); } void BH750_Init(int address){ Wire.beginTransmission(address); Wire.write(0x10); Wire.endTransmission(); } byte BH1750_Read(int address){ byte i=0; Wire.beginTransmission(address); Wire.requestFrom(address, 2); while(Wire.available()){ buff[i] = Wire.read(); i++; } Wire.endTransmission(); return i; } |
Source Code / Sketch Code without OLED
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
#include <Wire.h> int BH17_add = 0x23; byte buff[2]; void setup() { Wire.begin(); BH750_Init(BH17_add); Serial.begin(9600); delay(200); } void light(){ float valf=0; if (BH1750_Read(BH17_add)==2){ valf=((buff[0]<<8)|buff[1])/1.2; if (valf<0)Serial.print("> 65535"); else Serial.print("www.14core.com"); Serial.println("--------------"); Serial.println("Flux Meter"); Serial.println((int)valf,DEC); Serial.println(" LX/SI"); } delay(100); } void loop() { light(); } void BH750_Init(int address){ Wire.beginTransmission(address); Wire.write(0x10); Wire.endTransmission(); } byte BH1750_Read(int address){ byte i=0; Wire.beginTransmission(address); Wire.requestFrom(address, 2); while(Wire.available()){ buff[i] = Wire.read(); i++; } Wire.endTransmission(); return i; } |
Downloads
- Download the BH1750 Datasheet | Pdf
Wiring the BH1750 Digital 16bit Serial Output Type Ambient Light Sensor