BH1750 Light Sensor

All things Arduino!
Post Reply
Posts: 165
Joined: Fri Feb 21, 2014 4:52 pm

BH1750 Light Sensor

Post by Eric » Tue May 06, 2014 6:29 pm

I was sent a sample BH1750 light sensor by ICstation so I thought I would share the code and instruction how I got it working. The full video is on my YouTube channel.

I found the initial code and library here: ... ht-Sensor/

Once you have downloaded the library just open the Arduino IDE and the example code will be there for the basic examples. I went ahead and modded the eample code for my Nokia 5110 LCD display. Here is the code to make your own with LCD :)

Take the code, make it better!


This code is for the BHT1750 Light Sensor (provided to me by

This is a work in progress but hopefully it will help someone else by providing
a base to start and work from.

Please check out my Youtube videos here and consider a thumbs up if this helped you!
Youtube :

Website, Forum and store are at

I2C Connections:
SDA connected to pin Analog 4
SCL connected to pin Analog 5
 addr >> A3
 Gnd >>>Gnd
Pin 11 for contrast on the Nokia 5110

#include "Adafruit_GFX.h"
#include "Adafruit_PCD8544.h"
Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3);//4 and 3 are reversed on the cheap eBay models
#include <BH1750FVI.h> // Sensor Library
#include <Wire.h> // I2C Library
uint16_t Light_Intensity=0;
BH1750FVI LightSensor;

void setup() {
  analogWrite(11,220);// PWM of LCD backlight but ebay unit is backwards-
  //must go high + cycle to dim
  //Very Dim=230
  LightSensor.SetAddress(Device_Address_H); //Address 0x5C
  display.begin();//Display code
  display.setContrast(50);//Nokia 5110 works best at 50- no more flicker
  display.clearDisplay(); // clears the screen and buffer
  display.setTextSize(1); // set text size
   // Splash Personal- taken from example code
  display.println(" Eric's");
  display.println(" BH1750");
  display.println(" Light");
  display.println(" Sensor");
  display.clearDisplay(); // clears the screen and buffer

void loop() {
  display.clearDisplay(); // clears the screen and buffer
    display.println(" Intensity = ");
  //display.setCursor(5, 1);
  display.println ("");
  Light_Intensity = LightSensor.GetLightIntensity();
  display.setTextSize(2); // set text size

  Serial.print (Light_Intensity);//for troubleshooting
  display.println(" Lux");
I make videos and content on all things electronics, 3D prining and "Maker"

Post Reply