Michael wrote:
Ok, after reading your blog, I understand better

Still I want to truely understand... So, I guess you know the wavelength dependent sensitivity of your photo diode. Is this ilA_spd[i] in your integration? And v_lambda[i] is the model spectrum of some known source (like the models in usual cameras: Daylight, clouded sky, etc)?
Well, not exactly. You've kinda got it backwards there =) ilA_spd[] is a table representing the spectral power distribution for an incandescent lightbulb (illuminant 'A') - that is, of the total amount of power being received, how much of it is represented in each wavelength. That table is actually a function you compare to the number of uW you've received total, and how much of it should be at each wavelength. v_lambda[] is the standard luminous efficiency function, that is - how visible a particular wavelength of light is to our eyes. The function I put in the code there (and the same one I use in this device) is very, very "estimated" - note how I jump in 20nm wavelengths, and presume that each nm between has the exact same SPD as the current one. This is so we can get the calculation done in a reasonable amount of time, and with a reasonable amount of memory consumed. (Although having 3 18 element float arrays is a bit insane in the uC world - it fits *grin*)
I didn't put the D65 table in that blog post, but I linked to the CIE tables where to get it. I used the 'A' values for my tests, hence the poor overall exposure, I'm going to switch over to the D65 (65Kelvin) tables soon, as they are closer to actual daylight than the ILA.
I haven't actually calculated for the per-nm sensitivity response of the chip its self yet, I promised that in a third article and just haven't gotten around to doing that yet. It seems to work "well-enough" w/o it - in fact, if you'll note, I always use the 1.0 response wavelength (420nm) in the calc_uwcm2() function. "Good enough for government work" as they say =)
Don't worry if it seems hard - it wasn't easy for me either, it took me over two weeks to get that code working and had to buy refresher books on calculus and algebra2 to figure out what the heck I was doing wrong - and the only way to verify was code and test against a reference source -- "this level of light _should_ be around 70lx, and this should be around 1lx" - I kept coding, testing, and re-writing until I got my expected results. My girlfriend hated me for those two weeks =)
Michael wrote:
Ok, I guess averaging does the job as well! I just wondered if one could model the transition from daylight to nighttime by a function and then fit it to the measured values. But probably that is really very depending on where you are and on the weather and so...
By the way: I ordered a Arduino, you made me interested

Thanks again for sharing!
To be honest, I don't think averaging is even needed. I think the biggest problem is just taking your readings from the right sources. All the tricks and such are just for working around not being able to get a good reference for your measurement. I'm thinking of extracting the sensor from the body of the box, and making a scope attachment for it - or even a lens attachment, and then a way to hook that up to the flash hot shoe for mounting. This way I could take a reading relevant to what I'm actually shooting. I've noted that it works GREAT whenever it's got a field of view similar to the lens, and horribly when the lens has a much narrower field of view. Like I said earlier, I think the "measuring general ambient light" is a much tougher option. It might make it easier to design the hardware, but the software will require a LOT of tricks.
For some tests, I had the device suspended above a sheet of white paper, and then spent about 20 minutes adjusting it to match my exposure and go from there, without fail, it would later either read too much or too little. The only tests that worked so far were with a wide-angle or standard lens, and pointing the sensor at the scene I'm shooting.
Congrats on ordering the arduino! Man, once I started getting them, I can't stop thinking of applications. I seem to want less to go out and shoot than to make some cool new device and move on *grin* Then again, that may be the product designer in me, hehe. With such a simple platform, everything seems within reach.
!c