-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for VEML6075 and VEML6070 i2c UV light sensor #217
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Yes, it is cheap and popular. |
Yes please. Cheap and popular to create meteo stations! |
@rradar - Did you figure out any workaround using a Custom I2C component? |
As a workaround you can use the Custom Sensor component. It works well with other i2c components on the same bus. I only tested the code with an ESP8266. File: veml6070_custom_sensor.h #include "esphome.h"
#include "Adafruit_VEML6070.h"
class VEML6070CustomSensor : public PollingComponent, public Sensor {
public:
Adafruit_VEML6070 uv = Adafruit_VEML6070();
VEML6070CustomSensor() : PollingComponent(15000) {}
void setup() override {
Wire.begin();
uv.begin(VEML6070_1_T);
}
void update() override {
uint16_t cur_uv = uv.readUV();
ESP_LOGD("custom", "The value of sensor is: %i", cur_uv);
publish_state(cur_uv);
}
}; Espconfig: esphome:
name: wetterstation
platform: ESP8266
board: esp01_1m
includes:
- veml6070_custom_sensor.h
libraries:
- "https://github.com/adafruit/Adafruit_VEML6070"
...
i2c:
sda: GPIO5
scl: GPIO4
...
sensor:
- platform: custom
lambda: |-
auto veml6070 = new VEML6070CustomSensor();
App.register_component(veml6070);
return {veml6070};
sensors:
name: "VEML6070 Custom Sensor"
|
Awesome, thanks! I tried the example above and failed as my sensor is reading the value "65535" every single reading. |
I have a 7700 (lux sensor). Tried this code and get 65535.
Don't know if this supposed to work with all the VEML sensors... |
I see now it's not. I'll try to adapt it myself and create a new thread. |
What about the VEML6075 will this work around work for this sensor |
I have VEML6075 and applied your code, but I also always 65535 |
For ESP32:
|
Why you have #define I2C_SDAa 16 #define I2C_SDAb 21 TwoWire I2Cb = TwoWire(0); ? You defined two I2C ports ? if yes why ? |
Oh I have two I2C devices and I was too lazy to use them on the same I2C port. Wiring was eaysier this way. Of course you need only one. |
another question #define I2C_SDAa 16 correspond to which GPIO ? GPIO 16 & 33 |
#define I2C_SDAa 16 |
Ok it's working fine now :) Thanks for sharing |
Did anybody ever get this working with the 6075 ? as this is the github library https://github.com/adafruit/Adafruit_VEML6075 and not the one posted above |
yes, the VEML6075 works fine. Change the name of the library to github repo and slighly modify the code to read the measurement data. As VEML6075 can read both of UVA and UVB values, you can publish them as a separate sensor. This is my example using the library SparkFun_VEML6075_Arduino_Library.h
|
Thanks for this, what is your config in esphome is it the same as posted above ? |
espconfig.yaml:
|
Thanks for that think my sensor is broken as it just keeps on throwing |
Please Mr jirisrba,
Which is giving me a build error:
|
I tested two VEML6075 libraries
Both of them works fine. My example above was from SparkFun. This is my full configuration and Custom Sensor class prepared on D1 Wemos from Adafruit_VEML6075 repo: veml6075_custom_sensor.h:
espconfig.yaml:
Note that I'm not sure about the units of UVA and UVB measurements .. maybe I am wrong. |
Anybody managed to tweak this sensor to be waterproof ? |
I was lucky with your config @jirisrba so thank you very much!
Observe the last library added! @SeByDocKy: I just melted a lot of hotglue on to it... |
I used some sillicone on a VEML6070..... unfortunatly the sensor died after the first rain..... the mems sensor didn't like :( ... I iordered e VEML6075 now thanks to your work :) |
Thanks this works with @jirisrba config combined it is showing readings |
@Nornode Did u get the correct readings ? As mine just shows 440 mW/cm² or over 1000 mW/cm²
|
Yeah, looking at the sensor values it spits out now, it's not really looking correct. This is my Grafana output: Image link (UVA & UVB seems to be identical) @jirisrba Where are you located and do you have similar readings? |
@Nornode the VEML6075 sensor is located inside the terrarium close to the UVB lamp. The measurement generates a positive numbers between 100 and 500. |
Just out of curiosity what UVB lamp do you have and what is your readings? Thanks! |
I got mine outside... Values depend on the weather and the position of the sensor. It tops put at approximately 8000 mw/cm2. |
how you waterproofed it ? |
OMG despite i've quoted the right guy above, now i noticed it didn't pinned the right name. 😆 @jirisrba @Nornode Thanks but the problem is for me that my VEML6075's readings look overall ok but according to my testing with UV lamp (with known specs) at least UVB part doesn't correspond. |
No need to point that out. Everyone's use is as good as any. I'm not using it for exact values anyway. |
Trying to compile for ESP8266 with ESPHome 2022.04 and results in error:
Tried adding:
No successs. |
OK found the problem, it's caused by esphome/esphome#2608.
|
Boxed together with a BH1750 in a car side light fixture. It's up on the roof for more than 2 years now. |
Very interesting packaging.... I was sure that UV would be block by the transparent covert.... but seems not the case |
Well I'm sure it affects the measurement a bit (I think less than 1%), but certainly doesn't block it. Usually UV blocking transparent parts are specially designed to do that and usually cost more. If you choose the cheapest product, that will 99.9% NOT blocking UV. |
Here's my working config on a Wemos D1 with a lambda to filter out sudden value decreases due to clouds passing by within 30 minutes. Also text sensors providing level and warning.
|
https://github.com/adafruit/Adafruit_VEML6075/blob/master/Adafruit_VEML6075.h |
I would use VEML7700 for ambient light. The range is from 0 - 120 lux. |
Describe the problem you have/What new integration you would like
VEML6075 and VEML6070 Support. The VEML6075 is preferred as it's the successor of the 6070 version
Please describe your use case for this integration and alternatives you've tried:
Measure UVA & UVB
Additional context
https://github.com/adafruit/Adafruit_VEML6075
https://www.adafruit.com/product/3964
https://github.com/adafruit/Adafruit_VEML6070
https://www.adafruit.com/products/2899
The text was updated successfully, but these errors were encountered: