API Reference

adafruit_max44009

  • Author(s): Tim Cocks

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_max44009.CV

Constant-value helper for enum-like classes.

classmethod get_name(value: int) str

Return the attribute name for value.

classmethod is_valid(value: int) bool

Return True if value is a member of this CV class.

class adafruit_max44009.IntegrationTime

Integration time settings for TIM bits [2:0] of CONFIG register.

In automatic mode (MANUAL=0), only the first four values (800ms-100ms) are available. The shorter integration times (50ms-6.25ms) require manual mode to be enabled.

Setting

Time

Notes

IntegrationTime.MS_800

800 ms

Best low-light sensitivity

IntegrationTime.MS_400

400 ms

IntegrationTime.MS_200

200 ms

IntegrationTime.MS_100

100 ms

Default, best high-bright

IntegrationTime.MS_50

50 ms

Manual mode only

IntegrationTime.MS_25

25 ms

Manual mode only

IntegrationTime.MS_12_5

12.5 ms

Manual mode only

IntegrationTime.MS_6_25

6.25 ms

Manual mode only

class adafruit_max44009.MAX44009(i2c_bus: I2C, address: int = _MAX44009_DEFAULT_ADDRESS)

CircuitPython driver for the MAX44009 ambient light sensor.

Parameters:
  • i2c_bus (I2C) – The I2C bus the device is connected to.

  • address (int) – The I2C device address. Defaults to 0x4A.

current_division_ratio

Current division ratio. When True, only 1/8 of photodiode current is used, extending measurement range for very bright conditions.

property integration_time: int

The integration time. Must be an IntegrationTime value.

Integration times shorter than 100ms require manual mode to be enabled.

interrupt_enabled

Enable or disable the interrupt. True to enable.

interrupt_status

True if an interrupt event occurred. Reading clears the interrupt.

property lower_threshold: float

Lower lux threshold for interrupt generation.

property lux: float

Read the lux value with full 12-bit resolution.

Returns NaN if the sensor is in an overrange condition (exponent = 0x0F). Check overrange after reading to detect saturation.

property mode: int

The operating mode. Must be a Mode value.

property overrange: bool

True if the last lux reading was an overrange condition.

threshold_timer

Threshold persist timer value (0-255). The interrupt triggers only if lux stays outside the threshold window for (value * 100ms).

property upper_threshold: float

Upper lux threshold for interrupt generation.

class adafruit_max44009.Mode

Operating mode settings for CONT (bit 7) and MANUAL (bit 6) of CONFIG.

Setting

CONT

MANUAL

Description

Mode.DEFAULT

0

0

Auto, 800ms cycle

Mode.CONTINUOUS

1

0

Auto, fast updates

Mode.MANUAL

0

1

Manual, 800ms cycle

Mode.MANUAL_CONTINUOUS

1

1

Manual, fast