Jump to content

Banner.jpg.b83b14cd4142fe10848741bb2a14c66b.jpg

Arduino Sky Quality Meter - working!


Corpze

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();
}
}
}
}
}
Link to comment
Share on other sites

  • Replies 119
  • Created
  • Last Reply

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

Link to comment
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!

Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...
  • 1 month later...

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 ;)

Link to comment
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

Link to comment
Share on other sites

  • 3 months later...
  • 4 weeks later...

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.

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

Link to comment
Share on other sites

  • 2 weeks later...

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

Link to comment
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

Link to comment
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 !

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

Link to comment
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

Link to comment
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

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.