0.1.10 ML8511

This commit is contained in:
rob tillaart 2023-02-18 20:42:39 +01:00
parent 22da7b20e9
commit 0735e8671c
12 changed files with 58 additions and 29 deletions

View File

@ -6,7 +6,7 @@ jobs:
lint: lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: arduino/arduino-lint-action@v1 - uses: arduino/arduino-lint-action@v1
with: with:
library-manager: update library-manager: update

View File

@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1 - uses: ruby/setup-ruby@v1
with: with:
ruby-version: 2.6 ruby-version: 2.6

View File

@ -10,7 +10,7 @@ jobs:
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: json-syntax-check - name: json-syntax-check
uses: limitusus/json-syntax-check@v1 uses: limitusus/json-syntax-check@v1
with: with:

View File

@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/). and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.1.10] - 2023-02-18
- update readme.md
- update GitHub actions
- update license 2023
- minor edits
## [0.1.9] - 2022-11-17 ## [0.1.9] - 2022-11-17
- add RP2040 in build-CI - add RP2040 in build-CI
- add changelog.md - add changelog.md
@ -13,7 +20,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- edit readme.md - edit readme.md
- minor edits - minor edits
## [0.1.8] - 2021-12-21 ## [0.1.8] - 2021-12-21
- update library.json - update library.json
- update license - update license
@ -23,7 +29,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- update Arduino-CI, badges - update Arduino-CI, badges
- add voltage2mW() for external ADC - add voltage2mW() for external ADC
## [0.1.6] - 2021-06-19 ## [0.1.6] - 2021-06-19
- add get/setDUVfactor() - add get/setDUVfactor()
- rewrite estimateDUVindex() - rewrite estimateDUVindex()

View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2020-2022 Rob Tillaart Copyright (c) 2020-2023 Rob Tillaart
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,8 +1,10 @@
// //
// FILE: ML8511.cpp // FILE: ML8511.cpp
// AUTHOR: Rob.Tillaart@gmail.com // AUTHOR: Rob Tillaart
// VERSION: 0.1.9 // VERSION: 0.1.10
// DATE: 2020-02-03
// PURPOSE: ML8511 - UV sensor - library for Arduino // PURPOSE: ML8511 - UV sensor - library for Arduino
// URL: https://github.com/RobTillaart/ML8511
#include "ML8511.h" #include "ML8511.h"

View File

@ -2,7 +2,8 @@
// //
// FILE: ML8511.h // FILE: ML8511.h
// AUTHOR: Rob Tillaart // AUTHOR: Rob Tillaart
// VERSION: 0.1.9 // VERSION: 0.1.10
// DATE: 2020-02-03
// PURPOSE: ML8511 - UV sensor - library for Arduino // PURPOSE: ML8511 - UV sensor - library for Arduino
// URL: https://github.com/RobTillaart/ML8511 // URL: https://github.com/RobTillaart/ML8511
// //
@ -22,7 +23,7 @@
#include <Arduino.h> #include <Arduino.h>
#define ML8511_LIB_VERSION (F("0.1.9")) #define ML8511_LIB_VERSION (F("0.1.10"))
class ML8511 class ML8511

View File

@ -6,6 +6,7 @@ ML8511 KEYWORD1
# Methods and Functions (KEYWORD2) # Methods and Functions (KEYWORD2)
reset KEYWORD2 reset KEYWORD2
getUV KEYWORD2 getUV KEYWORD2
voltage2mW KEYWORD2 voltage2mW KEYWORD2
setVoltsPerStep KEYWORD2 setVoltsPerStep KEYWORD2

View File

@ -15,7 +15,7 @@
"type": "git", "type": "git",
"url": "https://github.com/RobTillaart/ML8511.git" "url": "https://github.com/RobTillaart/ML8511.git"
}, },
"version": "0.1.9", "version": "0.1.10",
"license": "MIT", "license": "MIT",
"frameworks": "arduino", "frameworks": "arduino",
"platforms": "*", "platforms": "*",

View File

@ -1,5 +1,5 @@
name=ML8511 name=ML8511
version=0.1.9 version=0.1.10
author=Rob Tillaart <rob.tillaart@gmail.com> author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com> maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=ML8511 - UV sensor - library for Arduino sentence=ML8511 - UV sensor - library for Arduino

View File

@ -28,6 +28,14 @@ ML8511 - UV sensor - library for Arduino UNO.
- do not forget to connect the EN to either an enablePIN or to 3V3 (constantly enabled). - do not forget to connect the EN to either an enablePIN or to 3V3 (constantly enabled).
#### Related
- https://github.com/RobTillaart/TSL235R pulse based irradiance variant.
- https://github.com/RobTillaart/TSL260R analog IR irradiance variant.
- https://github.com/RobTillaart/AnalogUVSensor
- https://github.com/RobTillaart/ML8511 UV sensor
#### Breakout #### Breakout
``` ```
@ -47,7 +55,7 @@ As the sensor / breakout is 3V3 one need to connect to Arduino 3V3.
The library converts the **analogRead()** to voltages, and it uses a The library converts the **analogRead()** to voltages, and it uses a
reference of 5.0 Volt == 1023 steps as default. reference of 5.0 Volt == 1023 steps as default.
If one wants to use other ratio e.g. 3.3 volts == 4095 steps, one If one wants to use another ratio e.g. 3.3 volts == 4095 steps, one
can set those with **setVoltagePerStep()**. can set those with **setVoltagePerStep()**.
```cpp ```cpp
@ -66,11 +74,21 @@ Use a voltage divider (10K + 20K) to convert the 5 Volts to ~3.3 Volts.
## Interface ## Interface
```cpp
#include "ML8511.h"
```
#### Constructor
- **ML8511(uint8_t analogPin, uint8_t enablePin = 0xFF)** Constructor, - **ML8511(uint8_t analogPin, uint8_t enablePin = 0xFF)** Constructor,
if enable is connected to 3V3 constantly one does not need to set the enablePin parameter. if enable is connected to 3V3 constantly one does not need to set the enablePin parameter.
#### Core
- **float getUV(uint8_t energyMode = HIGH)** returns mW per cm2, energyMode = HIGH or LOW. - **float getUV(uint8_t energyMode = HIGH)** returns mW per cm2, energyMode = HIGH or LOW.
LOW will disable the sensor after reading. LOW will disable the sensor after each read.
- **float voltage2mW(float voltage)** returns mW per cm2 from voltage. To be used when one uses an external ADC e.g. ADS1115 - **float voltage2mW(float voltage)** returns mW per cm2 from voltage.
To be used when one uses an external ADC e.g. ADS1115
- **void setVoltsPerStep(float voltage, uint32_t steps)** to calibrate the **internal** ADC used. - **void setVoltsPerStep(float voltage, uint32_t steps)** to calibrate the **internal** ADC used.
Voltage must be > 0 otherwise it is not set and the default of 5 volts 1023 steps is used. Voltage must be > 0 otherwise it is not set and the default of 5 volts 1023 steps is used.
This function has no meaning for an external ADC. This function has no meaning for an external ADC.
@ -124,13 +142,13 @@ The DUV index can be used for warning for sunburn etc.
Based upon https://en.wikipedia.org/wiki/Ultraviolet_index, Based upon https://en.wikipedia.org/wiki/Ultraviolet_index,
| DUV INDEX | Description | | DUV INDEX | Description |
|:---------:|:------------| |:-----------:|:--------------|
| 0 - 2 | LOW | | 0 - 2 | LOW |
| 3 - 5 | MODERATE | | 3 - 5 | MODERATE |
| 6 - 7 | HIGH | | 6 - 7 | HIGH |
| 8 - 10 | VERY HIGH | | 8 - 10 | VERY HIGH |
| 11+ | EXTREME | | 11+ | EXTREME |
| | |
#### Calibrate estimateDUVindex() #### Calibrate estimateDUVindex()
@ -191,18 +209,20 @@ https://en.wikipedia.org/wiki/Ultraviolet_index
## Future ## Future
#### must #### Must
- improve documentation - improve documentation
- refactor / reorganize readme.md - refactor / reorganize readme.md
#### should #### Should
- test more - test more
- get unit tests up and running - get unit tests up and running
- investigate in calibration - investigate in calibration
- check performance - check performance
#### could #### Could
- investigate serial UV communication with UV led - investigate serial UV communication with UV led
- voltage2mW -> handle negative voltages by taking abs value? - voltage2mW -> handle negative voltages by taking abs value?
#### Wont

View File

@ -37,7 +37,6 @@
#include "ML8511.h" #include "ML8511.h"
unittest_setup() unittest_setup()
{ {
fprintf(stderr, "ML8511_LIB_VERSION: %s\n", (char *) ML8511_LIB_VERSION); fprintf(stderr, "ML8511_LIB_VERSION: %s\n", (char *) ML8511_LIB_VERSION);
@ -201,4 +200,5 @@ unittest(test_estimateDUVindex)
unittest_main() unittest_main()
// -------- // -- END OF FIlE --