Jump to content


Sky Quality Meter with wifi


Recommended Posts

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:


  • Like 7
Link to comment
Share on other sites

I used this reference:


But in the end, you still need to do a real calibration to take into account any geometry, glass, etc. In my case a 16 mm 40 degrees lens.

Fortunately @gorann let me borrow his SQM while he's down under.

I will probably change the firmware to also let it connect to INDI, so I get the data directly into Kstars/Ekos.

Edited by wimvb
Link to comment
Share on other sites

16 minutes ago, fozzybear said:


What lens did you use? care to share the link




And one of these


I believe it was the 2nd one that I ended up using. Must check


Checked: the 8 mm 40 deg lens it is. 

One of these covers the sensor's pcb almost perfectly


Edited by wimvb
  • Thanks 1
Link to comment
Share on other sites

12 minutes ago, skybadger said:

I used one of these https://www.ebay.co.uk/c/7020203413?iid=264465139929

Now I've got 9 left...

Attached via araldite. 

damn and double damn just ordered the above  as per Wim from the rain forest got to wait till end of Jan slow boat from china...…...

Edited by fozzybear
Link to comment
Share on other sites

3 hours ago, gorann said:

Interesting thread Wim! So I assume my SQM arrived and did not get lost by Postnord🙄

No, I got a message from PostNord that it's waiting for me at the local pick up place. Due to my knee condition, I haven't been able to pick it up yet. Will do so on Monday. 

3 hours ago, gorann said:

Just landed in Brisbane waiting for the next plane.😎

Have a nice stay. I hope you get enough clear skies to test your travel AP kit. 

Link to comment
Share on other sites

I've now made a MQTT version of the sky quality meter. In this version, the device no longer creates a webpage with the SQM readings, but publishes the timestamp and SQM readings to a MQTT broker. The code is in the github link provided in the original post.

Here's what needs to be done:

1. Install a MQTT broker. I installed Mosquitto on a Raspberry Pi I had lying around. Here's a good resource:


2. Install a MQTT client. For this I use MQTT.fx ( https://mqttfx.jensd.de/ ) on my Windows computer. There are several clients available, including Mosquitto.

3. Get a simple mqtt client for the esp32:


This version of the sky quality meter is not (yet?) compatible with INDI, you would need an INDI MQTT driver for this.

  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...

Update. Tonight I compared my SQM with a Unihedron model L. I had already done a few tests indoors and "matched" readings. Pointing North, away from the full moon, my SQM measured 18.78, and the Unihedron 18.70. Pointing at zenith (closer to the moon which was at its highest point, almost due South), my SQM showed a somewhat higher reading than the Unihedron. It seems that mine has a smaller fov because of the difference in lenses. All in all, I'm pleased with the result.

  • Like 1
Link to comment
Share on other sites


Would you mind providing a measure of your Lux measurement range from night to day. ? I'd like something to compare with. 

Currently, in This overcast weather, I'm getting log(Lux) between 3.0 down to -2.5.


I'm concerned whether the on board leds of the ESP are limiting the darkness measurements. 





Link to comment
Share on other sites

I will check. Atm, it's sunny, with thin clouds. Also, since I'm 60 degrees North, the sun doesn't get that high here.

I thought about that LED, but with the lens and lens mount I use, it's sealed off. You can always cover it with some black electrical tape. Or if you're bold, take it off with a fine solder iron. 

Link to comment
Share on other sites

I sealed it off too, fixing the board into place using araldite at the back of the lens. But the araldite turned out to be translucent and the leds (one on the power converter, one on the esp and one on the sensor board itself) are all rather bright when I am reaching for that 0.002 Lux of starlight. 

I will be removing the leds after a bit of practice. 

My latitude is 52N and I haven't seen the sun in weeks!

Link to comment
Share on other sites

  • 2 weeks later...

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

  • 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.