Other Arduino Codes and Videos by Robojax

How to use BH1750 to measure Light Lux with Arduino

دروس آردوینو به فارسی

How to use BH1750 to measure Light Lux with Arduino

This video shows you how to use BH1750 Light intensity Lux sensor. You will also learn how to change the I2C address of the module.


  Example of BH1750 library usage.
  This code is part of the library is here: https://github.com/claws/BH1750

  This example initialises the BH1750 object using the default high resolution
  continuous mode and then makes a light level reading every second.
Watch video instructin for this code: https://youtu.be/iKUwu220UFQ
Video posted on April 20, 2020 on YouTube


    VCC -> 3V3 or 5V
    GND -> GND
    SCL -> SCL (A5 on Arduino Uno, Leonardo, etc or 21 on Mega and Due, on esp8266 free selectable)
    SDA -> SDA (A4 on Arduino Uno, Leonardo, etc or 20 on Mega and Due, on esp8266 free selectable)
    ADD -> (not connected) or GND

 * Get this code and other Arduino codes from Robojax.com
Learn Arduino step by step in structured course with all material, wiring diagram and library
all in once place. Purchase My course on Udemy.com http://robojax.com/L/?id=62

Get early access to my videos via Patreon and have  your name mentioned at end of very 
videos I publish on YouTube here: http://robojax.com/L/?id=63 (watch until end of this video to list of my Patrons)

or make donation using PayPal http://robojax.com/L/?id=64

 *  * This code is "AS IS" without warranty or liability. Free to be used as long as you keep this note intact.* 
 * This code has been download from Robojax.com
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.


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

BH1750 lightMeter;

void setup(){


  // Initialize the I2C bus (BH1750 library doesn't do this automatically)
  // On esp8266 you can select SCL and SDA pins using Wire.begin(D4, D3);


  Serial.println(F("BH1750 Test begin"));


void loop() {

  float lux = lightMeter.readLightLevel();
  Serial.print("Light: ");
  Serial.println(" lx");


If you found this tutorial helpful, please support me so I can continue creating content like this. support me via PayPal