Lux Light Sensor (BH1750)
Summary
The BH1750 device was designed for accurate measurement of ambient light levels. It is most often used to to measure ambient light in order to adjust LCD and keypad backlighting on mobile phones. It is a pre-calibrated digital sensor and can measure a wide range of light intensities at high 16-bit resolution, from 1–65535 lux (lx).
The supplied device has a white plastic dome to provide a wide angle of detection. It can be powered as a 3-5V device, and has a built in electronics to allow direct digital output, bypassing additional calculation, and calibration. It has a response close to human visual sensitivity, across the visible spectrum. It can be connected to a microcontroller via the I2C bus.
The lux (symbol: lx) is the SI unit of illuminance and luminous emittance, measuring luminous flux per unit area. It is equal to one lumen per square metre. In photometry, this is used as a measure of the intensity, as perceived by the human eye, of light that hits or passes through a surface. It is analogous to the radiometric unit watts per square metre, but with the power at each wavelength weighted according to the luminosity function, a standardized model of human visual brightness perception
Typical Lux values
0.0001 lux - Moonless, overcast night sky (starlight)
0.002 lux - Moonless clear night sky with airglow
0.27–1.0 lux - Full moon on a clear night[3][4]
3.4 lux - Dark limit of civil twilight under a clear sky
50 lux - Family living room lights (Australia, 1998)
80 lux - Office building hallway/toilet lighting]
100 lux - Very dark overcast day
320–500 lux - Office lighting
400 lux - Sunrise or sunset on a clear day.
1000 lux - Overcast day; typical TV studio lighting
10000–25000 lux - Full daylight (not direct sun)
32000–100000 lux - Direct sunlight
(source: Wikipedia)
The outdoor range of light range is from < 1- 120,000 lux so the bare, un-covered sensor will fully saturate in full sun at 54612 lux if not adjusted or has a cover applied. In bright light, over-range values will have a negative sign. The readings can be compensated for in the software at higher light levels. For example, the supplied sensor “BH1750FVI Chip Light Intensity Light Module Light ball” has a white dome cover, and the sensor receives around 52 % of the actual light level when directly overhead.
How to Connect
The BH1750 device communicates with the microcontroller across an I2C bus. It can be powered from a 3.3V-5V supply.
The module is provided with a plug-in socket (XH2.54) and set of leads. A set of male-male Dupont leads can be used to connect the leads directly to the yellow-coloured main connector on the Grove Beginner Kit board - or indirectly, via sockets on the supplied breadboard.
The SCL and DAT leads from the BH1750 module should be connected to the SCL and SDA sockets, respectively
The GND lead should be connected to a ground socket
The Vcc lead should be connected to a 5V socket
The ADDR pin can be used to select the device if you wish to use multiple light detectors.
How to use in XOD
Download the external XOD library: vitaliysh/bh1750. This provides a single node, bh1750, that can be used to provide readings from the sensor. The node requires the I2C address of the device (23h) and provides the measured light intensity as a number. Reads can be triggered by sending pulses to the node, and the author of the node recommends maintaining a gap between readings.
There is some more discussion of the library on the XOD forum at: https://forum.xod.io/t/my-node-gy-302-bh1750-light-sensor-i2c/2124
Test patch:
A working test patch is shown below. This uses a clock node to generate 100 millisecond-spaced pulses to read light values from the BH1750 device. The output from the bh1750 node is fed to the format-number node, to remove insignificant decimal values, and produce a string for display. A concat node is used to add the “ lux” label, and sent to the text-lcd-i2c-16x2 node for display on the LCD - which is also attached to the I2C bus. The first line of the display shows the label: “Light intensity:” The patch provides a real-time display of light intensity as it plays across the sensor. Images below show the light measurements taken under ambient room light (168 lux), and after illumination with a hand-held torch (7980 lux).
Notes
Building PAR ligh meters with different digital sensors, including the BH1750: https://ledgardener.com/forum/viewtopic.php?t=5748
BH1750 Light Sensor Practical notes- Problems and issues: http://community.heltec.cn/t/bh1750-light-sensor-practical-notes-problems-and-issues/1521
BH1750 Ambient Light Sensor Interfacing with Arduino: https://microcontrollerslab.com/bh1750-interfacing-with-arduino-measure-light/
Technical Specs
BH1750 Datasheet: https://www.mouser.com/datasheet/2/348/bh1750fvi-e-186247.pdf