Libelle
Library for the Libelle multi-spectral shortwave pyranometer. More…
#include <Libelle.h>
Inherits from NW_Sensor
Public Types
| Name | |
|---|---|
| enum uint8_t | Component { VEML6075 = 0x01, VEML6030 = 0x02, ADS1115 = 0x04, ADXL343 = 0x08, BRIDGE = 0x07, ALL = 0x0F} Chip groups a reading can cover (the spec’s chip table: 0 VEML6075, 1 VEML6030, 2 ADS1115, 3 ADXL343). |
Public Functions
| Name | |
|---|---|
| Libelle(Orientation orientation =UP) | |
| bool | begin(uint8t ADR =0) Begin communications with the Libelle bridge and its accelerometer. |
| float | getRoll(bool update =false) Roll [deg] of the last updateMeasurements() (mean over its readings); LIBELLE_ERROR when none. |
| float | getPitch(bool update =false) Pitch [deg]. |
| long | getUVA(bool update =false) UVA, compensated counts (rounded mean); LIBELLE_ERROR when none. |
| long | getUVB(bool update =false) UVB, compensated counts. |
| long | getALS(bool update =false) Ambient light, raw VEML6030 counts. |
| long | getWhite(bool update =false) White (broadband), raw VEML6030 counts. |
| float | getLux(bool update =false) Illuminance [lx]: ALS x auto-range multiplier x 0.0036, per reading. |
| float | getIR_Short(bool update =false) Near-IR (short) transimpedance output [V]. |
| float | getIR_Mid(bool update =false) Near-IR (mid) transimpedance output [V]. |
| float | getTemp(bool update =false) Housing temperature [C] from the thermistor (Steinhart-Hart, per reading). |
| String | getHeader() Column names with units, each followed by a comma, suffixed _u (UP) or _d (DOWN): “R_u [deg],P_u [deg],UVA_u,UVB_u,White_u,Vis_u [lx], IR_S_u,IR_M_u,PyroT_u [C],”, with std and sterr columns after a value when its chip group’s statistics are enabled and more than one reading is configured. |
| String | getString() Take a reading of everything (updateMeasurements()) and return the values in getHeader()’s order, LIBELLE_ERROR where a reading failed. |
| bool | updateMeasurements(uint8_t component =ALL) Take the configured number of readings of the selected chips and store them for the getters and the statistics. |
| bool | updateUV() Take ONE reading of the VEML6075 (UVA, UVB) and append it to the readings. |
| bool | updateLight() Take ONE reading of the VEML6030 (ALS, white, lux) and append it. |
| bool | updateIR() Take ONE reading of the ADS1115 (IR short, IR mid, temperature) and append it. |
| bool | updateTilt() Take ONE reading of the ADXL343 (roll, pitch) and append it. |
| uint16_t | setUVReadings(uint16_t n) Set how many VEML6075 readings updateMeasurements() takes (statistics are computed over them). Clamped to LIBELLE_UV_CAPACITY. |
| uint16_t | setLightReadings(uint16_t n) Set how many VEML6030 readings updateMeasurements() takes. Clamped to LIBELLE_LIGHT_CAPACITY. |
| uint16_t | setIRReadings(uint16_t n) Set how many ADS1115 readings updateMeasurements() takes. Clamped to LIBELLE_IR_CAPACITY. |
| uint16_t | setTiltReadings(uint16_t n) Set how many ADXL343 readings updateMeasurements() takes. Clamped to LIBELLE_TILT_CAPACITY. |
| void | setUVStats(bool enable) Enable or disable the UVA and UVB std and sterr columns in getString()/getHeader(). |
| void | setLightStats(bool enable) Enable or disable the white and lux std and sterr columns. |
| void | setIRStats(bool enable) Enable or disable the IR and temperature std and sterr columns. |
| void | setTiltStats(bool enable) Enable or disable the roll and pitch std and sterr columns. |
| uint16_t | getUVCount() Number of valid VEML6075 readings stored by the last updateMeasurements(). |
| uint16_t | getLightCount() Number of valid VEML6030 readings stored. |
| uint16_t | getIRCount() Number of valid ADS1115 readings stored. |
| uint16_t | getTiltCount() Number of valid ADXL343 readings stored. |
| float | getUVAMean() |
| float | getUVAStd() |
| float | getUVASterr() |
| float | getUVAMedian() |
| float | getUVBMean() |
| float | getUVBStd() |
| float | getUVBSterr() |
| float | getUVBMedian() |
| float | getALSMean() |
| float | getALSStd() |
| float | getALSSterr() |
| float | getALSMedian() |
| float | getWhiteMean() |
| float | getWhiteStd() |
| float | getWhiteSterr() |
| float | getWhiteMedian() |
| float | getLuxMean() |
| float | getLuxStd() |
| float | getLuxSterr() |
| float | getLuxMedian() |
| float | getIR_ShortMean() |
| float | getIR_ShortStd() |
| float | getIR_ShortSterr() |
| float | getIR_ShortMedian() |
| float | getIR_MidMean() |
| float | getIR_MidStd() |
| float | getIR_MidSterr() |
| float | getIR_MidMedian() |
| float | getTempMean() |
| float | getTempStd() |
| float | getTempSterr() |
| float | getTempMedian() |
| float | getRollMean() |
| float | getRollStd() |
| float | getRollSterr() |
| float | getRollMedian() |
| float | getPitchMean() |
| float | getPitchStd() |
| float | getPitchSterr() |
| float | getPitchMedian() |
| size_t | printHeader(Print & out) Print the header matching printReading(): column names with units, each followed by a comma, for the chips selected by beginReadings(). No statistics columns: one reading has none. |
| size_t | printReading(Print & out) Print the stored reading of the selected chips, each value followed by a comma, in getString()’s order. Does not acquire: call updateMeasurements() first, or use logReading(). |
| size_t | logReading(Print & out) Take ONE reading of the selected chips and print it: the one-reading primitive for collecting many readings to a file. |
| void | beginReadings(uint8_t component =ALL, uint16_t n =0) Begin a run of readings, selecting which chips they cover. |
| void | endReadings() End a run of readings. |
| bool | faulted(uint8_t chip) True if the given chip (0 VEML6075, 1 VEML6030, 2 ADS1115, 3 ADXL343) was faulted in the last reading. The accelerometer fault is the library’s own on hardware v1. |
| bool | anyFault() True if any chip was faulted in the last reading. |
| uint8_t | reportChip() Chip index of the report (7 the unit); meaningful when reportKind() != 0. |
| uint8_t | reportKind() Kind of the report, per the spec’s table (1 not answering, 2 timed out, 3 checksum failed, 6 restarted since configured, …). |
| size_t | printReport(Print & out) Print the report as text, e.g. “VEML6075: not answering”; “none” when there is no fault. |
| String | reportNote() The report as one word for a note column: “VEML6075NotAnswering”, “UnitRestarted”; “UnitNone” when none. |
| size_t | printStatus(Print & out, bool boot =false) override Print one status line for a logger’s status file: name, serial, versions, the last report, Pages 0-2 in hex; no newline, not answering. |
| const char * | name() const override |
| bool | reportIsFault() override |
| uint8_t | bootReportKind() override |
| void | clearBootReport() override |
| String | beginFailure() Why the last begin() refused, as one word: “NotAnswering”, “NotSchema1”, “WrongName”, “OldFirmware”, “NoAccel”; “None” after success. |
| uint8_t | getHardwareMajor() |
| uint8_t | getHardwareMinor() |
| uint8_t | getFirmwareVersion() |
Public Attributes
| Name | |
|---|---|
| constexpr uint8_t | DEFAULT_ADDRESS_UP Default I2C addresses: NW-Device-Specification Schema 1 ‘L’ (0x4C) facing UP; ‘L’ XOR 0x40 (0x0C) facing DOWN, by the solder jumper. |
| constexpr uint8_t | DEFAULT_ADDRESS_DOWN |
Detailed Description
class Libelle;
Library for the Libelle multi-spectral shortwave pyranometer.
Six spectral bands from UV-B through short-wave infrared, housing temperature, and tilt (roll and pitch) from an onboard accelerometer. The ATtiny841 bridge serves the light and infrared sensors as one Schema 1 register map; on hardware v1 the ADXL343 accelerometer sits on the controller’s I2C bus and the library reads it directly.
Public Types Documentation
enum Component
| Enumerator | Value | Description |
|---|---|---|
| VEML6075 | 0x01 | UVA, UVB. |
| VEML6030 | 0x02 | ambient light, white, lux |
| ADS1115 | 0x04 | IR short, IR mid, thermistor temperature. |
| ADXL343 | 0x08 | roll, pitch (read on the controller bus on hardware v1) |
| BRIDGE | 0x07 | the three chips behind the ATtiny841 |
| ALL | 0x0F |
Chip groups a reading can cover (the spec’s chip table: 0 VEML6075, 1 VEML6030, 2 ADS1115, 3 ADXL343).
Public Functions Documentation
function Libelle
Libelle(
Orientation orientation =UP
)
function begin
bool begin(
uint8_t ADR_ =0
)
Begin communications with the Libelle bridge and its accelerometer.
Parameters:
- ADR_ I2C address of the bridge; 0 (the default) selects DEFAULT_ADDRESS_UP or DEFAULT_ADDRESS_DOWN by the orientation.
Return: True if the bridge passed the three gates and the accelerometer acknowledged.
Refuses the bridge unless Page 0 says Schema 1, the name “Libelle”, and a firmware patch of at least LIBELLE_FW_MIN_PATCH; beginFailure() says which gate refused. Takes no reading.
function getRoll
float getRoll(
bool update =false
)
Roll [deg] of the last updateMeasurements() (mean over its readings); LIBELLE_ERROR when none.
function getPitch
float getPitch(
bool update =false
)
Pitch [deg].
function getUVA
long getUVA(
bool update =false
)
UVA, compensated counts (rounded mean); LIBELLE_ERROR when none.
function getUVB
long getUVB(
bool update =false
)
UVB, compensated counts.
function getALS
long getALS(
bool update =false
)
Ambient light, raw VEML6030 counts.
function getWhite
long getWhite(
bool update =false
)
White (broadband), raw VEML6030 counts.
function getLux
float getLux(
bool update =false
)
Illuminance [lx]: ALS x auto-range multiplier x 0.0036, per reading.
function getIR_Short
float getIR_Short(
bool update =false
)
Near-IR (short) transimpedance output [V].
function getIR_Mid
float getIR_Mid(
bool update =false
)
Near-IR (mid) transimpedance output [V].
function getTemp
float getTemp(
bool update =false
)
Housing temperature [C] from the thermistor (Steinhart-Hart, per reading).
function getHeader
String getHeader()
Column names with units, each followed by a comma, suffixed _u (UP) or _d (DOWN): “R_u [deg],P_u [deg],UVA_u,UVB_u,White_u,Vis_u [lx], IR_S_u,IR_M_u,PyroT_u [C],”, with std and sterr columns after a value when its chip group’s statistics are enabled and more than one reading is configured.
function getString
String getString()
Take a reading of everything (updateMeasurements()) and return the values in getHeader()’s order, LIBELLE_ERROR where a reading failed.
function updateMeasurements
bool updateMeasurements(
uint8_t component =ALL
)
Take the configured number of readings of the selected chips and store them for the getters and the statistics.
Parameters:
- component Libelle::ALL (default) or any OR of the Component bits.
Return: true if every selected chip gave at least one valid reading
Each bridge reading triggers the device and waits for its reading counter to advance (NW-Device-Specification handshake); N > 1 is declared to the device as a batch first. With one reading of all three bridge chips, they are read in a single transaction. The accelerometer is read on the controller bus. The single-value getters return the mean of the readings taken; a chip the device reports faulted leaves its values at LIBELLE_ERROR.
function updateUV
bool updateUV()
Take ONE reading of the VEML6075 (UVA, UVB) and append it to the readings.
function updateLight
bool updateLight()
Take ONE reading of the VEML6030 (ALS, white, lux) and append it.
function updateIR
bool updateIR()
Take ONE reading of the ADS1115 (IR short, IR mid, temperature) and append it.
function updateTilt
bool updateTilt()
Take ONE reading of the ADXL343 (roll, pitch) and append it.
function setUVReadings
uint16_t setUVReadings(
uint16_t n
)
Set how many VEML6075 readings updateMeasurements() takes (statistics are computed over them). Clamped to LIBELLE_UV_CAPACITY.
Return: The number actually set.
function setLightReadings
uint16_t setLightReadings(
uint16_t n
)
Set how many VEML6030 readings updateMeasurements() takes. Clamped to LIBELLE_LIGHT_CAPACITY.
function setIRReadings
uint16_t setIRReadings(
uint16_t n
)
Set how many ADS1115 readings updateMeasurements() takes. Clamped to LIBELLE_IR_CAPACITY.
function setTiltReadings
uint16_t setTiltReadings(
uint16_t n
)
Set how many ADXL343 readings updateMeasurements() takes. Clamped to LIBELLE_TILT_CAPACITY.
function setUVStats
void setUVStats(
bool enable
)
Enable or disable the UVA and UVB std and sterr columns in getString()/getHeader().
function setLightStats
void setLightStats(
bool enable
)
Enable or disable the white and lux std and sterr columns.
function setIRStats
void setIRStats(
bool enable
)
Enable or disable the IR and temperature std and sterr columns.
function setTiltStats
void setTiltStats(
bool enable
)
Enable or disable the roll and pitch std and sterr columns.
function getUVCount
uint16_t getUVCount()
Number of valid VEML6075 readings stored by the last updateMeasurements().
function getLightCount
uint16_t getLightCount()
Number of valid VEML6030 readings stored.
function getIRCount
uint16_t getIRCount()
Number of valid ADS1115 readings stored.
function getTiltCount
uint16_t getTiltCount()
Number of valid ADXL343 readings stored.
function getUVAMean
float getUVAMean()
function getUVAStd
float getUVAStd()
function getUVASterr
float getUVASterr()
function getUVAMedian
float getUVAMedian()
function getUVBMean
float getUVBMean()
function getUVBStd
float getUVBStd()
function getUVBSterr
float getUVBSterr()
function getUVBMedian
float getUVBMedian()
function getALSMean
float getALSMean()
function getALSStd
float getALSStd()
function getALSSterr
float getALSSterr()
function getALSMedian
float getALSMedian()
function getWhiteMean
float getWhiteMean()
function getWhiteStd
float getWhiteStd()
function getWhiteSterr
float getWhiteSterr()
function getWhiteMedian
float getWhiteMedian()
function getLuxMean
float getLuxMean()
function getLuxStd
float getLuxStd()
function getLuxSterr
float getLuxSterr()
function getLuxMedian
float getLuxMedian()
function getIR_ShortMean
float getIR_ShortMean()
function getIR_ShortStd
float getIR_ShortStd()
function getIR_ShortSterr
float getIR_ShortSterr()
function getIR_ShortMedian
float getIR_ShortMedian()
function getIR_MidMean
float getIR_MidMean()
function getIR_MidStd
float getIR_MidStd()
function getIR_MidSterr
float getIR_MidSterr()
function getIR_MidMedian
float getIR_MidMedian()
function getTempMean
float getTempMean()
function getTempStd
float getTempStd()
function getTempSterr
float getTempSterr()
function getTempMedian
float getTempMedian()
function getRollMean
float getRollMean()
function getRollStd
float getRollStd()
function getRollSterr
float getRollSterr()
function getRollMedian
float getRollMedian()
function getPitchMean
float getPitchMean()
function getPitchStd
float getPitchStd()
function getPitchSterr
float getPitchSterr()
function getPitchMedian
float getPitchMedian()
function printHeader
size_t printHeader(
Print & out
)
Print the header matching printReading(): column names with units, each followed by a comma, for the chips selected by beginReadings(). No statistics columns: one reading has none.
Parameters:
- out Any Print destination (SdFat File, Serial, …).
Return: Bytes written.
function printReading
size_t printReading(
Print & out
)
Print the stored reading of the selected chips, each value followed by a comma, in getString()’s order. Does not acquire: call updateMeasurements() first, or use logReading().
Return: Bytes written.
function logReading
size_t logReading(
Print & out
)
Take ONE reading of the selected chips and print it: the one-reading primitive for collecting many readings to a file.
Return: Bytes written.
function beginReadings
void beginReadings(
uint8_t component =ALL,
uint16_t n =0
)
Begin a run of readings, selecting which chips they cover.
Parameters:
- component Libelle::ALL or any OR of the Component bits.
- n How many readings the run will take (the number of logReading() calls to follow); with n > 1 the bridge is told in advance (readings-requested word).
function endReadings
void endReadings()
End a run of readings.
function faulted
bool faulted(
uint8_t chip
)
True if the given chip (0 VEML6075, 1 VEML6030, 2 ADS1115, 3 ADXL343) was faulted in the last reading. The accelerometer fault is the library’s own on hardware v1.
function anyFault
bool anyFault()
True if any chip was faulted in the last reading.
function reportChip
uint8_t reportChip()
Chip index of the report (7 the unit); meaningful when reportKind() != 0.
function reportKind
uint8_t reportKind()
Kind of the report, per the spec’s table (1 not answering, 2 timed out, 3 checksum failed, 6 restarted since configured, …).
function printReport
size_t printReport(
Print & out
)
Print the report as text, e.g. “VEML6075: not answering”; “none” when there is no fault.
function reportNote
String reportNote()
The report as one word for a note column: “VEML6075NotAnswering”, “UnitRestarted”; “UnitNone” when none.
function printStatus
size_t printStatus(
Print & out,
bool boot =false
) override
Print one status line for a logger’s status file: name, serial, versions, the last report, Pages 0-2 in hex; no newline, not answering.
function name
inline const char * name() const override
function reportIsFault
bool reportIsFault() override
function bootReportKind
uint8_t bootReportKind() override
function clearBootReport
void clearBootReport() override
function beginFailure
String beginFailure()
Why the last begin() refused, as one word: “NotAnswering”, “NotSchema1”, “WrongName”, “OldFirmware”, “NoAccel”; “None” after success.
function getHardwareMajor
uint8_t getHardwareMajor()
function getHardwareMinor
uint8_t getHardwareMinor()
function getFirmwareVersion
uint8_t getFirmwareVersion()
Public Attributes Documentation
variable DEFAULT_ADDRESS_UP
static constexpr uint8_t DEFAULT_ADDRESS_UP = 0x4C;
Default I2C addresses: NW-Device-Specification Schema 1 ‘L’ (0x4C) facing UP; ‘L’ XOR 0x40 (0x0C) facing DOWN, by the solder jumper.
variable DEFAULT_ADDRESS_DOWN
static constexpr uint8_t DEFAULT_ADDRESS_DOWN = 0x0C;
Updated on 2026-09-23 at 22:43:23 +0000