WXforum.net

Weather Station Hardware => Other Weather Station Hardware => Topic started by: vecerapl on August 26, 2020, 04:13:58 AM

Title: Length of sunlight using a lux sensor?
Post by: vecerapl on August 26, 2020, 04:13:58 AM
I would like to count how much time the sun shines all day. I have a BH1750 sensor, but I can't calculate 100% too much sunlight with that. During the day I will reach 54613 lux, but even though it is now clear, the sun will set in an hour, so lux is only 2423.

Has anyone tried it yet?
Title: Re: Length of sunlight using a lux sensor?
Post by: sky_watcher on August 27, 2020, 02:30:59 AM
I would like to count how much time the sun shines all day. I have a BH1750 sensor, but I can't calculate 100% too much sunlight with that. During the day I will reach 54613 lux, but even though it is now clear, the sun will set in an hour, so lux is only 2423.

Has anyone tried it yet?
Not sure what you mean by "but I can't calculate 100% too much sunlight with that."

The World Meteorological Organization (WMO) definition of ‘sunshine’ is ‘the duration of the period for which the direct solar irradiance exceeds 120 W/m². Are you using this definition, or something else?
Title: Re: Length of sunlight using a lux sensor?
Post by: johnd on August 27, 2020, 03:38:38 AM
The World Meteorological Organization (WMO) definition of ‘sunshine’ is ‘the duration of the period for which the direct solar irradiance exceeds 120 W/m². Are you using this definition, or something else?

Please don't overlook that word 'direct' in the definition. All non-high-end stations (including Davis) that I know of use a global or whole-sky light sensor which measures total irradiance and not direct irradiance (ie direct + indirect). Measuring direct irradiance only needs a sophisticated and costly sensor such as a tracking pyranometer. And using that definition of direct sun when your data is actually total sun is pretty much guaranteed to cause major errors. There are algorithmic ways of trying to guesstimate sunshine hours from total irradiance data, but they're not trivial to implement.
Title: Re: Length of sunlight using a lux sensor?
Post by: galfert on August 27, 2020, 03:47:46 AM
But there is also another issue to contend with. The OP is using a Lux sensor which is not the same thing as a solar radiation sensor. It does not output W/m2.

I do though have a recommendation. Fine Offset stations also use a Lux sensor and then liberally use a conversion factor to take Lux and approximate W/m2. This yeilds a result that is an average that does not work so well for all locations given their climate and Latitude. Therefore it is important to adjust this accordingly to get a better approximation. Fine Offset stations have a calibration adjustment to address this.

The conversion factor used is to take Lux and divide it by 126.7 to arrive at W/m2.

Explanation:
https://help.ambientweather.net/help/why-is-the-lux-to-w-m-2-conversion-factor-126-7/

Title: Re: Length of sunlight using a lux sensor?
Post by: johnd on August 27, 2020, 04:13:51 AM
@galfert: All true of course in the explanation of radiometric (w/sqm) vs photometric (lux) units, the latter being adjusted for the spectral sensitivity of the human eye.

But I'm not sure that it matters much if you take an empirical approach to trying to estimate bright sunshine hours from the lux data (which I think is what the OP is aiming for).

You have to devise an algorithm to estimate - on the fly - the maximum (in this case) lux value that your sensor could theoretically see for your lat/long, day of the year and (solar) time of day. Then compare your measured value to the max value and define a cutoff value above which you deem the light level to be bright sunshine. The necessary formulas are all on the web in various places though do need implementing with care over such niceties as being sure which quadrant an arctan value is ending up in. 

A threshold of around 50% or a little less often works out about right but it really needs fine-tuning against some reference data to be optimal. This is only an approximation of course and particular sky conditions can catch it out. But for monthly sunshine hours totals - where over and under spot estimates tend to cancel out - it can be more accurate than one might imagine.
Title: Re: Length of sunlight using a lux sensor?
Post by: the beteljuice on August 27, 2020, 05:04:29 PM
But does anyone understand what the original question is ?

His site is full of manipulated data for the sensor readings (https://www.napajedlaci.cz/slunecni-zareni/), but ...
Quote
During the day I will reach 54613 lux,
there is a suspiciously constant flat-line @  54613 lux - so averages are going to be wrong at least.
Title: Re: Length of sunlight using a lux sensor?
Post by: sky_watcher on August 27, 2020, 09:51:25 PM
But does anyone understand what the original question is ?
I think that he is saying that his sensor saturates before noon, hence the flat line readings. A neutral density filter would help fix it if that is the issue, but at the expense of the sensitivity near dawn and sunset.

By attempting to adjust the reading for the increased atmospheric path near dawn and sunset, I think that he is looking to detect if there is cloud between the Sun and the sensor over the total time the Sun is over the horizon. This is different to the W/m2 methodology.

However, this is just a guess.
Title: Re: Length of sunlight using a lux sensor?
Post by: the beteljuice on August 27, 2020, 10:35:56 PM
So he needs to address the over-saturation of the sensor and then do a "Hours Sun" script (If his software [homebrew ?] doesn't already cover it.)
Title: Re: Length of sunlight using a lux sensor?
Post by: vecerapl on August 31, 2020, 03:46:44 AM
What I found out is that the BH1750 has a conversion to W/m2: lux * 0.0078. And sunshine is calculated from 120 W/m2

What do you think about it?
Title: Re: Length of sunlight using a lux sensor?
Post by: galfert on August 31, 2020, 04:28:28 AM
What I found out is that the BH1750 has a conversion to W/m2: lux * 0.0078. And sunshine is calculated from 120 W/m2

What do you think about it?

Multiplying by 0.0078 is almost the same thing as dividing by 126.7. But it is better to divide by 126.7 because you'll get better precision. That is why my earlier post recommended dividing by 126.7.

1/126.7 ~= 0.0078926598263614838200473559589582

The premise is this...when you need one third of something you don't multiply by 0.3333, rather you divide by 3.

Title: Re: Length of sunlight using a lux sensor?
Post by: johnd on August 31, 2020, 04:50:49 AM
What I found out is that the BH1750 has a conversion to W/m2: lux * 0.0078. And sunshine is calculated from 120 W/m2

Read my post above please. The conversion to sunshine hours only works if you're measuring DIRECT solar irradiance (ie sunshine). Your sensor does not measure that. Re the conversion from lux to W/sqm - I suspect that's just an approximation, which may be OK - it's the conversion to sun hours that I'm commenting on.

Quote
What do you think about it?

A poor choice TBH.
Title: Re: Length of sunlight using a lux sensor?
Post by: sky_watcher on August 31, 2020, 05:44:40 AM
What I found out is that the BH1750 has a conversion to W/m2: lux * 0.0078. And sunshine is calculated from 120 W/m2

What do you think about it?
I have found a range of lux -> W/m2 conversion factors for silicon devices. I can't see a conversion factor listed in the datasheet, so 0.0078 seems a reasonable place to start experimenting.

From the datasheet, the directional characteristics of the BH1750 may cause a mount orientation issue. By 45 degrees away from perpendicular to the sensor face, response has dropped to between 50% to 60% of the maximum response, depending on the orientation of the sensor face. By 60 degrees, its down to 30% to 40%, depending on orientation.

Bear in mind that you are measuring whole of sky radiation, not just direct radiation. Unless you are trying for a scientific paper, this is not a fatal flaw for experimentation. What this will mean is that you will have an error band around your readings due to the presence or absence of clouds. That is, the reading with direct sunlight surrounded by dark clouds will be lower than what you will get with a clear sky, but it will be higher if there are reflective clouds (like Cumulus) around as more radiation will be reflected to the sensor.

If you are just looking to detect bright sunlight, you need to see what readings you can expect under a variety of cloud conditions. In my location, I haven't seen any conditions (away from sunrise/sunset) where the cloud in the area reduces the reading so much that direct sun on the sensor can't be detected as sunlight, or increases it so much that I confuse reflected sunlight with direct sunlight.

If you want a calibrated power reading of direct sunlight, you have the wrong setup. If you are happy to experiment, you can get a good idea of when there is direct sunshine on the sensor. As far as using multiplication or division goes, I think that the other uncertainties will swamp any variations between using multiplication or division.

Title: Re: Length of sunlight using a lux sensor?
Post by: vecerapl on August 31, 2020, 09:59:25 AM
What sensor to buy so i can measure sunlight, light?
Title: Re: Length of sunlight using a lux sensor?
Post by: PaulMy on August 31, 2020, 10:04:44 AM

Quote
What sensor to buy so i can measure sunlight, light?


The Blake-Larsen Sunrecorder http://www.sunrecorder.net/


Enjoy,
Paul
Title: Re: Length of sunlight using a lux sensor?
Post by: vecerapl on September 08, 2020, 02:06:49 AM
What to use sfh203p for example? That could work.
Title: Re: Length of sunlight using a lux sensor?
Post by: johnd on September 08, 2020, 03:31:13 AM
What to use sfh203p for example? That could work.

Why would that be any different to your existing lux sensor?

The problem is that all of these sensors can only measure TOTAL or whole-sky sunlight (irradiance). To repeat previous answers, you have two choices:

1. Buy a sensor that points at the sun throughout the day and measures DIRECT irradiance. In general, these are very expensive though there are alternatives such as the BL sensor referred to above.

2. Use software that can estimate sunshine hours from whole-sky irradiance data.

Those are your only choices.
Title: Re: Length of sunlight using a lux sensor?
Post by: sky_watcher on September 08, 2020, 04:06:28 AM
What to use sfh203p for example? That could work.

Why would that be any different to your existing lux sensor?

The problem is that all of these sensors can only measure TOTAL or whole-sky sunlight (irradiance). To repeat previous answers, you have two choices:

1. Buy a sensor that points at the sun throughout the day and measures DIRECT irradiance. In general, these are very expensive though there are alternatives such as the BL sensor referred to above.

2. Use software that can estimate sunshine hours from whole-sky irradiance data.

Those are your only choices.
I don't think that is point of the question. The graph from the previous sensor appeared to show that the sensor saturates during the day.

A new sensor or a light reducing filter is first needed to prevent saturated readings, before option 2 would make any sense at all.

I haven't had an in-depth study of the sfh203p datasheet, but the recommended use in a smoke detector or white goods does not seem to indicate it would be a good choice for full summer sun readings.

There are devices which are specifically designed to measure ambient light such the BH1730FVC which provides a 16-bit digital output using I2C and is good for 0.001lux to 100k lux. This device costs AUD$6.13 each from Element 14, so  it isn't expensive, but they are surface mount.






Title: Re: Length of sunlight using a lux sensor?
Post by: johnd on September 08, 2020, 04:36:00 AM
I don't think that is point of the question.

Well, the original post does start off 'I would like to count how much time the sun shines all day.'.

I interpret that to mean sunshine hours, but maybe there are other interpretations. I'm not sure why a sensor saturating would prevent an estimate of total sunlight duration (ie dawn to dusk), which is the only other interpretation I can think of. If it is saturating (which sounds a bit surprising for a sunlight sensor) then it's still reading at a high level and wouldn't stop a dawn to dusk timing.
Title: Re: Length of sunlight using a lux sensor?
Post by: sky_watcher on September 08, 2020, 04:39:11 AM
I don't think that is point of the question.

Well, the original post does start off 'I would like to count how much time the sun shines all day.'.

I interpret that to mean sunshine hours, but maybe there are other interpretations. I'm not sure why a sensor saturating would prevent an estimate of total sunlight duration (ie dawn to dusk), which is the only other interpretation I can think of. If it is saturating (which sounds a bit surprising for a sunlight sensor) then it's still reading at a high level and wouldn't stop a dawn to dusk timing.
I believe he is trying to build his own, not repair a broken one.