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

How to Use BH1750: Examples, Pinouts, and Specs

Image of BH1750Design with BH1750 in Cirkit Designer

Introduction

The BH1750 is a digital light sensor designed to measure ambient light levels with high precision. It communicates using the I2C protocol, making it easy to interface with microcontrollers and other digital systems. The sensor provides a direct lux (lx) reading, eliminating the need for complex calculations. Its low power consumption and compact design make it suitable for a wide range of applications, including:

Explore Projects Built with BH1750

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Arduino Mega ADK Automated Plant Watering and Environmental Monitoring System: A project utilizing BH1750 in a practical application
Arduino Mega ADK Automated Plant Watering and Environmental Monitoring System

This circuit features an Arduino Mega ADK as the central microcontroller, interfacing with a variety of sensors and actuators. It includes a BH1750 light sensor and a DHT11 temperature and humidity sensor for environmental monitoring, both interfacing via I2C. The system controls a stepper motor via an A4988 driver, two water pumps through a 3-channel relay, and a fan using an IRF520 PWM module, with several push switches to trigger inputs. An OLED display provides a user interface, and soil moisture levels are monitored with two soil sensors. A non-contact water level sensor is also included for liquid level detection.

Open Project in Cirkit Designer

Technical Specifications

The BH1750 is a highly efficient and accurate light sensor. Below are its key technical details:

Parameter Value
Operating Voltage 2.4V to 3.6V
Typical Operating Current 0.12 mA (in measurement mode)
Measurement Range 1 lx to 65535 lx
Communication Interface I2C
I2C Address (Default) 0x23 (can also be 0x5C)
Resolution 1 lx (High-Resolution Mode)
Operating Temperature -40°C to +85°C
Dimensions 3.0 mm × 1.6 mm × 1.2 mm

Pin Configuration and Descriptions

The BH1750 has six pins, as described in the table below:

Pin Name Pin Number Description
VCC 1 Power supply (2.4V to 3.6V)
GND 2 Ground
SDA 3 I2C data line
SCL 4 I2C clock line
ADDR 5 I2C address selection (connect to GND or VCC)
NC 6 No connection (leave unconnected)

Usage Instructions

How to Use the BH1750 in a Circuit

  1. Power the Sensor: Connect the VCC pin to a 3.3V power source and the GND pin to ground.
  2. I2C Communication: Connect the SDA and SCL pins to the corresponding I2C pins on your microcontroller. Use pull-up resistors (typically 4.7kΩ) on both SDA and SCL lines if not already present.
  3. Address Selection: The ADDR pin determines the I2C address:
    • Connect ADDR to GND for address 0x23.
    • Connect ADDR to VCC for address 0x5C.
  4. Initialize the Sensor: Use the I2C protocol to initialize the sensor and configure its measurement mode.

Important Considerations and Best Practices

Example Code for Arduino UNO

Below is an example of how to use the BH1750 with an Arduino UNO:

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

// Create an instance of the BH1750 sensor
BH1750 lightMeter;

void setup() {
  Serial.begin(9600); // Initialize serial communication at 9600 baud
  Wire.begin();       // Initialize I2C communication

  // Initialize the BH1750 sensor
  if (lightMeter.begin()) {
    Serial.println("BH1750 initialized successfully.");
  } else {
    Serial.println("Error initializing BH1750. Check connections.");
    while (1); // Halt execution if initialization fails
  }
}

void loop() {
  // Read light level in lux
  float lux = lightMeter.readLightLevel();

  // Print the light level to the serial monitor
  Serial.print("Light Level: ");
  Serial.print(lux);
  Serial.println(" lx");

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

Troubleshooting and FAQs

Common Issues and Solutions

  1. No Response from the Sensor

    • Cause: Incorrect I2C address or wiring.
    • Solution: Verify the ADDR pin connection and ensure the correct I2C address is used in your code.
  2. Inaccurate Readings

    • Cause: Unstable power supply or incorrect measurement mode.
    • Solution: Use a stable 3.3V power source and select the appropriate measurement mode.
  3. I2C Communication Errors

    • Cause: Missing or incorrect pull-up resistors on SDA and SCL lines.
    • Solution: Add 4.7kΩ pull-up resistors to the SDA and SCL lines if not already present.
  4. Sensor Saturation

    • Cause: Exposure to very bright light sources.
    • Solution: Shield the sensor from direct sunlight or use a diffuser.

FAQs

Q1: Can the BH1750 operate at 5V?
A1: No, the BH1750 is designed to operate at a voltage range of 2.4V to 3.6V. Use a level shifter if interfacing with a 5V system.

Q2: How do I change the measurement mode?
A2: The measurement mode can be changed by sending specific commands via I2C. Refer to the BH1750 datasheet for detailed command instructions.

Q3: What is the maximum I2C clock speed supported?
A3: The BH1750 supports I2C clock speeds up to 400 kHz (Fast Mode).

Q4: Can I use multiple BH1750 sensors on the same I2C bus?
A4: Yes, you can use multiple sensors by configuring each sensor with a unique I2C address using the ADDR pin.

By following this documentation, you can effectively integrate the BH1750 into your projects and troubleshoot common issues with ease.