mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.1.10 ML8511
This commit is contained in:
parent
22da7b20e9
commit
0735e8671c
@ -6,7 +6,7 @@ jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: arduino/arduino-lint-action@v1
|
||||
with:
|
||||
library-manager: update
|
||||
|
@ -8,7 +8,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.6
|
||||
|
@ -10,7 +10,7 @@ jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: json-syntax-check
|
||||
uses: limitusus/json-syntax-check@v1
|
||||
with:
|
||||
|
@ -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/).
|
||||
|
||||
|
||||
## [0.1.10] - 2023-02-18
|
||||
- update readme.md
|
||||
- update GitHub actions
|
||||
- update license 2023
|
||||
- minor edits
|
||||
|
||||
|
||||
## [0.1.9] - 2022-11-17
|
||||
- add RP2040 in build-CI
|
||||
- add changelog.md
|
||||
@ -13,7 +20,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
- edit readme.md
|
||||
- minor edits
|
||||
|
||||
|
||||
## [0.1.8] - 2021-12-21
|
||||
- update library.json
|
||||
- update license
|
||||
@ -23,7 +29,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
- update Arduino-CI, badges
|
||||
- add voltage2mW() for external ADC
|
||||
|
||||
|
||||
## [0.1.6] - 2021-06-19
|
||||
- add get/setDUVfactor()
|
||||
- rewrite estimateDUVindex()
|
||||
|
@ -1,6 +1,6 @@
|
||||
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
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -1,8 +1,10 @@
|
||||
//
|
||||
// FILE: ML8511.cpp
|
||||
// AUTHOR: Rob.Tillaart@gmail.com
|
||||
// VERSION: 0.1.9
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.1.10
|
||||
// DATE: 2020-02-03
|
||||
// PURPOSE: ML8511 - UV sensor - library for Arduino
|
||||
// URL: https://github.com/RobTillaart/ML8511
|
||||
|
||||
|
||||
#include "ML8511.h"
|
||||
|
@ -2,7 +2,8 @@
|
||||
//
|
||||
// FILE: ML8511.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.1.9
|
||||
// VERSION: 0.1.10
|
||||
// DATE: 2020-02-03
|
||||
// PURPOSE: ML8511 - UV sensor - library for Arduino
|
||||
// URL: https://github.com/RobTillaart/ML8511
|
||||
//
|
||||
@ -22,7 +23,7 @@
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#define ML8511_LIB_VERSION (F("0.1.9"))
|
||||
#define ML8511_LIB_VERSION (F("0.1.10"))
|
||||
|
||||
|
||||
class ML8511
|
||||
|
@ -6,6 +6,7 @@ ML8511 KEYWORD1
|
||||
|
||||
# Methods and Functions (KEYWORD2)
|
||||
reset KEYWORD2
|
||||
|
||||
getUV KEYWORD2
|
||||
voltage2mW KEYWORD2
|
||||
setVoltsPerStep KEYWORD2
|
||||
|
@ -15,7 +15,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/ML8511.git"
|
||||
},
|
||||
"version": "0.1.9",
|
||||
"version": "0.1.10",
|
||||
"license": "MIT",
|
||||
"frameworks": "arduino",
|
||||
"platforms": "*",
|
||||
|
@ -1,9 +1,9 @@
|
||||
name=ML8511
|
||||
version=0.1.9
|
||||
version=0.1.10
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=ML8511 - UV sensor - library for Arduino
|
||||
paragraph=
|
||||
paragraph=
|
||||
category=Sensors
|
||||
url=https://github.com/RobTillaart/ML8511
|
||||
architectures=*
|
||||
|
@ -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).
|
||||
|
||||
|
||||
#### 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
|
||||
|
||||
```
|
||||
@ -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
|
||||
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()**.
|
||||
|
||||
```cpp
|
||||
@ -66,11 +74,21 @@ Use a voltage divider (10K + 20K) to convert the 5 Volts to ~3.3 Volts.
|
||||
|
||||
## Interface
|
||||
|
||||
```cpp
|
||||
#include "ML8511.h"
|
||||
```
|
||||
|
||||
#### 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.
|
||||
|
||||
#### Core
|
||||
|
||||
- **float getUV(uint8_t energyMode = HIGH)** returns mW per cm2, energyMode = HIGH or LOW.
|
||||
LOW will disable the sensor after reading.
|
||||
- **float voltage2mW(float voltage)** returns mW per cm2 from voltage. To be used when one uses an external ADC e.g. ADS1115
|
||||
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
|
||||
- **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.
|
||||
This function has no meaning for an external ADC.
|
||||
@ -123,14 +141,14 @@ The DUV index can be used for warning for sunburn etc.
|
||||
|
||||
Based upon https://en.wikipedia.org/wiki/Ultraviolet_index,
|
||||
|
||||
| DUV INDEX | Description |
|
||||
|:---------:|:------------|
|
||||
| 0 - 2 | LOW |
|
||||
| 3 - 5 | MODERATE |
|
||||
| 6 - 7 | HIGH |
|
||||
| 8 - 10 | VERY HIGH |
|
||||
| 11+ | EXTREME |
|
||||
| | |
|
||||
| DUV INDEX | Description |
|
||||
|:-----------:|:--------------|
|
||||
| 0 - 2 | LOW |
|
||||
| 3 - 5 | MODERATE |
|
||||
| 6 - 7 | HIGH |
|
||||
| 8 - 10 | VERY HIGH |
|
||||
| 11+ | EXTREME |
|
||||
|
||||
|
||||
|
||||
#### Calibrate estimateDUVindex()
|
||||
@ -191,18 +209,20 @@ https://en.wikipedia.org/wiki/Ultraviolet_index
|
||||
|
||||
## Future
|
||||
|
||||
#### must
|
||||
#### Must
|
||||
- improve documentation
|
||||
- refactor / reorganize readme.md
|
||||
|
||||
#### should
|
||||
#### Should
|
||||
- test more
|
||||
- get unit tests up and running
|
||||
- investigate in calibration
|
||||
- check performance
|
||||
|
||||
#### could
|
||||
#### Could
|
||||
- investigate serial UV communication with UV led
|
||||
- voltage2mW -> handle negative voltages by taking abs value?
|
||||
|
||||
#### Wont
|
||||
|
||||
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include "ML8511.h"
|
||||
|
||||
|
||||
|
||||
unittest_setup()
|
||||
{
|
||||
fprintf(stderr, "ML8511_LIB_VERSION: %s\n", (char *) ML8511_LIB_VERSION);
|
||||
@ -201,4 +200,5 @@ unittest(test_estimateDUVindex)
|
||||
unittest_main()
|
||||
|
||||
|
||||
// --------
|
||||
// -- END OF FIlE --
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user