GY-63_MS5611/libraries/TSL260R
2022-11-27 20:26:03 +01:00
..
.github 0.1.1 TSL260R 2022-11-27 20:26:03 +01:00
examples 0.1.1 TSL260R 2022-11-27 20:26:03 +01:00
test 0.1.1 TSL260R 2022-11-27 20:26:03 +01:00
.arduino-ci.yml 0.1.1 TSL260R 2022-11-27 20:26:03 +01:00
CHANGELOG.md 0.1.1 TSL260R 2022-11-27 20:26:03 +01:00
keywords.txt 0.1.1 TSL260R 2022-11-27 20:26:03 +01:00
library.json 0.1.1 TSL260R 2022-11-27 20:26:03 +01:00
library.properties 0.1.1 TSL260R 2022-11-27 20:26:03 +01:00
LICENSE 0.1.1 TSL260R 2022-11-27 20:26:03 +01:00
README.md 0.1.1 TSL260R 2022-11-27 20:26:03 +01:00
TSL260R .cpp 0.1.1 TSL260R 2022-11-27 20:26:03 +01:00
TSL260R.h 0.1.1 TSL260R 2022-11-27 20:26:03 +01:00

Arduino CI Arduino-lint JSON check License: MIT GitHub release

TSL260R

Arduino library for the TSL260R IR to voltage convertor

Description

The TSL260R (TSL261R, TSL262R) is a IR sensor that outputs a voltage depending on the irradiation.

This library does convert the output voltage to uW/cm2.

As the sensors differ by sensitivity the library has three distinct classes. The table below is an approximation for the max irradiation at 3.3 Volt (output). For an Arduino UNO 3.3 V is about 650 ADC steps. When using e.g. an external 16 bit ADS1115, one definitely has far more steps.

Type max uW/cm2
TSL260R 30
TSL261R 70
TSL262R 125

Warning this library is experimental so you should use it with care. It is written on the datasheet, and I have no hardware yet to test it. Of course I am very interested in your experiences and feedback to improve the library.

Hardware Connection

Always check datasheet

//  Front view 
//
//  PIN 1 - GND
//  PIN 2 - VDD      2.7 V .. 5.5 V
//  PIN 3 - SIGNAL   voltage out

Interface

using internal ADC

  • TSL260R(uint8_t pin, uint16_t maxADC, float voltage) Constructor when using an internal ADC and just one sample to measure the output voltage of the sensor.
    • pin = analogRead() pin
    • maxADC = max value of the internal ADC, UNO = 1023.
    • voltage = max voltage of the internal ADC.
  • TSL261R(uint8_t pin, uint16_t maxADC, float voltage) idem for TSL261R.
  • TSL262R(uint8_t pin, uint16_t maxADC, float voltage) idem for TSL262R.
  • float irradiance() returns the irradiance in uW/cm2. Uses the analogRead() of the internal ADC. Fails by returning 0 when object is created with the other constructor.

using external ADC

  • TSL260R() constructor when using an external ADC or more than one internal samples to measure the voltage. When using this constructor one cannot use the parameterless irradiance(), see above.
  • TSL261R() idem for TSL261R.
  • TSL262R() idem for TSL262R.
  • float irradiance(float voltage) returns the irradiance in uW/cm2 based upon voltage parameter. Does not use an internal analogRead(). Note the user can average 8 internal ADC measurements to reduce noise and then use this function based upon the average voltage.

WaveLength

  • void setWaveLength(uint16_t waveLength = 940) sets the wave length so the conversion can use a correction factor. At 900 - 940 nm the wave length correction factor == 1.0. Wave length should be between 830 and 1100.
  • uint16_t getWaveLength() returns the configured wave length.
  • float getWaveLengthFactor() returns the wave length correction factor. Note the sensor is most sensitive around 940 nm. See datasheet.
  • calculateWaveLengthFactor(uint16_t waveLength) calculates the factor to compensate for less sensitivity at other wave lengths. E.g. if the sensor is 0.5 x as sensitive at a given wave length the factor should be 2.

Calibration

To elaborate.

Operations

See examples.

Future

must

  • improve documentation
  • buy hardware (where)
  • test test test test
  • calibration
    • getters/setters for A and B to calibrate the sensor.

should

  • extend unit tests
  • write examples
  • fix the dependency of irradiance()
    • derived class?
  • optimize code.

could

  • test with different IR LEDS (e.g. remote)
  • Normalized Output Voltage vs Angular Displacement correction
    • figure 11
  • temperature correction