Jump to content

sgl_imaging_challenge_2021_2.thumb.jpg.72789c04780d7659f5b63ea05534a956.jpg

Arduino Sky Quality Meter - working!


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 post
Share on other sites
  • Replies 119
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

So, finally my DIY arduino SQM is finalized, it is not calibrated yet, but hang in there, i will do so in the near future... But first i want to point out that i didn't want any scientific grade SQM b

I recently had a chance to use the Unihedron SQM and SQM-L meters and decided I wanted to build my own. A search led me to this thread, thanks for all this great info! In researching this project I di

Here’s a few preliminary sketches of my DIY SQM that I’m building. Just need my 3D Printer to show up now. I may have to revise the ‘turret’ area where the lens is to make it a bit more printer f

Posted Images

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 post
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 post
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 post
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

  • Like 1
Link to post
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 post
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??

  • Like 1
Link to post
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 post
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 post
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.

Edited by pete_l
Link to post
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 post
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 post
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.

Link to post
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 post
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.

  • Like 2
Link to post
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 post
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 post
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.

  • Like 1
Link to post
Share on other sites

whats the difference between the 237s and 237t?

The 237S is the standard three-lead package, the 237T is a smaller surface mount one. The 237T also has about half the responsivity and an output enable pin.

Link to post
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 post
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.

  • Like 1
Link to post
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 post
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 post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By HN50
      My attempts at SID monitoring have been languishing for a while due to radio problems, though I have been getting to grips with Arduino and even had a go at building my own.
      In order to move things along I went to the UKRAA stand at Astrofest and bought the VLF radio kit, their signal generator and the 15V power supply.
      Last weekend I soldered the board.  It wasn’t too difficult following their instructions which are pretty clear.  The only fiddly bit was soldering on an SMD capacitor but they also give you a through-hole one as well.  Initial tests suggest it is working but I will have a better idea when it is all connected.

      This weekend I have been working on the housing and hopefully tomorrow get the leads soldered.  From left to right will be led power, 15V in, 15V out, antenna in, then analogue -ve and +ve (can be 5V or 2.5V).  
       


      I am building it as-is, so the first iteration will have the radio running off mains power and in turn the radio will power the Arduino.  That seems a bit backwards but I would just like to get logging data.  For the time being it will write to an SD card, but the Arduino MKR 1010 looks rather good and comes with WiFi and encryption.
      That though, is a long way off..!  Anyway, this shows progress so far.
    • By wimvb
      Just finished work on a sky quality meter with built in wifi. The device is based on the ambient light sensor TSL2591 and the wifi board ESP32. Communication between the two boards is through I2C. The device has a 40 degrees lens.
      The light sensor is programmable, which means you can set integration time (from 100 to 600 ms) and gain (from 1 to almost 5000, in 4 steps). I implemented automatic adjustment of these parameters to allow for the highest dynamic range (600M:1 accoring to the spec sheet).
      The device shows Sky readings as a web page. It is connected to a local wifi network, although it could also create its own access point. So far I haven't been able to calibrate the sqm yet, partly due to eternal cloud cover. But it should only require one parameter to be adjusted.
      The code is available on GitHub. Sky-Quality-Meter
      Here are som pictures.
      The components:

      The parts connected:

      The finished device:

      This is how output is presented:

    • By Captain Magenta
      Last year I was given a Unihedron SQM-L, the narrow field of view version of their gadget for measuring night-sky brightness. Since then, I’ve nipped outside to take zenith readings whenever I’ve been able, often a few times per night. As a result I now have 85 data-points, all from my back garden in Sunbury on Thames which rates a 19.04 on www.lightpollutionmap.info . As it turns out, this agrees well with the data I’ve collected.
      The darkest I’ve measured at this location has been 19.13, with 4 records better than 19.05 and 10 better than 19.00.
      Plotted against Moon altitude, it looks like:

      One thing I noticed very early on was that the reading generally gets darker and darker as the night goes on. The chart below suggests the data agrees, but how strongly I’m not adept enough yet with my statistics to work out. If anyone fancies doing this for me, I’d be grateful, I’ve attached the data .csv file I think to the end of this post.

      The data itself: each record contains date, time[GMT], SQM value, Moon phase, Moon altitude . For the purposes of my analysis, I’ve converted the time value into hoursafter6pm, which allows the intercept of the regression solution to be loosely considered as the “6pm starting point” for the darkness estimation, which is OK for this dataset as my data is all from this latest Autumn/Winter.
      I’ve done an “ordinary least-squares” regression with multiple input variables. At first glance it seems to me that the SQ vs altitude chart above should not behave well with that: there’s a clear kink, intuitively obvious I guess, at the point the Moon altitude goes negative.
      To cope with that, I divided my data into two and did three separate regressions: “Moon up” data, “Moon down”, and “All data” but treating phase and altitude as zero if the Moon is below -5 degrees (I chose -5 degrees arbitrarily).
      With Moon up, I decided the SQM value will depend on Time of Night, Moon Altitude and Phase. With Moon down, it only needs to depend on time of night.
      Thus my regression model is:
      SkyQual = a + b.timeafter6pm + c.phase + d.altitude + residual
      or rearranged
      residual = a + b.timeafter6pm + c.phase + d.altitude – SkyQual
      The analysis involves minimizing the sum of (the squares of the) residuals, by hunting around for the appropriate values of a, b, c & d which yields this minimum. I used MS Excel’s built-in Solver to do the “hunting around”.
      The following table summarizes the results:

      In words, using “Moon Up” as my subject, my Sky Quality, in magnitudes per arc-second, can be estimated as
      19.28 mags/arc-sec
      plus 0.0314 /hour
      minus 0.864 /full-phase (or 0.216 /quarter)
      minus 0.0186 /degree above horizon (or 0.186 /10 degrees).
      This is a pretty simple analysis. I’m sure there’s theory and formulae available relating Moon-altitude and -phase to extra sky brightness, but I haven’t used any of that here. And the “error model” I’ve used implicitly assumes that the relationships between SQM-reading and the variables are linear.
      If anyone is curious and wishes to do their own analysis, my raw-ish data is available as a .csv file attachment at the end of this post.
      Cheers,
      Magnus
       
      A note about the data collection: each reading is an average of a few readings at a given time, with outliers rejected. For instance, often the first press yields an outlier, and over the following few seconds subsequent ones tend to settle down. So the series of readings 19.05 (me getting excited), 18.85, 18.86, 18.86 , which is a quite typical pattern, would cause me to record 18.86. My highest recorded reading, 19.13, was indeed where it settled down.
      Other “one-on-one” charts:
         
      SQMLdata201903.csv
    • By lenscap
      My diy Onstep GoTo controller is basically an Arduino Mega 2560 with a RAMPS 1.5 shield, rated for 12V normal, 20V max & uses about 2A max.
      It is powered from a 12V car  battery. The lead has crocodile clips at the battery & connects to 5A screw terminals on the RAMPS.
      When I "power-up" by connecting the clips there is a spark at the terminal. This is expected, but does the sparking reduce the life of my electronics?
      If so is there a cheap/simple way to reduce or prevent this?
      I know I could put a switch in the lead but I assume the sparking would then happen inside the switch, making no difference.
       
    • By angryowl
      This will be a thread detailing some of the changes and additions I will be doing to my ASC/Weather Station project. This is version 2.0 as I'll be making some very big changes from the initial project and I think continuing on in the existing thread would not have made much sense.
      So, I still want to use an APS size sensor as after seeing the quality and light capturing capabilities of the now defunct Opticstar DS-616C XL camera and Meike lens I simply cannot go back to using a smaller lens/sensor combination. One thing is certain, I won't be paying £400 or potentially more for another APS astro sized camera so with that in mind I plan on heavily modifying a Nikon D50 DLSR and use the same lens. I chose the D50 primarily due to it having a CCD sensor (ICX453AQ) very close in specs to the one in the Opticstar (ICX413AQ) and the fact that I got a hold of a fully working body for £25.
      Now there's a few issues with going down the DSLR route which I plan on addressing as follows:
      The oversized camera body can be stripped down to bare essentials and fitted in the existing case with some moving of parts around Uncooled, the sensor is quite noisy so to cool it I plan on using the existing Opticstar enclosure with the TEC and hopefully get it purged with Argon to avoid dew formation. Also, since the box will need to be completely sealed to achieve this, there's simply not enough room inside for the main board to which the sensor connects to. The only way around this is using an 39pin 150mm long FPC extension which I managed to find and will be arriving shortly. This means I can have the sensor completely sealed with enough slack in the connection to place the mainboard anywhere I want. The D50 uses the NEF file extension as a "RAW" file format but it's not truly RAW and a heavy median filter is applied to all long exposure images to smooth out the noise. It works great for day to day shots, but in an application such as mine it'll most probably eliminate or severely affect my stars as most of them at the FL I'll be using the camera at will be a few pixels across and the Nikon median filter is very aggressive with such small features. The way around this is what's commonly known as Mode 3 on Nikons. Nikons have a additional Noise Reduction mode which takes the long exposure light first then straight after an equal length dark with the shutter closed, then applies the dark on the light and you get a further noise reduced image which again works very well, but not so much for AP. With mode 3 you essentially have the NR feature on and take an exposure but then immediately shut down the camera after the light has finished exposing. What this does is it causes the camera to dump a REAL RAW image onto the SD card without applying the median filter OR the Noise Reduction process. This obviously results in a much noisier image as expected, but all the stars will still be there and the image in this way can then be dark-subtracted and processed to my liking. I'll post some test shots I've taken to illustrate this. The D50 uses a hybrid shutter, both the CCD electronic shutter and mechanical shutter are used depending I think on the exposure length. If a high enough exposure is used, from what I understand, one can use exclusively the electronic shutter, but for longer exposures the shutters work in conjunction. Now I know the ICX413AQ in the Opticstar is more than capable of taking long exposures solely with its electronic shutter despite the fact that in its datasheet they recommend a mechanical shutter for proper use. So, my thinking is since the D50's sensor is similar to the ICX413AQ the only thing preventing the camera from being able to take any exposure using exclusively the electronic shutter is that its mechanical shutter is in the way and I don't think that the camera would prevent the CCD electronic global shutter itself to still open and close when required. However, this is all a theory at the moment and the only way to confirm it is to test the camera with the sensor outside when the FPC cable arrives. More on this later... In terms of capture software available, the D50 is actually very poor and I could only get digiCamControl to see and control the camera via USB. But I won't be using this as when the camera is hooked up to the PC its SD card is identified as a storage drive and the camera can be used as it would normally with the images appearing on the drive after being written to the SD! Since I'm using my VB app to process the images I would just point the app to that folder and should work. That's all I can think of for now but if and when new ones come up I'll add them here.
      Next I'll be describing some of the other changes planned.
×
×
  • 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.