Jump to content

Banner.jpg.b89429c566825f6ab32bcafbada449c9.jpg

Arduino Sky Quality Meter - working!


Corpze

Recommended Posts

perfrej: the longest freq_measure will take to run is dependent on the light level. Worst case is the timeout value on the pulseIn call, which I set to 5 seconds. In a very dark room, it can take a couple of seconds. With actual sky readings it's going to be less than that.

William

Link to comment
Share on other sites

  • Replies 119
  • Created
  • Last Reply

I built a small test setup with a TSL237, a Teensy 2.0, an Adafruit Serial LCD Backpack and negative RGB LCD. If you connect all 16 pins of  the backpack, it will light up the red LED backlight, perfect for this application. You can even set the brightness.

I wanted to compare using the FreqMeasure library and the freq_measure function, so I modified the program to collect 10 readings from both, average them, and display the calculated Mag/As2 values from each side by side on the LCD. The values were close but not the same. On a hunch, I changed freq_measure to use LOW instead of HIGH.  Bingo. The values are now the same to better than 0.1 Mag/As2. With low light levels they match to about 0.02 or better. That's good news, since freq_measure will work on more devices and more I/O pins. I'm going to try to replace the Teensy with an Adafruit Trinket - it should work, and they cost $8 !

I received the lens and IR filter I bought on eBay and put together a sensor. I adjusted the A value until the readings matched a calibrated SQM-L I have on loan. I don't think my sensor sees the same angle as the SQM-L - this is very difficult to measure but if I point near a dark object, like a tree, the readings are different than what I get from the SQM-L. But in open sky, they match very closely.

I would love to find the actual lens used in the SQM-L, but I think this version is close enough for my purposes, which is to be able to compare how dark the sky is at different sites and different times.

FWIW, I was in Yosemite last week, and recorded the darkest sky I've measured to date, 21.28.

I'm happy to post the source code for this. I will definitely put it up on Github but I can post it here as well if people want.

William

ps: anybody know why I don't get email notifications from this site? Is it just because I haven't made enough posts yet?

Link to comment
Share on other sites

My problem is that I need it to not take up any time as I am doing a ton of stuff in parallel. This means my measurements need to be interrupt driven, which freqmeasure is. Maybe I should have a go at modifying the code so that it doesn't hang in daylight. I'll definitely take a look eventually, but I have two other rather large software thingies to fix first.

/p

Link to comment
Share on other sites

It would not be all that difficult to handle the pulse timing asynchronously. I can think of a couple of ways to do this. The most accurate would be to take over the same interrupt that FreqMeasure does directly in your program. This seems simpler to me than trying to debug FreqMeasure.

I suspect FreqMeasure hangs in daylight conditions because the output frequency from the TSL237 is too high. This is seems to be chip and processor frequency dependent. With an Arduino Uno using an Atmega328P at 16 mHz, I did not have any problems with FreqMeasure hanging. If you read the doc though, he does suggest using it only for longer pulse times, 0.1 Hz to 1 kHz.

The specs for the TSl237 cite a minimum of 500 kHz for the full scale frequency. For FreqMeasure, that's 500,000 interrupts a second, which is going to eat up a lot of processor time. At 16 mHz processor speed, that's only 32 tics per interrupt.

One approach would be to switch between the two, using FreqCount at higher light levels and switching to FreqMeasure at lower light levels.

Another approach is to keep an eye on the elapsed time between calling FreqMeasure.begin and when FreqMeasure.available returns true. If too much time has gone by, kill the current attempt and start another one, or switch to FreqCount.

William

Link to comment
Share on other sites

or throttle the input frequency down using a ripple counter and a multiplexer.

or switch off the measuring based on some other conditions such as time, or a simpler cruder light assessment, say from a light sensitive resistor, I assume daytime light levels are not that important to you anyway

Link to comment
Share on other sites

If parallel running is critical, why not run the sqm on a second arduino.

My arduino nano was dirt cheap.

My "Arduino" is €1.76 as I use a self-designed board that handles power and everything. I have implemented a fully functional background reader of the TSL237, but the underlying FreqMeasure library cannot handle the high frequency generated during daylight. Even if I were to move it to a separate processor, that processor would hang just as the one it is in now. I think I will fix FreqMeasure :) That would be my best option.

/per

Link to comment
Share on other sites

Looking at this project with interest. I have a Pi but that's hard work on i/o's so, given that me daughter got me a Maplin voucher for me birthday, I've gone and got me some Arduino kit. Now the fun starts!

BTW, in the UK, where do you source the TSL237's from??

Link to comment
Share on other sites

  • 2 weeks later...

Looking at this project with interest. I have a Pi but that's hard work on i/o's so, given that me daughter got me a Maplin voucher for me birthday, I've gone and got me some Arduino kit. Now the fun starts!

BTW, in the UK, where do you source the TSL237's from??

i was litterly about to post the same question haha!    i really want to make one of these and was just bout to buy all the parts (expessially as an adruinos only £9 now) but cant find a TSL237 any where. 

Link to comment
Share on other sites

Thanks manoss but I was looking for a source in the uk. The closest I seem to have found is one of these adafruit things but I'm a bit dubious whether it will work as good

http://www.maplin.co.uk/p/adafruit-flora-lux-sensor-tsl2561-light-sensor-v10-n90dp

Sent from my iPhone using Tapatalk please ignore any spelling typo thingys

Link to comment
Share on other sites

i was litterly about to post the same question haha!    i really want to make one of these and was just bout to buy all the parts (expessially as an adruinos only £9 now) but cant find a TSL237 any where

The thing is, the TSL237 is a rather old device now.

I've used a TCS3200 which does the same thing (and more, if you want - but you can just use the basic function). That is much easier to get hold of, with out having to search for foreign sellers who still have some of the old stuff in stock.

You will probably find that the calibration is differernt - but since the TSL237 was operating outside of its specification anyway, each sky darkness meter would need individual characterisation for any accurate measurements.

Link to comment
Share on other sites

thanks pete, i notice you use a PIC with yours, where id like to use either an arduino or a PI due to my lack of proper programing skills (i do have them but i was never really good at programing in college and uni) 

is that possiable with the Tcs3200? size wise dosent matter to me, but i would like to intergrate a ethernet sheild to the arduino/pi for long term reading (going to the same netbook i use my weather station with.) but still have a screen for quick access.  a plug and play when i want to sort of thing.

Link to comment
Share on other sites

  • 1 month later...

The thing is, the TSL237 is a rather old device now.

I've used a TCS3200 which does the same thing

The TSL237 may be older, but it's a lot more sensitive.

I've built a few SQMs with the TSL237, and my main 'visual' one outputs 0.3Hz under 20 mag/"^2 skies. Knowing the responsivity of 2.3kHz/uW/cm^2 that means ~0.13nW/cm^2 falling on the sensor.

The TCS3200 has a responsivity of 386Hz/uW/cm^2 meaning under the same irradiance it outputs a frequency of 0.05Hz (20 seconds per cycle).

Factor in also that the typical dark frequency is 2Hz for the TCS3200 (40x your real signal) and 0.1Hz (0.33x your real signal) for the TSL237 (the ones I've tested are even lower) and there's going to be a big difference particular with darker skies.

Link to comment
Share on other sites

Hello guys

still finding it really difficult to get the TSL237 from anywhere in the uk. only company i could find only sells as an SMD and i dont have the facilities to play with one of them.

I'm also looking for one, no luck as yet. I was wondering whether we could use the TCS230/TCS3200.

Link to comment
Share on other sites

If there's enough interest then it might be worth doing a group buy from Mouser, that's where I got mine from (along with some other sensors and bits - free postage above £50).

Should come to about £3.50 each delivered.

Link to comment
Share on other sites

I was wondering whether we could use the TCS230/TCS3200.

I have the following and plan to do a comparison for measuring sky brightness at some point:

TCS3200D

TSL25911FN

TSL237T

TSL237S

TSL238T

TSL257T

But for reasons stated above (120x less signal/dark noise) I don't expect the TCS3200 to really be sensitive enough under dark skies. Would be nice if I'm wrong though..

Link to comment
Share on other sites

with the link on the previous page i enquired and a company called parallax will ship to the uk but its not exactly cheap.

heres the sensor https://www.parallax.com/product/604-00085

its $6 for first class  (up to 28 days)   $43  (£25) for priority shipping (i think thats within 2 weeks give or take  $52 (£30) for week and $100 (58) for within a day or so.  which for a sensor that costs £1.80 thats pretty steep :( 

whats the difference between the 237s and 237t?

Link to comment
Share on other sites

I'd like to make something like this but not in any hurry so waiting a month would not be a problem - I just want to make sure I get the right thing.

Link to comment
Share on other sites

with the link on the previous page i enquired and a company called parallax will ship to the uk but its not exactly cheap.

heres the sensor https://www.parallax.com/product/604-00085

its $6 for first class  (up to 28 days)   $43  (£25) for priority shipping (i think thats within 2 weeks give or take  $52 (£30) for week and $100 (58) for within a day or so.  which for a sensor that costs £1.80 thats pretty steep :(

whats the difference between the 237s and 237t?

I'd pay the $6. I bet you get it before you find something else locally/cheaper!

e.g. If someone had purchased one when the link was posted, they would have it by now :D

Link to comment
Share on other sites

with the link on the previous page i enquired and a company called parallax will ship to the uk but its not exactly cheap.

heres the sensor https://www.parallax.com/product/604-00085

its $6 for first class  (up to 28 days)   $43  (£25) for priority shipping (i think thats within 2 weeks give or take  $52 (£30) for week and $100 (58) for within a day or so.  which for a sensor that costs £1.80 thats pretty steep :( 

whats the difference between the 237s and 237t?

I'd happily go halves with you if you put in an order. PM me to arrange if you are interested.

Link to comment
Share on other sites

So am I right in reading that the TSL237 is the best chip to get and this is the place to get them?  I think the $6 postage is quite reasonable and I will state here and now that I would be happy to go in with others on here to get several and share the postage.  I want two in case I blow up one of them - well worth the insurance at that price.

If someone here is willing to arrange purchasing several of these light to frequency chips I agree to buying two off them and paying my whack at the $6 P&P rate :)

Link to comment
Share on other sites

i litterly just came across this after searching for days and coming up short with dave saying about mouser i thought id have a look and low and behold 

http://uk.mouser.com/Search/ProductDetail.aspx?R=TSL237S-LFvirtualkey57530000virtualkey856-TSL237S-LF

i beleive they are the same ones hopefully some one with a bit more technical nohow can verify but it is a uk company

im happy to go in shares with people as well :)  

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.