Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Based Ambient Light Monitoring with I2C LCD Display

View and Edit Project In Cirkit DesignerImage of Arduino UNO Based Ambient Light Monitoring with I2C LCD Display

Circuit Documentation

Summary

This circuit integrates an Arduino UNO microcontroller with a BH1750 light sensor and a 20x4 LCD display with I2C interface. The purpose of the circuit is to measure ambient light intensity using the BH1750 sensor and display the readings in lux on the LCD. The Arduino UNO serves as the central processing unit, reading sensor data and controlling the LCD output. The components are interconnected via I2C communication protocol, which allows for a simplified two-wire connection (SCL for clock and SDA for data) between the devices.

Component List

Arduino UNO

BH1750 Light Sensor

LCD Display 20x4 I2C

Wiring Details

Arduino UNO

BH1750 Light Sensor

LCD Display 20x4 I2C

Documented Code

Arduino UNO Code

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

LiquidCrystal_I2C lcd(0x27, 20, 4);  // LCD I2C address, 20 columns and 4 rows
BH1750 lightMeter;  // BH1750 light sensor object

void setup() {
  Serial.begin(9600);
  Wire.begin();
  lightMeter.begin();
  Serial.println(F("BH1750 Test begin"));
  lcd.begin();  // Initialize the LCD without arguments
  lcd.backlight();   // Turn on the LCD backlight
}

void loop() {
  float lux = lightMeter.readLightLevel();  // Read light intensity in lux
  Serial.print("Light: ");
  Serial.print(lux);
  Serial.println(" lx");

  lcd.setCursor(0, 0);  // Set cursor at the beginning of the first line
  lcd.print("Lux : ");
  lcd.print(lux);  // Display the lux value on the LCD

  delay(1000);  // Wait for 1 second before taking the next reading
}

This code initializes the I2C communication, sets up the LCD display, and continuously reads the light level from the BH1750 sensor. The light level in lux is printed to the serial monitor and displayed on the LCD. The LCD is initialized with the I2C address 0x27, which may need to be adjusted depending on the hardware. The backlight of the LCD is turned on for visibility. The sensor readings are taken every second, as indicated by the delay(1000) function call.