API Reference
adafruit_ltr390
Adafruit CircuitPython library for the LTR390
Author(s): Bryan Siepert
Implementation Notes
Hardware:
Adafruit Adafruit LTR390 UV Light Sensor (Product ID: 4831)
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
Adafruit’s Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
- class adafruit_ltr390.Gain
Options for
gainGain
Raw Measurement Multiplier
Gain.GAIN_1X1
Gain.GAIN_3X3
Gain.GAIN_6X6
Gain.GAIN_9X9
Gain.GAIN_18X18
- class adafruit_ltr390.LTR390(i2c: I2C, address: int = 83)
Class to use the LTR390 Ambient Light and UV sensor
- Parameters:
Quickstart: Importing and using the LTR390
Here is an example of using the
LTR390class. First you will need to import the libraries to use the sensorimport board import adafruit_ltr390
Once this is done you can define your
board.I2Cobject and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA ltr = adafruit_ltr390.LTR390(i2c)
Now you have access to the
luxandlightattributeslux = ltr.lux light = ltr.light
- data_ready
Ask the sensor if new data is available
- enable_alerts(enable: bool, source: bool, persistance: int) None
The configuration of alerts raised by the sensor
- Parameters:
enable – Whether the interrupt output is enabled
source – Whether to use the ALS or UVS data register to compare
persistance – The number of consecutive out-of-range readings before
- high_threshold
When the measured value is more than the low_threshold, the sensor will raise an alert
- initialize() None
Reset the sensor to it’s initial unconfigured state and configure it with sensible defaults so it can be used
- low_threshold
When the measured value is less than the low_threshold, the sensor will raise an alert
- property measurement_delay: int
The delay between measurements. This can be used to set the measurement rate which affects the sensor power usage.
- threshold_passed
The status of any configured alert. If True, a threshold has been passed.
Once read, this property will be False until it is updated in the next measurement cycle
- class adafruit_ltr390.MeasurementDelay
Options for
measurement_delayMeasurementDelay
Time Between Measurement Cycles (ms)
MeasurementDelay.DELAY_25MS25
MeasurementDelay.DELAY_50MS50
MeasurementDelay.DELAY_100MS100
MeasurementDelay.DELAY_200MS200
MeasurementDelay.DELAY_500MS500
MeasurementDelay.DELAY_1000MS1000
MeasurementDelay.DELAY_2000MS2000
- class adafruit_ltr390.Resolution
Options for
resolutionResolution
Internal ADC Resolution
Resolution.RESOLUTION_13BIT13 bits
Resolution.RESOLUTION_16BIT16 bits
Resolution.RESOLUTION_17BIT17 bits
Resolution.RESOLUTION_18BIT18 bits
Resolution.RESOLUTION_19BIT19 bits
Resolution.RESOLUTION_20BIT20 bits