VEML6070 and VEML6075 UV sensors
-
Yeah, my 6075 device is also still working fine on the 2xAA batteries I put in it a year ago.
-
OK, I think found what the issue is. VEML 6070 is not providing accurate UV Index. Adafruit is stating the following:
Note that this is not UV index, its just UV light intensity!This is how it can be converted into sort of UV Index according to the datasheet:
RISK_LEVEL convert_to_risk_level(WORD uvs_step) { WORD risk_level_mapping_table[4] = {2241, 4482, 5976, 8217}; } WORD read_uvs_step(void) { BYTE lsb, msb; WORD data; VEML6070_read_byte(VEML6070_ADDR_DATA_MSB, &msb); VEML6070_read_byte(VEML6070_ADDR_DATA_LSB, &lsb); data = ((WORD)msb << 8) | (WORD)lsb; return data; } LEVEL* UV Index ===== ======== LOW 0-2 MODERATE 3-5 HIGH 6-7 VERY HIGH 8-10 EXTREME >=11 -
Yeah, my 6075 device is also still working fine on the 2xAA batteries I put in it a year ago.
@korttoma @scalz FYG I got a new DMM from Dave Jones 121GW and decided to measure a sleep current for VEML6075 and to my surprise:

Quickly reading the datasheet I discovered my mistake:
- current supply - 480uA
- shutdown current - 800nA
Therefore, the sensor has to be put to sleep properly.
One can modify the existing lib:uint8_t VEML6075::Shutdown() { //Places device in shutdown low power mode Config = ReadByte(CONF_CMD, 0); //Update global config value return WriteConfig(Config | 0x01); //Set shutdown bit } uint8_t VEML6075::PowerOn() { //Turns device on from shutdown mode Config = ReadByte(CONF_CMD, 0); //Update global config value return WriteConfig(Config & 0xFE); //Clear shutdown bit } Make sure you define #define CONF_CMD 0x00PS Now I understand why I did not change batteries - they are rechargeable. Charing and putting them back made me think that batteries lasted for a long time. :relaxed:
-
I have now three sensor from Vishay - VEML6040, VEML6070 and VEML6075
I can confirm all three sensors must be property put down to sleep with battery nodes or you would have the following sleeping currents on nodes with typical mysensors setup and standalone sleeping current of 4uA:VEML6040 - 240uA
VEML6070 - 94uA
VEML6075 - 622uAUnfortunately, most libraries do not care for properly sleeping/waking up sensors and therefore, one has to do a little tinkering with software to make it work. I am actually thinking about re-writing some libs completely.
-
Battery issues is one thing, SparkFun's VEML6075 library can't handle direct daylight even (compensated UV readings go negative).
@avamander That's impossible - it is designed to handle the direct sunlight. Mine is showing UV Index = 9. Negative UV reading is a software issue - looks like Sparkfun did not write a good lib for it. Did you try a different lib?
-
@avamander That's impossible - it is designed to handle the direct sunlight. Mine is showing UV Index = 9. Negative UV reading is a software issue - looks like Sparkfun did not write a good lib for it. Did you try a different lib?
-
Did you try a different lib?
Haven't bothered, I'm just logging the raw values and then compensating with software.
@avamander It definitely works.
My problem for now was just the battery consumption. I have one of these:
The problem is that it is dodgy - the sleep consumption never goes below 50uA at 3.2V. According to the datasheet it should be 800nA while sleeping at 1.8V and 25C. Can anyone measure a shutdown current for VEML6085 please?
-
@avamander It definitely works.
My problem for now was just the battery consumption. I have one of these:
The problem is that it is dodgy - the sleep consumption never goes below 50uA at 3.2V. According to the datasheet it should be 800nA while sleeping at 1.8V and 25C. Can anyone measure a shutdown current for VEML6085 please?
-
@alexsh1 I have the same board, there seems to be a regulator and a few other components on the board, if you remove those, how's the power consumption then?
@avamander I have removed every component bit by bit. Originally the consumption was 56uA and now it is 50uA with the only sensor left on the board
-
@avamander I have removed every component bit by bit. Originally the consumption was 56uA and now it is 50uA with the only sensor left on the board
-
@alexsh1 There's an I^2C address selection jumper on the board, maybe that draws current?
-
-
@alexsh1 Just desolder the sensor itself from the board if you're that far already? I wouldn't be surprised if aliexpress sellers sell counterfeit chips that are s****ier, I'm already seeing that with nRF24L01+'s
@avamander I tried to resolder it to the board - no luck.
It is very small. Very hard to solder any wires to it -
Ok, I did manage to solder the bare sonsor.
Consumption is still 50uA.
Can anyone please let me know your VELM6075 break board consumption?????
-
@avamander That's ok. Just post values here - other may benefit on this as well.
I still have no idea why the sensor is taking so much current -
An old thread, tried the github ino for the VEML6075, is not working ok. UVA and UVB sometimes wrong negative figures. I am going to try the sparkfun library, is from 2018. Let you now if I get beter results.
-
/*
Original by scalz@mysensors: https://forum.mysensors.org/topic/6952/veml6070-and-veml6075-uv-sensors/25#
Needs a modified VEML6075-lib: https://github.com/rejoe2/VEML6075
rewritten by Tonbor using sparkfun libary
/
// Enable debug prints to serial monitor
#define MY_DEBUG
// Enable and select radio type attached
#define MY_RADIO_NRF24
//#define MY_RADIO_RFM69
//#define MY_NODE_ID 10
#include <MySensors.h>
#include <SparkFun_VEML6075_Arduino_Library.h>
VEML6075 uv;
//VEML6075 veml6075 = VEML6075();
bool sensorFound = false;
#define CHILD_ID_UVI 1
#define CHILD_ID_UVA 2
#define CHILD_ID_UVB 3
uint32_t SLEEP_TIME = 301000; // Sleep time between reads (in milliseconds)
MyMessage uviMsg(CHILD_ID_UVI, V_UV);
MyMessage uvaMsg(CHILD_ID_UVA, V_UV);
MyMessage uvbMsg(CHILD_ID_UVB, V_UV);
void presentation()
{
// Send the sketch version information to the gateway and Controller
sendSketchInfo("UV Sensor", "1.4T");
// Register all sensors to gateway (they will be created as child devices)
present(CHILD_ID_UVI, S_UV);
present(CHILD_ID_UVA, S_UV);
present(CHILD_ID_UVB, S_UV);
}
void setup()
{
if (!uv.begin()) {
Serial.println(F("VEML6075 not found!"));
} else
sensorFound = true;
//#ifdef MY_DEBUG
// uint16_t devid = veml6075.getDevID();
// Serial.print(F("Device ID = "));
// Serial.println(devid, HEX);
// Serial.println(F("----------------"));
//#endif
}
void loop()
{
if (sensorFound) {
unsigned long lastSend =0;
float uvi;
float uva;
float uvb;
static float uviOld = -1;
static float uvaOld = -1;
static float uvbOld = -1;
//veml6075.sleep(false); // power up veml6075 == begin()
//sleep(500);
// Poll sensor
//veml6075.poll();
uv.powerOn();
delay(250);
uva = uv.a();
uvb = uv.b();
uvi = uv.index();
#ifdef MY_DEBUG
Serial.print(F("UVA = "));
Serial.println(uva, 2);
Serial.print(F("UVB = "));
Serial.println(uvb, 2);
Serial.print(F("UV Index = "));
Serial.println(uvi, 1);
#endif
if (uvi != uviOld) {
send(uviMsg.set(uvi,2));
uviOld = uvi;
}
if (uva != uvaOld) {
send(uvaMsg.set(uva,2));
uvaOld = uva;
}
if (uvb != uvbOld) {
send(uvbMsg.set(uvb,2));
uvbOld = uvb;
}
}
uv.shutdown(); ; // power down veml6075
sleep(SLEEP_TIME);
}

