Jump to content

Stargazers Lounge Uses Cookies

Like most websites, SGL uses cookies in order to deliver a secure, personalised service, to provide social media functions and to analyse our traffic. Continued use of SGL indicates your acceptance of our cookie policy.

sgl_imaging_challenge_banner_constellations.thumb.jpg.6034fe99df7fe590f77a776877551964.jpg

Corpze

Arduino Sky Quality Meter - working!

Recommended 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 but just a simple tool that i can use to compare different photo-sites around my home-town here in Sweden :)

Feel free to Use it as you want to, if you wan't to calibrate it, change the value at: const float A = 22.0;

More pictures and code are available at SGL's Yahoo-site.

The parts needed for this is:

Arduino approx. 30USD

Light to freq-sensor: TSL237 - electrical component shop 5 USD

0.1-0.01uF capacitator

20 degree lens - ebay 1USD

UV/IR-cut filter between the lens and the sensor - ebay 1 USD

Some kind of housing and cables/connectors

The lens is mounted to a plastic cover with superglue, the UV/IR filter is mounted underneath it and underneath that, the sensor.

post-28724-0-97738500-1366094542_thumb.j

The sensor has three connectors, one gnd, one vdd and one signal, so it quiet simple to connect, you should use a capacitator to stabilize the +5v.

Here is a video of it how it works (not the best quality i'm afraid.

And here is the code:

The libraries you need is at the top of the code.




// Author: Daniel Sundström and Ola Karlsson, Arvika, Sweden

#include <FreqMeasure.h>
#include <Math.h>
#include <LiquidCrystal.h>
float Msqm;
const float A = 22.0;
int buttonSQM = A2;
int val = 0;
int reading = 0;
int percentage = 0;
LiquidCrystal lcd (12, 11, 10, 9, 7, 6);

void setup() {

pinMode(buttonSQM, INPUT_PULLUP);
digitalWrite(buttonSQM, HIGH);
lcd.begin(16,2);
Serial.begin(19200);
}
double sum=0;
int count=0;
void loop() {
val = digitalRead(buttonSQM);
if (val == LOW) {
reading = 1;
lcd.clear();
FreqMeasure.begin();
while(reading) {

if (FreqMeasure.available()) {
// average several reading together
sum = sum + FreqMeasure.read();
count +=1;

percentage = count/31.0*100.0;
lcd.setCursor(0,0);
lcd.print("Reading");
lcd.setCursor(8,0);
lcd.print(percentage);
lcd.setCursor(11,0);
lcd.print("%");

if (count > 30) {
double frequency = F_CPU / (sum / count);
sum = 0;
count = 0;

Msqm = A - 2.5*log10(frequency); //Frequency to magnitudes/arcSecond2 formula

lcd.clear();
lcd.setCursor(0,0);
lcd.println("Mag/As2: ");
lcd.setCursor(9,0);
lcd.print(Msqm);
delay(5000);
lcd.clear();
reading = 0;
FreqMeasure.end();
}
}
}
}
}
  • Like 10

Share this post


Link to post
Share on other sites

Thanks :)

It´s now been calibrated too!

I did the calibration using the just released app "Dark Sky Pro" witch i had no idea that someone was working on when i started this project :rolleyes:

That app has a error of 0.1 from the original Unihedron SQM, and to narrow that error down, i took five readings and averaged those out.

I then whent back to my coding and chenged the constant to 19, with this i was able to get so close so the individual readings was about 0.02 Mag / ArcSec2 from that :grin:

So now my job is done... for this time :p

BR/ Daniel

Share this post


Link to post
Share on other sites

i really like this idea, been thinking of a meter for a while but at £100 their quite expensive to do a short job

Share this post


Link to post
Share on other sites

Yep, my thoughts as well, and as i only gonna measure the sky to compare different photo-sites, i don´t need the scientific grade. But it is almost as good as the Unihedron one!

Share this post


Link to post
Share on other sites

They sell Arduinos in Maplin but I strongly don't recommend buying there, they add £10 on top of the Amazon prices.

Arduino should only cost about 17 GBP.

I am making a lightning detector using the Uno.

Share this post


Link to post
Share on other sites

this is great, I was thinking of building something like this myself....

Do you think it would be feasible to set this up such that it sounded an alarm when the quality reached a certain value, ie to wake me up in my tent when the sky clears up ;)

Share this post


Link to post
Share on other sites

Sorry  - I have to as  - do you mean the sgl_observatory_automation group ? The others that come back in a search off groups.yahoo.com don't seem to have any traffic worth mentioning.

cheers

Mike

  • Like 1

Share this post


Link to post
Share on other sites

Hi Corpze and great project - a cheeky ask but would you have a logical layout or photo of the wired shield assembly.

Think you'll have some takers if you decide to distribute kits!

Thanks for posting - Jake

Share this post


Link to post
Share on other sites

Hi i try to find the HOYA FILTER CM500 but without any results until yet.....do you know any source for buying?

Friendly Manolis

Share this post


Link to post
Share on other sites

Got an arduino on order, going to look into something similar, but also hooking up a cellular module to get text alerts from it...or send information to a twitter feed . Amazing what you can do for a few quis these days.

Share this post


Link to post
Share on other sites

Excellent stuff - thanks :)

The sea monster mentioned in my sig is an arduino-based console which controls various peripheral devices and also reads a small array of sensors, returning data to an LCD and also to a desktop app I wrote. I have a few spare pins on the sensor side of it, so I'll see if I can incorporate this SQM into it all.

Share this post


Link to post
Share on other sites

I am thinikng of making myself this projecy and i would like some info on how to calibrate the meter once it's done. Is there a practical way on how to certify the results i have at the meter? The app, dark sky meter is for iphone and my phone is android based.

Share this post


Link to post
Share on other sites

Hi.

I cheated a little bit and calibrated my sam with a iphone-app called DSM, Dark sky meter. But that app is supposed to be almost exactly as precise as the Unihedron.

If you use the same sensor, lens and IR/UV filter as i did, you can probably use the same const. float A= 22

With that i measured within one tenth of the app every time.

Perfrej on this forum has perfected this code even more, if there is a to bright sky, the code hangs for a few seconds and can leave traces of the measurements, this was my first C++ code ever so bare with me, he might even post the code here ;)

PS. He is running this sqm-design (at least i think so) in his remote obs in southern france

Share this post


Link to post
Share on other sites

Hi folks!

I have not yet implemented the SQM in Provence. The code in the FreqMeasure llibrary cannot hande the high frequencies that the sensor delivers during daylight, and the Arduino gets hung on a very low level. As soon as I have tested the new code, now using FreqCount instead, I will post it here and implement it in Provence. I cannot run any unreliable test code down there because the Arduino code runs the roos, the power distribution, the focuser and just about everything else.

I too would welcome some hints for lens mounting...

/per

  • Like 1

Share this post


Link to post
Share on other sites

I bought a couple of these

http://www.ebay.co.uk/itm/141195310727?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649

Looks like with a little care they could be superglued to the sensor, although I haven't thought about it properly yet. As I am waiting for these to arrive before assembly.... http://www.ebay.co.uk/itm/160619726385?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649

I also took a look at freqcount vs freqmeasue, but haven't yet recoded for freqcount. Need to do some trials, I'm not too concerned about performance in daylight hours.

I have now ordered a seimens tc35 for doing the mobile comms. On the hunt for a cheap SIM card

I'm using a arduino nano for size, so hoping I can get the code into 32k. So far I have the main sensing, serial comms and EEPROM functionality under 10k, so should be ok.

My first arduino project, so learning as. I go !

Share this post


Link to post
Share on other sites

I hope to be able to send SMS text commands to the SQM to set alert thresholds, calibrate, and to adjust various parameters, such as polling frequencies. I need to tell it which phone number to send regular status messages to, and hopefully to ring my mobile to alert me if the reading reaches a certain level.

Share this post


Link to post
Share on other sites

Oh, and so far this is how it looks...post-22530-0-89640500-1394665191_thumb.j

Edited by OneEyedSam
  • Like 1

Share this post


Link to post
Share on other sites

I bought a couple of these

http://www.ebay.co.uk/itm/141195310727?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649

Looks like with a little care they could be superglued to the sensor, although I haven't thought about it properly yet. As I am waiting for these to arrive before assembly.... http://www.ebay.co.uk/itm/160619726385?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649

I also took a look at freqcount vs freqmeasue, but haven't yet recoded for freqcount. Need to do some trials, I'm not too concerned about performance in daylight hours.

I have now ordered a seimens tc35 for doing the mobile comms. On the hunt for a cheap SIM card

I'm using a arduino nano for size, so hoping I can get the code into 32k. So far I have the main sensing, serial comms and EEPROM functionality under 10k, so should be ok.

My first arduino project, so learning as. I go !

The processor get stuck if it gets too light and the fact that it brown-out resets doesn't help as it imediately gets stuck again. Not a good way to go, folks...

/per

Share this post


Link to post
Share on other sites

Per,

I guess like me you are only interested in night time sky quality.

Perhaps use a light sensitive resistor on an analogue input, and use that to know when to bypass freqmeasue logic during the day. You could even power the light to freq off a digital out pin, so you could effectively power down the sensor in the day. I did experiment using a light sens res and it did work but not as accurate as ts235, but I think it would be good for this purpose.

Hth

Edited by OneEyedSam

Share this post


Link to post
Share on other sites

You could also put the sensor output through a decade counter, to reduce the output frequency. By a power of 2. Then just multiply the resultant freq in code

Share this post


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 bottletopburly
      So  my birthday just past so money to splash on astro stuff , i will have my 1000D modded by juan at cheapastrophotography and also have ordered an autofocuser from deepsky dad https://deepskydad.com/autofocuser i know they can be done DIY but this is a neat package  and costs about the same as a SW autofocuser and a hitechastro focusmaster and i`m no electronic wizard and pavel seems to have a good product and works with ascom and confirmed it works with APT i will update in a few weeks time when hopefully i will have received and tried out . 
       
    • By arun289
      Hi,
      I would like to share my design of a smart barn door tracker. It is a simple to build isosceles barn door tracker with tangent error correction through a Arduino micro-controller. I have shared all the details about the tracker including the mechanical design, electrical circuit and the software source code here:
      https://barndoor.spa...ference-design/
      If you are interested in the math and other details about a barn door tracker, more details are there in the blog. Also find an online calculator which helps in calculating various parameters while designing a barn door tracker. The blog is here:
      https://barndoor.space/

       
      M46 and M47 shot with this tracker.
      135mm lens, ISO800, 15sec X 200 subs (50 minutes) exposure. Cannon 500D.

      Comments and suggestions most welcome!
      Regards,
      Arun
       
       
    • By kbrown
      Hi, 
      I've been working on a DIY fan for my 10" Skywatcher newt. My plan is to measure the ambient temperature and the mirror temperature with two separate thermistors and control the fan speed depending on the temperature difference. 
      My question is, does it make sense to use the fan if for some reason the ambient temperature is higher than the mirror? The fan is sucking the air out the tube at the moment. 


    • By Shardlowcol
      Hi, 
      I want to display FWHM values on a homemade focuser handset over USB from either BYN or Metaguide.
      Does anyone know if these programs even output their data, and can it be obtained?
      I have an arduino, and access to some good programmers thankfully.
       
    • By kbrown
      I bought an Opticstar 2" Manual Filter Wheel and the plan is to stick an arduino controlled stepper motor on the wheel perimeter to turn it. Magnets and hall effect switches will be used to keep track of the position and which filter is active. The mechanical design is done using the open source apps LibreCAD and FreeCAD. G-code for my CNC mill is produced using HeeksCAD and the mill itself is controlled by LinuxCNC. Electronic design is done using the awesome KiCad which recently has had a massive boost by the propeller heads at CERN.
       
      The mechanics is almost done. Still need to etch the PCB and put it together before the real fun begins writing the firmware
       
      Clear skies,
      K











×

Important Information

By using this site, you agree to our Terms of Use.