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
gain
Gain
Raw Measurement Multiplier
Gain.GAIN_1X
1
Gain.GAIN_3X
3
Gain.GAIN_6X
6
Gain.GAIN_9X
9
Gain.GAIN_18X
18
- 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
LTR390
class. 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.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA ltr = adafruit_ltr390.LTR390(i2c)
Now you have access to the
lux
andlight
attributeslux = 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_delay
MeasurementDelay
Time Between Measurement Cycles (ms)
MeasurementDelay.DELAY_25MS
25
MeasurementDelay.DELAY_50MS
50
MeasurementDelay.DELAY_100MS
100
MeasurementDelay.DELAY_200MS
200
MeasurementDelay.DELAY_500MS
500
MeasurementDelay.DELAY_1000MS
1000
MeasurementDelay.DELAY_2000MS
2000
- class adafruit_ltr390.Resolution¶
Options for
resolution
Resolution
Internal ADC Resolution
Resolution.RESOLUTION_13BIT
13 bits
Resolution.RESOLUTION_16BIT
16 bits
Resolution.RESOLUTION_17BIT
17 bits
Resolution.RESOLUTION_18BIT
18 bits
Resolution.RESOLUTION_19BIT
19 bits
Resolution.RESOLUTION_20BIT
20 bits