adafruit_bh1750

CircuitPython library for use with the Adafruit BH1750 breakout

  • Author(s): Bryan Siepert

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_bh1750.BH1750(i2c_bus, address=35)

Library for the BH1750 Sensor

Parameters:
  • i2c_bus (I2C) – The I2C bus the BH1750 is connected to.
  • address (int) – The I2C device address. Defaults to 0x23.Can be set to 0x5C by pulling the address pin high.

Quickstart: Importing and using the BH1750

Here is an example of using the BH1750 class. First you will need to import the libraries to use the sensor

import board
import adafruit_bh1750

Once this is done you can define your board.I2C object and define your sensor object

i2c = board.I2C()  # uses board.SCL and board.SDA
sensor = adafruit_bh1750.BH1750(i2c)

Now you have access to the lux value in lux

lux = sensor.lux
initialize()

Configure the sensors with the default settings.

lux

Light value in lux.