bh1750fvi (GY-302) Light Sensor Module


Signaling Type I2C

This sketch requires BH1750.h library.

You can download the library here


Example of BH1750 library usage.

This example initalises the BH1750 object using the default
high resolution mode and then makes a light level reading every second.

SCL-SCL(analog pin 5)
SDA-SDA(analog pin 4)


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

BH1750 lightMeter;

void setup(){

void loop() {
uint16_t lux = lightMeter.readLightLevel();
Serial.print(“Light: “);
Serial.println(” lx”);

This entry was posted in Arduino Project and tagged , , , , . Bookmark the permalink.

7 Responses to bh1750fvi (GY-302) Light Sensor Module

  1. Ricardo says:

    and if you use more than one?

  2. Chayan17 says:

    Hallo, I tried tou use code for BH1750, but compilling the scetch program doesn”t pass me throuhg line: Serial.println(“Running…”); with comment Stray “\”. Can sombeodz help me, Iam begiiner in programming Thanks Chay.

  3. malwhiteMal says:

    Hi cmosgr
    I am trying your code on an arduino mega using a BH1750 module GY-302 just like yours. I am using all your code and all the libraries you link to. No matter what connections I try I always get a continual reading of 54612 lx (pinned out I guess). This is for any light conditions.
    Do you have any ideas that could help me troubleshoot?

    • cmosgr says:

      Yes 54612lx means that there’s a connection or hardware problem.

      Check again connections SCL,SDA pins 🙂

      • malwhiteMal says:

        Thanks for your prompt assistance. I have now tried it with two modules, bought a new one, on two breadboards, checking everything ten times but still no good. Tried it with the address pin grounded or floating. My soldering looks decent and I don’t think I cooked anything so it is all a mystery to me. If you have any other thoughts please let me know. Was going to make a colorimeter. Thanks again for trying to help.

  4. malwhiteMal says:

    Finally and boy do I feel stupid. My Mega rev 3 board has dedicated sda and scl pins (20 and 21) connect to those and all is well. You were so right, check the pins, I just did not realise that meant check the pins available on the board. Thanks.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s