CircuitPython library for use with the Adafruit BH1750 breakout

  • Author(s): Bryan Siepert

Implementation Notes


Software and Dependencies:

class adafruit_bh1750.BH1750(i2c_bus, address=35)

Library for the BH1750 Sensor

  • i2c_bus (I2C) – The I2C bus the BH1750 is connected to.
  • address – The I2C slave address of the sensor. Defaults to 0x23. Can be set to 0x5C by pulling the address pin high.

Configure the sensors with the default settings.


Light value in lux.

This example prints the light data in lux. Cover the sensor to see the values change.

import time
import board
import busio
import adafruit_bh1750

i2c = busio.I2C(board.SCL, board.SDA)
sensor = adafruit_bh1750.BH1750(i2c)

while True:
    print("Lux:", sensor.lux)
class adafruit_bh1750.CV

struct helper

classmethod add_values(value_tuples)

Add CV values to the class

classmethod is_valid(value)

Validate that a given value is a member

class adafruit_bh1750.Mode

Options for mode

class adafruit_bh1750.RWBitfields(num_bits, lowest_bit)

A class to do bitwise operations to get and set a range of bits within a byte but gets and sets the full byte value from the _settings attribute of the calling object.

Values are int between 0 and 2**num_bits - 1

  • num_bits (int) – The number of bits in the field.
  • lowest_bit (type) – The lowest bits index within the byte at register_address
class adafruit_bh1750.Resolution

Options for resolution