Skip to content

Commit 310a5ff

Browse files
committed
0.1.1 TSL260R
1 parent 9cbf8c5 commit 310a5ff

File tree

19 files changed

+895
-0
lines changed

19 files changed

+895
-0
lines changed

libraries/TSL260R/.arduino-ci.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
platforms:
2+
rpipico:
3+
board: rp2040:rp2040:rpipico
4+
package: rp2040:rp2040
5+
gcc:
6+
features:
7+
defines:
8+
- ARDUINO_ARCH_RP2040
9+
warnings:
10+
flags:
11+
12+
packages:
13+
rp2040:rp2040:
14+
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
15+
16+
compile:
17+
# Choosing to run compilation tests on 2 different Arduino platforms
18+
platforms:
19+
- uno
20+
# - due
21+
# - zero
22+
# - leonardo
23+
- m4
24+
- esp32
25+
- esp8266
26+
# - mega2560
27+
- rpipico

libraries/TSL260R/.github/FUNDING.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# These are supported funding model platforms
2+
3+
github: RobTillaart
4+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
name: Arduino-lint
3+
4+
on: [push, pull_request]
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- uses: arduino/arduino-lint-action@v1
11+
with:
12+
library-manager: update
13+
compliance: strict
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Arduino CI
3+
4+
on: [push, pull_request]
5+
6+
jobs:
7+
runTest:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: ruby/setup-ruby@v1
13+
with:
14+
ruby-version: 2.6
15+
- run: |
16+
gem install arduino_ci
17+
arduino_ci.rb
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: JSON check
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.json'
7+
pull_request:
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: json-syntax-check
15+
uses: limitusus/json-syntax-check@v1
16+
with:
17+
pattern: "\\.json$"
18+

libraries/TSL260R/CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Change Log TSL260R
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](http://keepachangelog.com/)
6+
and this project adheres to [Semantic Versioning](http://semver.org/).
7+
8+
9+
## [0.1.1] - 2022-11-27
10+
- update documentation
11+
- add analogRead Constructor
12+
- add irradiance() for internal analogRead()
13+
- fix camelCase WaveLength
14+
- update unit tests.
15+
- add extra example.
16+
- add keywords.txt
17+
18+
19+
## [0.1.0] - 2022-11-25
20+
- initial version - written on datasheet only
21+
Need to buy hardware for testing.
22+

libraries/TSL260R/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022-2022 Rob Tillaart
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

libraries/TSL260R/README.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
2+
[![Arduino CI](https://github.com/RobTillaart/TSL260R/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
3+
[![Arduino-lint](https://github.com/RobTillaart/TSL260R/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/TSL260R/actions/workflows/arduino-lint.yml)
4+
[![JSON check](https://github.com/RobTillaart/TSL260R/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/TSL260R/actions/workflows/jsoncheck.yml)
5+
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/TSL260R/blob/master/LICENSE)
6+
[![GitHub release](https://img.shields.io/github/release/RobTillaart/TSL260R.svg?maxAge=3600)](https://github.com/RobTillaart/TSL260R/releases)
7+
8+
9+
# TSL260R
10+
11+
Arduino library for the TSL260R IR to voltage convertor
12+
13+
14+
## Description
15+
16+
The TSL260R (TSL261R, TSL262R) is a IR sensor that outputs a voltage depending on the irradiation.
17+
18+
This library does convert the output voltage to uW/cm2.
19+
20+
As the sensors differ by sensitivity the library has three distinct classes.
21+
The table below is an approximation for the max irradiation at 3.3 Volt (output).
22+
For an Arduino UNO 3.3 V is about 650 ADC steps.
23+
When using e.g. an external 16 bit ADS1115, one definitely has far more steps.
24+
25+
| Type | max uW/cm2 |
26+
|:---------:|:------------:|
27+
| TSL260R | 30 |
28+
| TSL261R | 70 |
29+
| TSL262R | 125 |
30+
31+
32+
**Warning** this library is experimental so you should use it with care.
33+
It is written on the datasheet, and I have no hardware yet to test it.
34+
Of course I am very interested in your experiences and feedback to improve
35+
the library.
36+
37+
38+
39+
## Hardware Connection
40+
41+
Always check datasheet
42+
43+
```
44+
// Front view
45+
//
46+
// PIN 1 - GND
47+
// PIN 2 - VDD 2.7 V .. 5.5 V
48+
// PIN 3 - SIGNAL voltage out
49+
```
50+
51+
52+
## Interface
53+
54+
#### using internal ADC
55+
56+
- **TSL260R(uint8_t pin, uint16_t maxADC, float voltage)** Constructor when using an
57+
internal ADC and just one sample to measure the output voltage of the sensor.
58+
- pin = analogRead() pin
59+
- maxADC = max value of the internal ADC, UNO = 1023.
60+
- voltage = max voltage of the internal ADC.
61+
- **TSL261R(uint8_t pin, uint16_t maxADC, float voltage)** idem for TSL261R.
62+
- **TSL262R(uint8_t pin, uint16_t maxADC, float voltage)** idem for TSL262R.
63+
- **float irradiance()** returns the irradiance in uW/cm2.
64+
Uses the analogRead() of the internal ADC.
65+
**Fails** by returning 0 when object is created with the other constructor.
66+
67+
68+
#### using external ADC
69+
70+
- **TSL260R()** constructor when using an external ADC or more than one internal samples
71+
to measure the voltage.
72+
When using this constructor one cannot use the parameterless **irradiance()**, see above.
73+
- **TSL261R()** idem for TSL261R.
74+
- **TSL262R()** idem for TSL262R.
75+
- **float irradiance(float voltage)** returns the irradiance in uW/cm2 based upon voltage
76+
parameter. Does not use an internal analogRead().
77+
Note the user can average 8 internal ADC measurements to reduce noise and then use
78+
this function based upon the average voltage.
79+
80+
81+
#### WaveLength
82+
83+
- **void setWaveLength(uint16_t waveLength = 940)** sets the wave length so the conversion
84+
can use a correction factor.
85+
At 900 - 940 nm the wave length correction factor == 1.0.
86+
Wave length should be between 830 and 1100.
87+
- **uint16_t getWaveLength()** returns the configured wave length.
88+
- **float getWaveLengthFactor()** returns the wave length correction factor.
89+
Note the sensor is most sensitive around 940 nm. See datasheet.
90+
- **calculateWaveLengthFactor(uint16_t waveLength)** calculates the factor to compensate
91+
for less sensitivity at other wave lengths.
92+
E.g. if the sensor is 0.5 x as sensitive at a given wave length the factor should be 2.
93+
94+
95+
#### Calibration
96+
97+
To elaborate.
98+
99+
100+
## Operations
101+
102+
See examples.
103+
104+
105+
## Future
106+
107+
#### must
108+
- improve documentation
109+
- buy hardware (where)
110+
- test test test test
111+
- calibration
112+
- getters/setters for A and B to calibrate the sensor.
113+
114+
#### should
115+
- extend unit tests
116+
- write examples
117+
- fix the dependency of **irradiance()**
118+
- derived class?
119+
- optimize code.
120+
121+
#### could
122+
- test with different IR LEDS (e.g. remote)
123+
- Normalized Output Voltage vs Angular Displacement correction
124+
- figure 11
125+
- temperature correction
126+
-
127+

0 commit comments

Comments
 (0)