Documentation ¶
Overview ¶
Package veml6070 provides a driver for the VEML6070 digital UV light sensor by Vishay.
Datasheet: https://www.vishay.com/docs/84277/veml6070.pdf Application Notes: https://www.vishay.com/docs/84310/designingveml6070.pdf
Index ¶
Constants ¶
const ( ADDR_L = 0x38 // 7bit address of the VEML6070 (write, read) ADDR_H = 0x39 // 7bit address of the VEML6070 (read) )
const ( RSET_240K = 240000 RSET_270K = 270000 RSET_300K = 300000 RSET_600K = 600000 )
Some possible values for resistance value (in ohm) of VEML6070 calibration resistor
const ( IT_HALF = 0x00 IT_1 = 0x04 IT_2 = 0x08 IT_4 = 0x0C )
Possible values for integration time of VEML6070 (internally represents the config register bit mask)
const ( UVI_RISK_LOW = iota UVI_RISK_MODERATE UVI_RISK_HIGH UVI_RISK_VERY_HIGH UVI_RISK_EXTREME )
Possible values for UVI (UV index) risk level estimations - the VEML6070 can only estimate UVI risk levels since it can only sense UVA rays but the vendor tried to come up with some coarse thresholds, from application notes
const ( CONFIG_SD_DISABLE = 0x00 CONFIG_SD_ENABLE = 0x01 )
Possible values for shutdown
const ( CONFIG_DEFAULTS = 0x02 CONFIG_ENABLE = CONFIG_SD_DISABLE | CONFIG_DEFAULTS CONFIG_DISABLE = CONFIG_SD_ENABLE | CONFIG_DEFAULTS )
Enable / disable
const NORMALIZED_REFRESHTIME = 100.0
The refresh time in milliseconds for which NORMALIZED_UVA_SENSITIVITY is applicable to a step count
const NORMALIZED_UVA_SENSITIVITY = 50.0
The UVA sensitivity in mW/(m*m)/step which is applicable to a step count normalized to the NORMALIZED_REFRESHTIME, from datasheet for RSET=240 kOhm and IT_FACTOR=1
const RSET_TO_REFRESHTIME_SCALE = 100.0 / RSET_240K
Scale factor in milliseconds / ohm to determine refresh time (aka sampling time) without IT_FACTOR for any given RSET, from datasheet. Note: 100.0 milliseconds are applicable for RSET=240 kOhm and IT_FACTOR=1
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct { AddressLow uint16 AddressHigh uint16 RSET uint32 IT uint8 // contains filtered or unexported fields }
Device wraps an I2C connection to a VEML6070 device.
func New ¶
New creates a new VEML6070 connection. The I2C bus must already be configured.
This function only creates the Device object, it does not initialize the device. You must call Configure() first in order to use the device itself.
func (*Device) GetEstimatedRiskLevel ¶
GetEstimatedRiskLevel returns estimated risk level from comparing UVA light intensity values in mW/(m*m) with thresholds calculated from application notes
func (*Device) ReadUVALightIntensity ¶
ReadUVALightIntensity returns the UVA light intensity (irradiance) in milli Watt per square meter (mW/(m*m))