Electro BOY
Published © GPL3+

BH1750 light intensity sensor by Grove

I designed this sensor to work with grove platform under the SEEEDSTUDIO design competition and I my design got approved.

IntermediateFull instructions provided2 hours650
BH1750 light intensity sensor by Grove

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1

Software apps and online services

Arduino IDE
Arduino IDE
Seeed fusion

Hand tools and fabrication machines

Breadboard, 170 Pin
Breadboard, 170 Pin
10 Pc. Jumper Wire Kit, 5 cm Long
10 Pc. Jumper Wire Kit, 5 cm Long

Story

Read more

Custom parts and enclosures

Gerber files

BOM file

ONLY TO USE WITH SEEED FUSION SERVICE

Pick and place file

Schematics

Circuit PDF

Code

Code with 16X2 I2C

Arduino
#include <BH1750.h>
#include <Wire.h> // Library for I2C communication
#include <LiquidCrystal_I2C.h> // Library for LCD

BH1750 lightMeter;
LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27, 16, 2); 

void setup() {
  Wire.begin();
  lightMeter.begin();
  lcd.init();
  lcd.backlight();
  lcd.setCursor(0,0);
  lcd.print("BH1750 Test");
  lcd.setCursor(0,1);
  lcd.print("Please wait...");
  delay(3000);
  lcd.clear();
}
void loop() {
   lcd.clear();
   lcd.setCursor(0, 0);
   lcd.print("Light Intensity ");
   lcd.setCursor(5, 1);
   float lux = lightMeter.readLightLevel();
   lcd.print(lux);
   lcd.print(" Lux");
   delay(2000);
}

Code for OLED

Arduino
#include <BH1750.h>
#include <Wire.h> // Library for I2C communication
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

BH1750 lightMeter;
#define OLED_RESET 1
Adafruit_SSD1306 display(128, 64, &Wire, OLED_RESET);

void setup() {
  Wire.begin();
  lightMeter.begin();
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  display.clearDisplay();
}
void loop() {
   display.clearDisplay();
   display.setTextSize(1);
   display.setTextColor(WHITE);
   display.setCursor(20,10);
   display.print("Light Intensity");
   display.display();

   float lux = lightMeter.readLightLevel();
   display.setTextSize(2);
   display.setCursor(20,30);
   display.print(lux);
   display.display();

   display.setCursor(30,50);
   display.print("   Lux");
   display.display();
   delay(2000);
}

Credits

Electro BOY

Electro BOY

57 projects • 54 followers
Electronics is my passion. I am not professional, Always learning something new. I am good at soldering, designing pcb, Arduino programing.

Comments