GY-63_MS5611/libraries/LTR390_DFR/README.md
2024-05-09 18:25:55 +02:00

3.9 KiB

Arduino CI Arduino-lint JSON check GitHub issues

License: MIT GitHub release PlatformIO Registry

LTR390_DFR

Arduino library for the I2C LTR390 UV sensor (DF Robotics edition).

Description

Experimental

This library is to read the LTR390 UV sensor on the DF Robotics break-out board.

Operating voltage range: 3.0V .. 5.0V (tolerant).

I2C

The break-out has an address of 0x1C == 28 decimal.

I2C Speed

The device should work on 100 kHz and 400 kHz I2C bus.

To be tested.

Multiplexing

Sometimes you need to control more devices than possible with the default address range the device provides. This is possible with an I2C multiplexer e.g. TCA9548 which creates up to eight channels (think of it as I2C subnets) which can use the complete address range of the device.

Drawback of using a multiplexer is that it takes more administration in your code e.g. which device is on which channel. This will slow down the access, which must be taken into account when deciding which devices are on which channel. Also note that switching between channels will slow down other devices too if they are behind the multiplexer.

Interface TODO elaborate...

#include "LTR390_DFR.h"

Constructor

  • LTR390_DFR(TwoWire * wire = &Wire) Constructor with optional Wire interface.
  • bool begin() returns true if device 0x1C can be seen on the I2C bus.
  • bool isConnected() returns true if device 0x1C can be seen on I2C bus.
  • uint8_t getAddress() returns 0x1C, fixed address, for convenience.

Main control

  • void setALSMode()
  • void setUVSMode()
  • void reset() blocks for 100 ms.

Measurement configuration

  • void setGain(uint8_t gain) gain = 0..4,
  • uint8_t getGain() returns set value.
  • void setMeasurement(uint8_t resolution, uint8_t time)
  • uint8_t getResolution()
  • uint8_t getTime()

Part and revision ID

  • uint8_t getPartID() returns 11.
  • uint8_t getRevisionID() returns 2.

Get data

  • uint32_t getALSData()
  • float getLUX(float wfac = 1) wfac = window factor,
  • uint32_t getUVSData()
  • float getUVI(float wfac = 1) wfac = window factor,

Future

Must

  • Elaborate and improve documentation a lot.
    • add tables, ranges etc.
  • test with right hardware.
  • keep in sync with LTR390_RT when possible

Should

  • add examples
  • fix / elaborate TODO's in code.
    • status and error codes
    • interrupts and thresholds
  • add setUVsensitivity()

Could

  • add error handling
  • unit test ==> test examples

Wont

Support

If you appreciate my libraries, you can support the development and maintenance. Improve the quality of the libraries by providing issues and Pull Requests, or donate through PayPal or GitHub sponsors.

Thank you,