Skip to content
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

Lux measurements #7

Open
scientistnobee opened this issue Jun 9, 2018 · 3 comments
Open

Lux measurements #7

scientistnobee opened this issue Jun 9, 2018 · 3 comments

Comments

@scientistnobee
Copy link

scientistnobee commented Jun 9, 2018

Hi, if I understood correctly, the lux measurements are carried out in this library by reading the visible photodiode values. I mean by the following line uv.readVisible. This in turn is just reading the register 0x22 which is assigned to SI1145_REG_ALSVISDATA0.

Now my question is that in the pdf file given here (https://www.silabs.com/documents/public/application-notes/AN498.pdf ) Visible photodiode values are given by the following equation (page 36):

ALS_VIS_DATA=256*ALS_VIS_DATA1+ALS_VIS_DATA0

That means we need to read registers 0x22 and 0x23. That is just the visible Photodiode value. Furthermore, the Lux will be calculated by using the following equation (AN523 section 6):

Lux level = [ [(ALS visible reading) - (ALS visible dark reading)] x (ALS visible coefficient) + [ (ALSIR reading) - (ALS IR dark reading)] x (ALS IR coefficient) ] x gain correction

So according to that we require to read the IR photodiode values as well. i.e. 0x24 and 0x25.

Did you do these calucations anywhere else in the library. If so, am I missing anything here? Please let me know. TIA.

@masha256
Copy link

I'd also like to have a simple to use lux method in this library. I've read a lot about gains, the 'high range' mode, etc... but it is very complicated. This library already hard codes those values, so it seems like it would be easy for the author to know those values and make a straight forward lux method from the above formula.

@mike2nl
Copy link

mike2nl commented Sep 26, 2019

@scientistnobee , @machadolab ,
In that case what you had described here in your start posting you are right.
I am from the scientist site and can tell you a lot more about light in any form.

I code for Tasmota here on github and will rewrite the driver for the SI chip.
Because the base of Tasmota does it in the same way as Adafruit.
But we all have a day job and our free time is really pricy ;-) . So sometimes
it needs a bit of time before thingas are chaning.

Based on the veml6070 (there is a driver too) we can learn a lot from the data sheets.
I have rewritten that driver a year ago i think and have controlled the values and the math
with laboratory hardware to be sure it works.

Ok we don't provide real scientistic readings and sensors here. All this here is to learn.
And that is an amazing job by @ladyada and here big team from Adafruit. They have
done a lot of work and hopefully they will go on with that to help people to learn and grow..

At the end i have 3 questions:

  • Why not use all the possibilities to get it so precice as possible we can?
  • Would it not be cool to see the right math in that?
  • Can you make a PR for that?

@TomaszDom
Copy link

I'm not sure if you guys are aware, but there is a driver that does all of these complicated measurements for this hardware here: https://github.com/HGrabas/SI1145

Although the UV reading is broken. I have forked the code and tried to fix it, but I didn't do a very good job. Anyway, it might be worth it to actually fix it than re-invent the wheel with this basic one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants