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_peoples_choice_2018_winners.thumb.jpg.d8ce9c6569dfc2f48814f6d87da46170.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 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.
    • 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. 


×

Important Information

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