Adafruit is open, safely ... and shipping all orders at this time! Read more!

VEML6075 UV Sensor - UV Index

In the weather world there is this concept of UV Index - https://en.wikipedia.org/wiki/Ultraviolet_index

A Linear scale where 0-3 is Low and goes through to 10 and above being Extreme....

So how can I calculate this UV Index using the VEML6075...

Code: Select all | TOGGLE FULL SIZE
`                print "VEML6075 Present.........................", SunlightUVIndex      uva, uvb = uv_sensor.get_measurements()      uv_comp1, uv_comp2 = uv_sensor.get_comparitor_readings()      uv_indices = uv_sensor.convert_to_index(uva, uvb, uv_comp1, uv_comp2)      print('UVA : {0} UVB : {1} COMP 1 : {2} COMP 2 : {3}'.format(uva, uvb, uv_comp1, uv_comp2))      print ('UVA INDEX: {0[0]} UVB INDEX : {0[1]} AVG UV INDEX : {0[2]}\n'.format(uv_indices))      SunlightUV = uv_indices[2]      SunlightUVIndex = round((uv_indices[2] * 10),1)      print("UV index:", SunlightUVIndex)`

The above being the closest thought on a raspberry pi using python - If I take the uv)indices[2] it is a large number, so dividing by 10 does kind of get me close.... however even on a clear day in winter I am seeing values of 20 or 25.... Which I believe to be too high...

Am I understanding what is being returned to me is correct?

impactoz

Posts: 2
Joined: Sun Jul 28, 2019 1:09 am

Re: VEML6075 UV Sensor - UV Index

What is the formula you are using to calculate the index?

franklin97355

Posts: 21493
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: VEML6075 UV Sensor - UV Index

Thought you might have guessed from the code...

The VEML6075 returns UV Index for UVA, UVB, and combined using their special calculations...

I was using the combined value...

Which returns values like 31, 49, 52 - Which is far too high for what I wanted - and the test data was all in this range, so thought maybe its just a factor of 10... So that's all I do - take the combined UV Index provided and divide by 10...

Seemed to work - cloudy days - see things like 1.2 or 2.3 but on more sunny days I have seen my value climb up to 35 - meaning the value returned as the combined index is something in the 350 range!

impactoz

Posts: 2
Joined: Sun Jul 28, 2019 1:09 am