Jump to content


Arduino Sky Quality Meter - working!

Recommended Posts

My understanding is that commercial ones use auto-ranging(?) 
and sample upto 90 seconds? Personally I ended up adding two
slide switches on the front panel! One just switches between 10
and 60 seconds. The other is for single-shot "manual" (push the
button!) readings or "auto" continuous output. The coding can
then branch depending on what you want to do. That may still
be "subject to modification" (in my case) as they say... :p

Hmmm... I forget how to propagate(?) "errors of measurement"
now! As I say, the count rate is 20-60Hz with my Mag 5-6 skies.
Isn't the error "Root N"??? But I leave you do the math(s)! lol :D

But frankly "about a minute" seems MORE than adequate for
the "best" skies? I use a mere 10s for quick readings. At some
stage I might check for consistency of the results. I sense the
biggest error is likely to be "systematic" and depends on the
value of the "constant" used (To be define by experiment...) ;)

Edited by Macavity
Link to post
Share on other sites
  • 8 months later...
  • 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

  • 1 year later...

If you go to the sourceforge repo and dig inside the Documentation : https://sourceforge.net/projects/arduinomysqmskyqualitymeter/files/mySQMPRO/Documentation/

The "mySQMPRO.pdf" has all the build instruction (multiple schematics, ...).

You can also find the Schematics in https://sourceforge.net/projects/arduinomysqmskyqualitymeter/files/mySQMPRO/Schematic and Layout/



Edited by rpineau
Link to post
Share on other sites
  • 2 weeks later...

Looking to build one of these myself, but finding a UK supplier with stock is becoming tricky.

Has anyone got hold of any recently? Mouser have the TLS238 (SMT version), but little else. Shipping is £12 too!

If anyone has any 'spares' I'd gladly buy them off them!

Link to post
Share on other sites

I started some time ago building something similar, although for now I put it on hold (way too many projects!)

I'm gonna use a TSL2591 instead https://cdn-shop.adafruit.com/datasheets/TSL25911_Datasheet_EN_v1.pdf, which should have the two following very desirable characteristics:

 - very high dynamic range

 - separate L and IR sensor, which should be able to give visible light only readings without installing filters.

It's also much easier to find on the market than the TSL237, and it offer a very easy to use i2c interface.

I also plan to add to the project a temperature/humidity/pressure sensor (BMP280), which beside giving useful information, can also be used to compensate the TSL readings for temperature variation, and a GPS sensor.

Furthermore, I'd like to add an SD Card module, to save all the readings to a CSV file, and possibly a wireless/bluetooth module.

Now, the project itself is not too complicated, as all the involved modules use I2C or SPI, and therefore they're pretty easy to wire to the Arduino (although I'll be using a Blue Pill instead, in my case).

Last time I was planning this I was a bit stuck for the calibration part, as I'd need a commercial SQM sensor for that.


I'll keep posting updates here as I go further with the project.

Edited by GuLinux
  • Like 1
Link to post
Share on other sites

On paper the TSL2591 is whole lot less sensitive in low light than the light-to-frequency sensors. The reason being that it output a number of counts proportional to light level, and at low light levels the difference between 1 or 2 counts is getting pretty big. Some rough calculations give a count of 1 equal to mag 22.5 and count of 2 equal to 21.8, so it would be impossible to measure reliably at low light levels. The maximum dark signal is also a maximum of 25 counts which is in the region of mag 19 (in reality it will be lower). It may work well enough in towns and cities, but below mag 19/20 it will struggle to give meaningful results.

The TSL235 is a better alternative to the TSL237. The responsivity is lower so the output frequency will be ~4x lower. The TSL37 would have an output period of around 10s at mag 22, and the TSL235 around 40s. However the dark current of the TSL237 is about 15-20x greater, which will have a big impact at low light levels unless you can compensate for temperature. My experience has shown the dark current is often less than specified in these sensors though.

Counting periods of seconds with an arduino gives excellent resolution, and actually increases in magnitude terms the fainter you get, whilst your resolution will decrease dramatically with the i2c sensors under darker skies.

I probably have a bunch of TSL237s somewhere I can put up for individual sale if there's interest.

  • Like 1
Link to post
Share on other sites

Another important thing to note is if these are in permanent installations (i.e. exposed to the sun all day) make sure you have a good UV (and IR) filter in place. If exposed to UV over long periods the transparent packaging of all of these sensors will go yellow. This will reduce sensitivity to blue light and ruin any long term light pollution measurements.

  • Like 1
Link to post
Share on other sites

@12dstring interesting.

I was planning to use high gain, long exposure, and an average of multiple exposures to compensate for measurement errors, in order to get a decent accuracy.

I'm not sure if that's enough or not, and I'm not very skilled at reading components datasheets, so I can only trust someone more capable than me, or at least give it a try, and see how it works.


I think replacing the TSL2591 with a frequency component will be relatively easy anyway, so it's worth setting up a base project, and swapping components if needed.

Worth actually trying a comparison, I guess.

I saw the TSL235 is relatively easy to find on ebay, while TSL237 can be found in some uk online stores (low price, but relatively high shipping cost).


I'm not sure how I'll go forward, but since I already have the TSL2591, I'll probably try that first, then run a comparison with either the TSL235 or the TSL237 (I was already planning to compensate for temperature anyway, since my project already includes a temperature sensor).


The blocker for me right now is calibration, though, it's quite difficult to do it without a calibrated reference SQM reader. This is why I temporarily stopped my project (that, and the fact that I also have tons of other open projects, and little time to finish any of them).

Link to post
Share on other sites

I didn't mean to discourage trying the TSL2591. As I haven't tested it yet I can't comment on how it works in the real world, only on paper. I didn't want people to think that the i2c sensor is automatically an 'upgrade' as it's easier to make readings with, as there is a big sensitivity difference.

Taking multiple readings to average will be the best method. Just like imaging, more light gives better signal-to-noise. The frequency output sensors naturally increase effective exposure time for lower light, 10s or more under the darkest sky.

Calibration is an issue, and it's not necessarily solved by having a commercial SQM to compare with. Unless you have the same filter, lens and spacing, you won't be able to calibrate them properly if you want to make accurate comparisons. DIY SQMs are best used for relative measurements, i.e. is tonight darker or lighter than average for my site, is my site getting brighter..etc

  • Like 1
Link to post
Share on other sites
On 23/02/2018 at 13:57, 12dstring said:

I probably have a bunch of TSL237s somewhere I can put up for individual sale if there's interest.

I’m definitely interested in a couple of these so please pm me. 

Link to post
Share on other sites
  • 2 weeks later...

The filter used in the Unihedron SQM is a Hoya CM-500, however I don't think it's a particularly good filter for the job. It claims to match the human eye response but passes light below 400nm which the human eye can't see, and will also cause the sensor plastic to yellow if exposed to the sun for long periods.

You can pick up cheap IR/UV filters from China/Hong Kong. These are the ones I use and plan to measure the transmission curve properly at some point, but the specs say Tavg > 95% @ 440-620nm which will allow LED and Sodium light to pass fully whilst blocking invisible wavelengths.

There's lot of LED lenses around, e.g. this one. The one in the SQM doesn't have a part number so not sure exactly which one it is. Note that the field of view given for an LED lens won't be the same as when using a light sensor, as they will be difference sizes (in the same way different sized cameras with the same lens will give different field of views). The main thing is to reduce the influence of light from nearer the horizon, and a lens concentrates the light from the zenith more than a simple blocking aperture would.

  • Like 1
Link to post
Share on other sites
  • 1 month later...

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 friendly. Might split that part into two assemblies and glue them together afterwards.

I have the Arduino code finished now and outputting data to APT via usb (using a TSL237 as per the original - seems to work well). The window area is for a small OLED screen that displays SQM data as well as temperature, humidity and dew point.





Edited by CrashEd
  • Like 3
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.
      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:
    • 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.