Enfield Cat's Blog: Arduino and other projects.
This device measure light in standard lux or foot-candela units. With a default opacity setting this sensor measures a range of 0.11lx to 100000lx.
Adding one or more bh1750 to either i2c busses will allow the bh1750(s) to be autodetected and configured on reboot. The minimum configuration is to simply added the sensor and restart the esp32. The configuration of the I2C bus is discussed elsewhere on this page. Each bh1750 should have unique address on the bus on which it is located. The bh1750 devices are numbered 0 to 3, starting with units on bus 0 then bus one. On each bus the number allocation is in device address sequence.
This numbering is important if for example there is one bh1750 on bus 1, and then later another is added to bus 0. After the addition the new device will be unit 0, and the old one unit 1. Conversely if the existing device were on bus 0, and a new one added to bus 2, the old device remains unit 0, and the new one becomes unit 1.
Configuration commands are:
critical|extreme|warning <devicetype> <0-3> lux disable critical|extreme|warning bh1750 <0-3> lux <rpn-expression> enable or disable alerting thresholds on sensors devicename bh1750 <0-3> <device-name> Name a sensor device i2c [<0-1> <sda> <scl> [speed]] Set i2c pins, eg: 21 and 22 for bus-0, and 5 and 4 for bus-1 interval bh1750 <1-300> Set the interval between measurements taken by the sensor. opacity [bh1750 <0-3> <factor>] Set the opacity of light sensor cover, uncovered sensor is typically 1.2 Permissible factor range is 0.5 - 1.5 rpn variables: bh1750.dev - Count of bh1750 sensors (DEVice count) bh1750.lux - 5 minute average of lx readings bh1750.lasl - most recently read lx reading bh1750.opac - Opacity setting bh1750.lsta - lux Ok, warn, critical or extreme status
Note: An opacity setting of 1 assumes there is an opaque window / bubble covering the unit allowing approx 80% of light through. An uncovered / exposed sensor would have an opacity of 1.2 as it allows more light to reach the sensor.
Thank you for visiting camelthorn.cloud | Home |