BH1750 Light Intensity Detection Sensor
The BH1750 sensor uses the original ROHM BH1750FVI chip and operates with a power supply of 3-5V. It has a light intensity range of 0-65535 lux. The sensor includes a 16-bit ADC (Analog-to-Digital Converter) for direct digital output, eliminating the need for complex calculations and calibration. It is designed with spectral characteristics close to human visual sensitivity, allowing for precise measurement of a wide range of brightness with 1 lux accuracy. The sensor uses the standard NXP I2C communication protocol and contains built-in level shifting for direct connection to 5V microcontroller I/O pins.
Module Source
Purchase Link:
https://detail.tmall.com/item.htm?_u=52t4uge534a7&id=598334245306&spm=a1z09.2.0.0.47582e8dxs1caw
Baidu Netdisk Download Link:
https://pan.baidu.com/s/13bVmmj0eM22mT8pBusjIyQ?pwd=8889
Password: 8889
Specifications
Operating Voltage: 3-5V
Operating Current: 200uA
Detection Range: 1~65536 lx
Module Dimensions: 32.6mm×15.2mm×11.6mm
Output Method: IIC
Pin Count: 5 Pin
Hardware Interface
- Connect the VCC pin of BH1750 to the 3.3V output of the development board.
- Connect the GND pin to the GND of the development board.
- Connect the SDA pin to the A4 pin (SDA) of the development board.
- Connect the SCL pin to the A5 pin (SCL) of the development board.
Instructions for Use
Install Library
The BH1750 communicates with Arduino via I2C. A third-party library can be used to simplify interaction with the BH1750. You can install a BH1750 library through the Arduino IDE's library manager.
Steps to install:
- Open the Arduino IDE.
- Go to "Tools" > "Manage Libraries..."
- In the search bar, type "BH1750."
- Find the BH1750 library and install it.
Enter the code:
/******************************************************************************
* Test Hardware: LCSC ColorEasyDuino Development Board
* Version Number: V1.0
* Modified By: www.lckfb.com
* Modification Date: April 10, 2024
* Function Overview:
*****************************************************************************
* Open-source development board hardware and software information and related projects hardware and software information on official website
* Development board official website: www.lckfb.com
* Technical support resident forum, any technical problems are welcome at any time to exchange learning
* LCSC Forum: club.szlcsc.com
* Follow our Bilibili account: [立创开发板], stay toned to our latest news!
* We focus on cultivating Chinese engineers rather than profiting from board sales.
******************************************************************************/
#include <Wire.h>
#include <BH1750.h>
BH1750 lightMeter;
void setup(){
Serial.begin(9600);
Wire.begin();
if (lightMeter.begin(BH1750::CONTINUOUS_HIGH_RES_MODE)) {
Serial.println(F("BH1750 Test begin!"));
} else {
Serial.println(F("Error initialising BH1750"));
}
}
void loop() {
float lux = lightMeter.readLightLevel(); // 读取当前光照强度(单位:勒克斯)
Serial.print("Light: ");
Serial.print(lux);
Serial.println(" lx");
delay(1000); // 延迟时间可以根据需要进行调整
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37