Using your smartphone as a luxmeter (third BLF-attempt)

12 posts / 0 new
Last post
djozz
djozz's picture
Offline
Last seen: 4 hours 44 min ago
Joined: 09/07/2012 - 17:04
Posts: 15981
Location: Amsterdam
Using your smartphone as a luxmeter (third BLF-attempt)

I start this thread because in the UF-1504 group buy thread it was suggested that a smart phone could be succesfully used as a luxmeter and I was pedantic enough to point out the theory why this could never be anything near accurate. I realised that one thing I found dissatisfying on the other forum is that upon posting stuff you get to hear all about why your methods could be flawed, according to theory (which in itself is a good thing, appreciate that a lot) but then it stops, the wiseguy does not take the effort to do the experiment to check your method, it is up to you to prove every detail. So this is an attempt not to be like that Smile

This is the third attempt to start a topic on how to get a smartphone to work properly as a luxmeter. Pulsar started a thread about it a few years ago (I can not find the link, sorry), Ryansoh3 again two years ago, and now me.

First thing I did was just installing a boat-load of lightmeter apps on my Xperia Z3 Compact and see how they work. It appeared that almost all of them simply read out the inbuilt ambient light sensor (ALS) of the phone, and present the read-out in a more or less convenient way. So technically these apps are all the same. A few apps use one of the camera's to measure the light, and some even give you the rgb ratios of the collected image.

Using the ambient light sensor is actually my favourite approach because these sensors claim to have a wavelength sensitivity spectrum that approaches that of the human eye and thus should be able to produce actual lux-values, something that a camera can not easily achieve. I did some reading into this, later more about that.

First I did some basic tests and quickly realised that the erratic readings I got all the time calmed down a lot by adding a diffuser in front of the ALS-sensor. I tried a piece of milky plastic I had around, but later found out that a small piece of copierpaper with some cellotape over it did the trick just as well. It is the same trick as when you buy a 'Luxi', a kickstarter project in which you buy (30 dollar!) a plastic diffuser and use it together with a dedicated app (a pretty crappy app IMO, there's better ones out there).

 

Like this, the read-out numbers actually began to make sense, although they were way off the real value, not the least because the diffuser reduces the amount of light reaching the sensor a lot. For the plastic diffuser I checked the values with some flashlights with known throw numbers at different set distances. Nothing overly accurate, bad set-up, just to get a feeling for it. And it worked quite well. A few apps let you correct the value with a multiplier (instead of just between a factor 0.5 and 2), like beeCam Lightmeter (1-Ap Light Sensor is even nicer but it crashes on my phone), and with the multiplier at 36, I get recognisable lux-numbers for flashlights with widely varying throw numbers. And with the piece of plastic in position I can measure up to 1 million lux, so there is some leeway for future projects Evil . I have not done real accurate testing yet, like checking this improvised luxmeter side-by-side with my quality luxmeter.

None of the apps provide all the display features that I would like to see for flashlight throw measurements. If these tests work out well enough, it could be nice if a combined app-builder/flashlight enthousiast would make a BLF-luxmeter-app. One that allows calibration with a multiplier, the calibration is saved when closing the app, with the read-out in huge numbers in the underside of the screen (the upper side is probably blinded by your flashlight), and a graph on the upper side showing the course of the values, and giving maxiumum values as well.

 

Back to theory.

Your smart phone luxmeter is as good as your ambient light sensor. I spent some time on the internet trying to find out which ALS-sensor is in my Sony and could not find it. But one of the apps ('Lux Light Meter') appeared just to dig it up somewhere in my phone and display it, the ALS is a Avago APDG-9930, and there's a datasheet for it. This is the thing (it is combined with the proximity sensor, thus the two lenses):

Some highlights from the specsheet:

 

Wow, can you believe that they build a device with a 16-bit resolution just to adjust the brightness of your phone-screen??? And that they go to lengths to match the sensitivity of the human eye to get it right, even using a second infrared sensor for correction? And this all while we know here at BLF that one thing we humans are particularly bad at is perceiving accurate brightness!

I was pretty amazed about the double sensor, but quickly realised that the primary reason the infrared sensor probably is there is because it is also part of the proximity sensor (together with a infrared led that is also build in). It has a second use for correcting the visible light detector.

Now on to the 'approximates human eye response' part. Here's on the left the spectral response of the ALS of my phone. and next to it the CIE1931 photopic luminosity curve, which is the official curve describing the human eye sensitivity (in normal light conditions) on which the lux is based:

That must have been one h*ll of an 'empirical formula' to get anything near the correct 'human eye response' with this sensor Surprised!!! The truth is that they can't. And let's hope that all that uv-light that this sensor is sensitive for is filtered out a bit by the glass cover of your phone! They can substract some infra-red based on the infra-red sensor and for the rest it is an approximation. But because the usual light we measure is white, which is a quite constant mixture of wavelengths (even though the colour temperature can vary), the results they apparently get compared to a real luxmeter (according to the datasheet, that is) is not so bad:

 

 

I found a spectral response of a Vishay version of the Ambient light sensor/Proximity Sensor (probably found in some phones too) as well, the Vishay VCNL4040:

 

This is a way way better spectral response than the Avago one (and probably better than my chinese luxmeters!), narrow, not sensitive to uv or infrared, with the peak sensitivity pretty close to the 555nm where it should be. If this specsheet is correct, I want this sensor in my phone!! Which phone has this one? This thing is good Surprised

 

Back to one more experiment, can I see the uv and ir sensitivity of my -as it appears relatively crappy- Avago ambient light sensor? I blasted three flashlights at the sensor: my EDC-light at low setting, a 365nm uv light (ledengin LZ1), and a ir light (850nm oslon black). The answer is: oh yes you can:

 

These are my findings sofar, if anyone has more info to share on this subject, feel free to post in this thread. I may update with more findings when time allows to do more tests.

Edited by: djozz on 05/15/2015 - 05:34
MRsDNF
MRsDNF's picture
Offline
Last seen: 2 hours 31 min ago
Joined: 12/22/2011 - 21:18
Posts: 12988
Location: A light beam away from the missus in the land of Aus.

djozz your really scaring me. Are you some sort of evil rocket scientist who has a hobby revolving around flashlights? Amazing amount of work and I apologise for not understanding a lot of it. Still love your work. Smile

 

djozz quotes, "it came with chinese lettering that is chinese to me".

                      "My man mousehole needs one too"

old4570 said "I'm not an expert , so don't suffer from any such technical restrictions".

Old-Lumens. Highly admired and cherished member of Budget Light Forum. 11.5.2011 - 20.12.16. RIP.

 

ryansoh3
ryansoh3's picture
Offline
Last seen: 2 months 6 days ago
Joined: 08/04/2012 - 08:21
Posts: 3880
Location: US

Awesome writeup, thanks for sharing.

The UV test is interesting. Although the sensor is quite sensitive to UV light compared to the human eye, I don’t think it would be too much of a problem because white LEDs don’t emit any UV.

Were you able to find the corrected spectral response of the Avago, CH0 – CH1?

Do you know if the subtraction is done in hardware or software — is the phone able to read both CH0 and CH1 values?

BLF ≠ B-grade Flashlight Forum

 

djozz
djozz's picture
Offline
Last seen: 4 hours 44 min ago
Joined: 09/07/2012 - 17:04
Posts: 15981
Location: Amsterdam

MRsDNF wrote:

djozz your really scaring me. Are you some sort of evil rocket scientist who has a hobby revolving around flashlights? Amazing amount of work and I apologise for not understanding a lot of it. Still love your work. Smile

thanks Steve, I was a scientist once, but not on rockets I'm afraid but on the organel inheritence of baker's yeast (fascinating subject Tongue Out). But having worked with microscopes and (big fat) lasers, I do have a weak spot for light and optics as you may have noticed Wink

djozz
djozz's picture
Offline
Last seen: 4 hours 44 min ago
Joined: 09/07/2012 - 17:04
Posts: 15981
Location: Amsterdam

ryansoh3 wrote:
Were you able to find the corrected spectral response of the Avago, CH0 - CH1? Do you know if the subtraction is done in hardware or software -- is the phone able to read both CH0 and CH1 values?

There's no corrected spectral response, there's just some juggling with numbers that come from the two channelx and then a luxvalue comes out, which is a pretty ok one if you just stick to the common light sources.

I think that the component does not give the separate numbers for CH0 and CH1, it just spits out luxvalues.

MRsDNF
MRsDNF's picture
Offline
Last seen: 2 hours 31 min ago
Joined: 12/22/2011 - 21:18
Posts: 12988
Location: A light beam away from the missus in the land of Aus.

djozz wrote:
MRsDNF wrote:
djozz your really scaring me. Are you some sort of evil rocket scientist who has a hobby revolving around flashlights? Amazing amount of work and I apologise for not understanding a lot of it. Still love your work. Smile
thanks Steve, I was a scientist once, but not on rockets I'm afraid but on the organel inheritence of baker's yeast (fascinating subject Tongue Out). But having worked with microscopes and (big fat) lasers, I do have a weak spot for light and optics as you may have noticed Wink

I dont know whether to be in awe or terrified. Surprised

https://scholar.google.com.au/scholar?q=organelle+inheritance+of+baker%27s+yeast&hl=en&as_sdt=0&as_vis=1&oi=scholart&sa=X&ei=TG9WVdqbIsHemAWXyoGoCQ&ved=0CB4QgQMwAA

 

djozz quotes, "it came with chinese lettering that is chinese to me".

                      "My man mousehole needs one too"

old4570 said "I'm not an expert , so don't suffer from any such technical restrictions".

Old-Lumens. Highly admired and cherished member of Budget Light Forum. 11.5.2011 - 20.12.16. RIP.

 

djozz
djozz's picture
Offline
Last seen: 4 hours 44 min ago
Joined: 09/07/2012 - 17:04
Posts: 15981
Location: Amsterdam

It looks like the Vishay component just hit the market this year. And I found another new ambient light sensor (not combined with proximity sensor), the Texas Istruments OPT3001, that has a very good spectral response too. So these great spectral responses for small smd integrated ALS components may be a recent thing. And don't think it comes expensive, at Mouser these very complex magical components cost around 2 dollars!

djozz
djozz's picture
Offline
Last seen: 4 hours 44 min ago
Joined: 09/07/2012 - 17:04
Posts: 15981
Location: Amsterdam

MRsDNF wrote:

I dont know whether to be in awe or terrified. Surprised

https://scholar.google.com.au/scholar?q=organelle+inheritance+of+baker%27s+yeast&hl=en&as_sdt=0&as_vis=1&oi=scholart&sa=X&ei=TG9WVdqbIsHemAWXyoGoCQ&ved=0CB4QgQMwAA

LOL, that googke search brings back a scent of my distant past (15+ years ago) Smile . But it is nothing to be in awe of or to be terrified Tongue Out: doing research is a job, it can be fun, it can be boring, it can be frustrating, like any other job. 

luminarium iaculator
luminarium iaculator's picture
Offline
Last seen: 1 day 14 hours ago
Joined: 07/07/2013 - 09:09
Posts: 2288
Location: X

Wow Djozz Smile

Well done! You are scientist and good soul that shares knowledge to us mere mortals.

Cell phone is an amazing thing for the number of task it can do. I will have to try it.

Thanks.

cajampa
Offline
Last seen: 3 years 4 months ago
Joined: 08/01/2014 - 01:55
Posts: 1963
Location: Sweden

Very interesting as always djozz, maybe it would be possible to build a simple but accurate lightmeter for cheap, if we can get a EE interested, like so many other budget solutions conceived here Wink
Or maybe even one built into the light Wink

I found this it sounds like the more limited IOS plattform with much less hardware variability, could lent it self to better calibrated apps.

I only use Android, so i can’t test myself but maybe some here can test it out.

Dimbo The Blinky
Dimbo The Blinky's picture
Offline
Last seen: 2 months 1 week ago
Joined: 11/27/2012 - 09:46
Posts: 1626
Location: The Indigo State, USA, Earth

djozz wrote:
some even give you the rgb ratios of the collected image.
I’m really punching above my weight here, but wouldn’t that RGB value let us evaluate the “whiteness” of the light? Perhaps in addition to the “brightness”??

I’m curious, but mostly want to Bump and Subscribe, since you just posted about the most interesting thing I have read in many years!

THANK YOU for lighting this fire!

Dim

“There is no darkness but ignorance.”

JohnnyMac
JohnnyMac's picture
Offline
Last seen: 1 year 12 months ago
Joined: 04/12/2011 - 16:03
Posts: 8864
Location: Eastern PA

Great work as always, DJozz!  I'm interested in which apps gave RGB info.