Add new sensor (Ambient Light Sensor - VEML6030)

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
knighToFdemonS
Normal user
Posts: 12
Joined: 23 Mar 2024, 16:44

Add new sensor (Ambient Light Sensor - VEML6030)

#1 Post by knighToFdemonS » 24 Apr 2024, 14:27

Can you add support for the VEML6030 Light Sensor?
You can find the library here: https://github.com/sparkfun/SparkFun_Am ... no_Library
(the lowpower/sleep-mode is not important)

I know its not as easy as the Adafruit-Sensor.

Thank you in advance!

User avatar
Ath
Normal user
Posts: 3607
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Add new sensor (Ambient Light Sensor - VEML6030)

#2 Post by Ath » 24 Apr 2024, 14:52

What's special about this sensor that you can't get from either the already supported VEML6040, VEML6070 or VEML6075 ?
/Ton (PayPal.me)

knighToFdemonS
Normal user
Posts: 12
Joined: 23 Mar 2024, 16:44

Re: Add new sensor (Ambient Light Sensor - VEML6030)

#3 Post by knighToFdemonS » 25 Apr 2024, 10:33

Thank you, ive added the plugins to my build but after trying these sensor-configs, i noticed they only have address 0x10/0x11 available (i'd have to bridge the pins to change the address to 0x10, default is 0x48).
And 2nd, one is a sensor for rgb-color and the other one is a UVA/UVB sensor...but my sensor is a luxmeter. they all return different values, so i guess i cannot use any of the suggested sensors.

User avatar
Ath
Normal user
Posts: 3607
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Add new sensor (Ambient Light Sensor - VEML6030)

#4 Post by Ath » 25 Apr 2024, 11:04

Ah, I got the impression you could calculate the lux from available values, but that's not the case.

I've ordered a VEML7700, that appears to be compatible in lux range with the VEML6030 but is quite a bit cheaper :?, and have to check specs if they are also (fully) software-compatible.
Any reason for using a VEML6030 over a VEML7700? (At quick glance the specs seem quite compatible)

Don't understand what you are trying to say about I2C addresses, as that requirement is determined by the sensor, not by the driver, and the plugin usually supports what is available on the sensor side.
/Ton (PayPal.me)

knighToFdemonS
Normal user
Posts: 12
Joined: 23 Mar 2024, 16:44

Re: Add new sensor (Ambient Light Sensor - VEML6030)

#5 Post by knighToFdemonS » 25 Apr 2024, 11:15

Looks compatible, yeah. Just raw ambient light and lux.
No particular reason, just grabbed the first lux-sensor on a breakout board (by sparkfun) while i was ordering other stuff. Yes, i should have done more research in advance.

sorry, i was just saying that the default-address was not available from any of the other sensor-plugins.

(im trying to create a new sensor and do it myself :? but ive just managed to create my own build, so dont bank on me)

thank you for your help!

User avatar
Ath
Normal user
Posts: 3607
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Add new sensor (Ambient Light Sensor - VEML6030)

#6 Post by Ath » 25 Apr 2024, 22:55

We already have 3 Light/Lux sensors supported, P010 - BH1750, P015 - TSL2561 and P074 - TSL2591. Only P015 has RTD documentation available, and P010 has the old Wiki docs available.
They don't have a max. lux range comparable to the VEML6030/VEML7700 but are fine sensors, and are available in nearly all ESPEasy builds.
/Ton (PayPal.me)

knighToFdemonS
Normal user
Posts: 12
Joined: 23 Mar 2024, 16:44

Re: Add new sensor (Ambient Light Sensor - VEML6030)

#7 Post by knighToFdemonS » 13 May 2024, 11:44

Thank you for your help. Ive ordered and switched in the TSL2591, works out of the box. Ive taken a deeper dive into the lux-calculation and noticed some flaws with this sensor.
So if I could. i'd rather still use the VEML6030/VEML7700, if you can manage to add them. Thank you for all this help so far!! Really appreciate all the helps and developement you guys are doing. I will show my whole project when its kindof done, none of would be possible without the flexibility of ESPEasy <3

TD-er
Core team member
Posts: 8810
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Add new sensor (Ambient Light Sensor - VEML6030)

#8 Post by TD-er » 13 May 2024, 12:04

What kind of flaws?
Is it something we can work around in software?

For some sensors I added some "overdrive" mode where I detect 'clipping' of the IR channel and then just assume the same ratio as before the clipping and then extend the calculations for high Lux values like today.
Today it is > 120'000 Lux where some sensors start clipping before or around 65k.

You can also add some cheap ND filter in front of the sensor.
Those typically are sold with an "attenuation" or "darkening" factor on them like 2x.
This means you simply need to multiply the measured values in the formula field with this factor (e.g. %value%*2 for 2x ND filter)

knighToFdemonS
Normal user
Posts: 12
Joined: 23 Mar 2024, 16:44

Re: Add new sensor (Ambient Light Sensor - VEML6030)

#9 Post by knighToFdemonS » 14 May 2024, 20:04

There seems to be some discrepancies in the library from some years ago and problems with max- and min-range producing negative values (so far ive not encountered that).
See these threads for references:
https://github.com/adafruit/Adafruit_TS ... /issues/14
https://forums.adafruit.com/viewtopic.p ... c&start=15
https://github.com/adafruit/Adafruit_Ci ... 1/issues/7
So switching to a better model might be not a bad idea for reliable measurements (i want to calculate the exact μmol/m² from lux), so i dont want to add a filter and rather have clipping values but precise measurements in the lower ends.
No worries, if implementing a whole new library for that is too much, then i will try to look into it myself as soon as I can. The TSL2591 works good enough so far and thanks again for the soil moisture sensors!
But iam glad to test stuff if somebody wants to try without getting the hardware.

User avatar
Ath
Normal user
Posts: 3607
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Add new sensor (Ambient Light Sensor - VEML6030)

#10 Post by Ath » 18 May 2024, 17:04

@knighToFdemonS I've created Pull Request #5055 to add support for VEML6030 and VEML7700. I've tested locally using a VEML7700, but don't have a VEML6030 available, so if you have one, please (also) test using that sensor.
A build is running from this GH Actions run. Please report your findings here or in the PR.
/Ton (PayPal.me)

knighToFdemonS
Normal user
Posts: 12
Joined: 23 Mar 2024, 16:44

Re: Add new sensor (Ambient Light Sensor - VEML6030)

#11 Post by knighToFdemonS » 24 May 2024, 18:21

Thank you. Ive tried to test it but i can only see an INIT ERROR in the log:
794601: TSL2591: Lux: 0.00 Full: 0 Visible: 0 IR: 0 duration: 200
796071: ESPEasy console using ESPEasySerial
796092: ESPEasy console fallback enabled
796114: VEML : 6030/7700 Init ERROR.
806178: SoilMoisture: Address: 0x36
806178: SoilMoisture: Temperature: 28.29

But I can see it on the i2c scanner:
Standard I2C bus 0x38 (Device) Environment - AHT1x/AHT2x/DHT20/AM2301B/LCD/PCF8574A/AHT10/20/21/VEML6070/Adafruit Rotary enc/Adafruit Soil moisture/DHT20/AM2301B/
Standard I2C bus 0x48 (Device) Light/Lux - VEML6030/VEML7700/PCF8591/ADS1x15/LM75A/INA219/TMP117/VEML6030/
Standard I2C bus 0x53 (Device) Gases - ENS16x/ADXL345/LTR390

I dont have any other sensors with this address on the i2c bus. Is there a way to get a more advanced log? I can only go down to log-level "info" in the options.

User avatar
Ath
Normal user
Posts: 3607
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Add new sensor (Ambient Light Sensor - VEML6030)

#12 Post by Ath » 24 May 2024, 19:15

Can you disconnect all other sensors from your ESP, so only the VEML (not sure what type you use) is connected? Possibly the combined pull-up resistors cause a too low value, so the sensor can't work properly.
I have tested using a VEML7700 myself.
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8810
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Add new sensor (Ambient Light Sensor - VEML6030)

#13 Post by TD-er » 24 May 2024, 23:20

Can you lower the I2C clock frequency to 100 kHz?

User avatar
Ath
Normal user
Posts: 3607
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Add new sensor (Ambient Light Sensor - VEML6030)

#14 Post by Ath » 25 May 2024, 23:14

Hmm, might be a silly question, but you did select the 0x48 address from the combobox, right?
/Ton (PayPal.me)

knighToFdemonS
Normal user
Posts: 12
Joined: 23 Mar 2024, 16:44

Re: Add new sensor (Ambient Light Sensor - VEML6030)

#15 Post by knighToFdemonS » 28 May 2024, 18:39

Sorry for my late response, took some time to test the single sensor.
But it didnt work as a single sensor, also not on 100khz (slowmode) and yes, 0x48 is the right address (and i did not cut the pads for another address, checked that).
Are you sure the libraries are similar enough and the sparkfun also works like the adafruit?

User avatar
Ath
Normal user
Posts: 3607
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Add new sensor (Ambient Light Sensor - VEML6030)

#16 Post by Ath » 28 May 2024, 21:57

knighToFdemonS wrote: 28 May 2024, 18:39 Are you sure the libraries are similar enough and the sparkfun also works like the adafruit?
I've downloaded the specs from the Vishay site, the manufacturer of both these chips, and carefully compared the registers for both sensors. They are nearly equal, as the VEML6030 has support for an interrupt pin and register, that the VEML7700 doesn't have, but I haven't used that feature, so that should not be an issue.
I was a bit surprised that getting the Chip ID from the VEML7700 isn't working, and it isn't implemented in the library either, most likely as, somewhat hidden in the documentation, it claims to have support for 5 registers, where register 3 isn't available, but it seems also registers 6 and 7 aren't available, the interrupt and chip-id registers, though the registers are still documented. For the VEML6030 the manufacturer claims to have 6 registers available, again excluding register 3, but apparently also excluding the Chip-ID register that is numbered 7.
TL;DR; The documentation is somewhat confusing, but the used registers are identical.

This also implies that the Power Save mode won't be working as expected, as that's configured via the not-available register 3... :shock:
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 0 guests