Jump to content

Banner.jpg.b89429c566825f6ab32bcafbada449c9.jpg

Raspberry Pi AllSky Camera


Pete6

Recommended Posts

I took a different approach and replaced the fread usage with a series of fgets. Might be my history of processing sequential files on a mainframe showing though!

An example from webcam.php. Similar code changes are required in suntimes.php, index.php and about.php. Index.html also contains the fread code, but it looks like the php section in there isn't used, so I've commented that out

// Get the sunset time from the daily file
$myfile = fopen("/home/allsky/daily", "r") or die("Unable to open file!");

$ADawn=substr(fgets($myfile),0,5);
$NDawn=substr(fgets($myfile),0,5);
$CDawn=substr(fgets($myfile),0,5);
$SRise=substr(fgets($myfile),0,5);
$SSet=substr(fgets($myfile),0,5);
$CSet=substr(fgets($myfile),0,5);
$NSet=substr(fgets($myfile),0,5);
$ASet=substr(fgets($myfile),0,5);
$sunrise ='Sunrise: '. $SRise;
$sunset = 'Sunset: '. $SSet;
fclose($myfile);

I've added the sunrise time into the banner text too

image.png.3acf64b2abbbfa0793cc5b595d646dd0.png

The odd thing with the last hour of night images didn't reoccur last night, so I'm not sure what happened there. Could be a timing thing again

Link to comment
Share on other sites

2 hours ago, Mognet said:

I took a different approach and replaced the fread usage with a series of fgets. Might be my history of processing sequential files on a mainframe showing though!

I'm really hankering for my transparent dome to actually show up so I can start playing with this. Reading through this I'm quite tempted to have a go at doing something with Rust, which I've been writing quite a bit of lately and enjoying for a systems programming language. Very, very fussy compiler but once it compiles, it'll run, and writing tests is super simple...

Link to comment
Share on other sites

I need to order a dome of some kind so I can mount it outside. Surprised that in all the junk in this house I don't have anything that appears to be suitable!

Poking around the code and finding fixes for stuff is making me miss being a developer. I did have a huge coding aspect to my role some years ago but that part seems to have gone away

Link to comment
Share on other sites

3 minutes ago, JamesF said:

I view this as a good thing :)

James

It takes some getting used to for sure coming from mostly Python, and it's definitely still overkill from a performance perspective for some applications I'm tinkering with (currently writing an API server for a web app I'm writing to handle optical time domain reflectometry traces, which is fun) but it's lovely for low-level stuff. I was writing a binary file parser for the Telcordia SOR format (which is pretty darn obscure) and after the first few days bashing my head against compiler errors and whatnot I managed to adapt my thinking and now view the compiler as a close ally. Genuinely stops you writing things in "bad" ways - I had to be much more explicit and precise than I'm used to but when you do that it gets you a lot of goodness for free and a better, more robust app to boot. I've even fuzzed this new parser (with rust-fuzz) and it's robust against random binary inputs and all the rest with a very amateur developer at the helm!

Feels like it'd be a very good fit for observatory software where robust testing, crash-free operation and stable, continuous, sometimes-timing-sensitive apps are order of the day.

  • Like 1
Link to comment
Share on other sites

11 minutes ago, discardedastro said:

I managed to adapt my thinking and now view the compiler as a close ally. Genuinely stops you writing things in "bad" ways - I had to be much more explicit and precise than I'm used to but when you do that it gets you a lot of goodness for free and a better, more robust app to boot.

Quite.  When I write  C or C++ (for oacapture for example), I use a fairly aggressive set of compiler warning flags and have compilation fail on all warnings.  It makes more work, but catches potential bugs that I didn't notice when I was writing the code.

James

  • Like 3
Link to comment
Share on other sites

6 hours ago, Mognet said:

I took a different approach and replaced the fread usage with a series of fgets. Might be my history of processing sequential files on a mainframe showing though!

An example from webcam.php. Similar code changes are required in suntimes.php, index.php and about.php. Index.html also contains the fread code, but it looks like the php section in there isn't used, so I've commented that out


// Get the sunset time from the daily file
$myfile = fopen("/home/allsky/daily", "r") or die("Unable to open file!");

$ADawn=substr(fgets($myfile),0,5);
$NDawn=substr(fgets($myfile),0,5);
$CDawn=substr(fgets($myfile),0,5);
$SRise=substr(fgets($myfile),0,5);
$SSet=substr(fgets($myfile),0,5);
$CSet=substr(fgets($myfile),0,5);
$NSet=substr(fgets($myfile),0,5);
$ASet=substr(fgets($myfile),0,5);
$sunrise ='Sunrise: '. $SRise;
$sunset = 'Sunset: '. $SSet;
fclose($myfile);

I've added the sunrise time into the banner text too

image.png.3acf64b2abbbfa0793cc5b595d646dd0.png

The odd thing with the last hour of night images didn't reoccur last night, so I'm not sure what happened there. Could be a timing thing again

I can't quite remember now but I think the approach I took was to only have to change the code in a single location... but it's been a while since I looked at it :)  

I can't fit the sunrise on mine as I have outdoor temp and wind speed/direction on it but I can certainly see the appeal for anyone who doesn't have weather station data.

Link to comment
Share on other sites

6 hours ago, jiberjaber said:

I can't quite remember now but I think the approach I took was to only have to change the code in a single location... but it's been a while since I looked at it :)  

I can't fit the sunrise on mine as I have outdoor temp and wind speed/direction on it but I can certainly see the appeal for anyone who doesn't have weather station data.

You took the all in one place at the start approach. On reflection that's probably the cleaner method of fixing the problem. I'd still use the fgets which then wouldn't need to be wrapped in a substr as it's a bit more obvious where the data comes from

I don't have any weather station data or even a temperature probe, so I just went with the sunrise instead. I didn't look to see if it was possible to split lines to get anything more on

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Hi. I have a small group on Fb I am trying to get to try this idea for northern lights . I am new to PI but I am willing to learn. Started to write this project up . From install to being a pi sky cam . Anthony.fi/allsky . I will need help with how to”make” the make file. And I will credit this lounge as the inspiration for the beginning of how to get the PI’s started. I have questions like.. can I get 3 or 10 PI’s sending images to my url.? Security? Ways to speed up the night images? Faster memory cards or usb2 or 3? Thank you all for what I have read and the effort involved so far. It’s been an education and a reason to buy an 8mp cam..

Edited by Northern lights Finland
Link to comment
Share on other sites

Hi,

That sounds like a good idea for the aurora. Having seen them in Iceland I know you have to be in the right place to see them

In answer to your questions, and from what I know:

  • I think there are a few mistakes in the instructions. I didn't need to use the make file when I set mine up, and I think there is a comment by someone else in the thread about that. The best instructions are here in the GIthub code. They don't display properly on the main page for the project but in that text file they do
  • You can have as many Pi's as you want sending images to display on a common web page. There is nothing in the code here for that, but it doesn't mean that you can't extend the code to do what you need.
  • There is currently no security on the web pages, but they are currently only accessible from within the local network and are not exposed to the wider internet. That part would depend on network configuration. There have also been a couple of other security questions raised that might need fixing
  • The speed of the night images is a limitation of the camera. It needs to collect more photons at night to have anything for display. Mine is set to take images once every two minutes and that seems to work ok. I have not yet checked what the actual exposure time at night is to see what is possible

 

Link to comment
Share on other sites

  • 3 weeks later...

Finally got everything together to make my own ASC - I'm not using the Pi HQ cam because they're still hard to get hold of and I had a ASI120MC lying around.

Light_5_secs_2020-08-11T21-45-51_048_d_cc.thumb.jpg.ff64219b39a10fd6ae10d7f2fe6ea116.jpg

Enclosure is a fairly standard thing. My only "d'oh" moment during assembly - other than not measuring my hole quite right, hence the tiny overhang of the dome, but I figure that's immaterial - was that in using a cloth to tidy up some bits of silicone I inadvertently dragged some across the dome. Got most of it off and I don't think it'll be visible, just a thin smear left - but annoying! I have a separate Dribox which has the 12V supply in and a simple gland for the power in to the box. Should be good to IP68 - we'll see in the coming thunderstorms!

EfKrxhIX0AUIUvf.thumb.jpg.5c89069f82413f6eabc292ac2b33dccd.jpg

Internally it's a mess and a half. Big block of balsa I had lying around was adjusted to make a pretty good height match for the camera but I'll replace this with a 3D printer mount sometime soon if this works. Simple 12V/5V step-down (in practice I could have just used a 5V PSU, but keeping the internals 12V-sourced means adding dew heaters etc later is easier) and then a Pi4. External WiFi dongle is again something I had spare with a nice big antenna; I need to run some ducts through the garden and sort out my Ethernet properly, this position doesn't have wired cabling yet.

EfKrx3YXgAASBCM.thumb.jpg.f11b35df8ff603ebbd2d99d3ddce0e6a.jpg

No cooling or ventilation thus far - I'll lob in some silica gel sachets for now. If this works, I'll probably dismantle it, mount everything properly on 3D-printed bracketry, paint the top surface inside the dome with antireflection paint, make a collet for the camera out of black foamcore, and maybe consider airflow/dew removal - will see how it fares in the meantime.

Software wise I'm just using INDI and KStars for testing. I'd like to have a go at making something on this front so will start playing with that tomorrow I guess!

Link to comment
Share on other sites

JUst read your account @discardedastro with interest as it is almost exactly the same construction method I adopted.

I have made a couple of changes to mine which might be of interest. I have now mounted my ASI120MM on top of the box lid under the dome so that the distance between the dome and the lens is about 5mm - it gives a clearer image and is much less prone to spurious light sources causing annoying reflections on the dome.

I bought a circular dew heater (2.5W) which was mounted around the camera body on the box lid, however, the camera sensor temperature would readily go above 30 degrees C and even above 40 in the day giving rise to an unacceptable amount of noise. I have now put the heater in the box (on one side) and drilled holes around the camera below the dome to allow warm air to get into the dome and stop the dew. So far it has worked well although the sensor temperature at the moment is still pretty high and there is some noise as you can see on the image below. That said we experiencing some exceptionally warm weather at the moment. The focus could be a little better as well.

allsky-image.jpg.c67f2faa98889601e5960af0837a280a.jpg

Good luck.

Adrian

Link to comment
Share on other sites

1 minute ago, Adreneline said:

 

I bought a circular dew heater (2.5W) which was mounted around the camera body on the box lid, however, the camera sensor temperature would readily go above 30 degrees C and even above 40 in the day giving rise to an unacceptable amount of noise. I have now put the heater in the box (on one side) and drilled holes around the camera below the dome to allow warm air to get into the dome and stop the dew. So far it has worked well although the sensor temperature at the moment is still pretty high and there is some noise as you can see on the image below. That said we experiencing some exceptionally warm weather at the moment. The focus could be a little better as well.

Thanks for the info - definitely interesting. Noise is definitely an issue - I'll capture some dark frames because it's going to need it. Starting to think a smarter plan might be to replace the bit of balsa wood with a two-stage TEC, or just replace the 120MC with something cooled. But I think with dark subtraction I'll get some usable data out.

Sat out and fiddled with focus a bit - very hard with so much noise and such an insensitive sensor, plus the image scale.

test-asc-30s-30g.fits

test-asc-30s-30g_cc_d.thumb.jpg.163390b7b788ea68ee89748cb0cc802e.jpg

Link to comment
Share on other sites

1 hour ago, discardedastro said:

Sat out and fiddled with focus a bit - very hard with so much noise and such an insensitive sensor, plus the image scale.

I have exactly the same problem. Dark subtraction helps but I have found that the temperature can vary so much you would almost need to have a separate dark for every 5 degree increment! I don't really want to go to the expense of a cooled camera just for this application.

Having said all of this I need to keep things in perspective. I've now got about 50 nights worth of videos and only a handful have allowed me to produce a half decent star trails image. Clouds have spoilt most of the videos from the point of view of catching meteor strikes or imaging star trails.

allsky-image-clouds.jpg.28e5c1880d8a8391516c1c2d5d329423.jpg

Sensor temp has increased again - now at 32!

Edited by Adreneline
Link to comment
Share on other sites

31 minutes ago, discardedastro said:

 

Managed to assemble this fairly quickly - still using KStars for capture and PI for processing, and clearly this close to the house suffers from some lighting interference, but it works pretty well - quite happy with it optically as a starter for 10 with the cheap lens supplied by ZWO.

 

Have you combined kstars with the all-sky script from Pete? 

Link to comment
Share on other sites

28 minutes ago, jiberjaber said:

Have you combined kstars with the all-sky script from Pete? 

I haven't - I was going to have a stab at writing something up myself. Feels like a good bite-sized project to combine camera control via INDI with some simple automated processing; I'd like to try and write something in Rust or Python (using AstroPy/scikit/numpy). Hoping to do some automation e.g. automatically determine sky state, cloud cover, etc.

  • Like 1
Link to comment
Share on other sites

Definitely will need to arrange for some environmental control - currently 'tis a little hot in the box!

pi@unreliable-witness:~ $ sudo /opt/vc/bin/vcgencmd measure_temp
temp=80.0'C

Sensor sat around 60c.

I think a little 80mm fan or similar with a good fan filter to stop the bugs getting in and some decoupling to reduce vibration transmission will be required. Cool-down isn't going to be very fast in a sealed enclosure.

Link to comment
Share on other sites

19 minutes ago, Gina said:

Lens is too high in the dome - you'll get distortion round the edge.  The top of the lens should be just above that line round the dome.

Yeah, the distortion aspect is why I've kept my one low - I have some black foamboard and my current plan is to make a shroud for the lens to "peek out" from, flush with the bottom of the hole for the camera - if I then heat the dome in future this will also act as a thermal barrier to allow for easier heat regulation of the camera (as the dome will be airflow-isolated from the main box.

I'm also going to paint everything under the dome on the top surface with Black 3.0 paint (to avoid any issues with reflections), and then cover the rest of the box's topside/sides around the dome with aluminium foil tape - that'll help to reject most of the solar IR load, which will help minimise the thermal gain.

I've been tinkering with some simple simple CFD stuff to work out the best way to manage the airflow/thermals within the enclosure. I have a Noctua 40mm fan plus a pair of metal grilles and polypropylene filter material (to keep the bugs etc out) to match, so my current plan is to place two 40mm holes in the bottom of the box - since this makes avoidance of water ingress easier - and go with a simple push-vent setup, with a PWM controller for the fan to modulate it. I might cook up a little uC controller to manage the fan and the heating element based on the ambient temp and internal temp via a few temp sensors.

I do have enough room to accommodate a small cooled fan, but could also accommodate a peltier element and heatsink on the existing camera as a hack which would certainly be cheaper and probably be enough to get some consistency, which is key.

62225004_2020-08-1321_17_25-AutodeskFusion360(Personal-NotforCommercialUse).thumb.png.4359ec82d4438fcf88904d5e07a3a59f.png

I've also started writing an INDI client in Rust; this is a pain in the proverbial because Rust has no nice XML parsers (XML being something of a dying language, and certainly not typically used in the systems domain). A little bit of me is tempted to try and update indiserver to speak something sensible like JSON or CBOR but I stopped speaking C/C++ long ago! Still, I'm almost at the point of having two-way comms working, and from there it shouldn't be hard to do basic capture and start implementing control loops based on image brightness, etc. I suspect I'll end up building something of an ecosystem - Rust isn't a great language for astro (there is a FITS library, but very little in the way of existing astrophotography/image processing code, so it'd be first-principles-and-up) so shoving the images to a Python processor for the thinking might be easier, but on the other hand Rust is really easy to make correct, stable and verifiable code in and so strikes me as a fantastic language to write 24/7 AP/obsy code in - hence in part my desire to have an INDI client lib...

Link to comment
Share on other sites

Picked up my 3D printer (having a whole world of fun with that!) and finally finished fixing my pi into its enclosure. 
 

It’s just proof of concept tat the mo, as the mount is printed in PLA and I doubt that will stand up to direct sunlight. Will play with ABS once I’m more familiar with the printer. 
 

Anyway - photo below, power will run out the base, down a pipe and into a solar charger battery.  Need to source some neoprene or similar to seal the dome. 

32613E6F-09FE-47E5-96FC-46F0EA088337.jpeg

Link to comment
Share on other sites

3 minutes ago, wormix said:

Picked up my 3D printer (having a whole world of fun with that!) and finally finished fixing my pi into its enclosure. 
 

It’s just proof of concept tat the mo, as the mount is printed in PLA and I doubt that will stand up to direct sunlight. Will play with ABS once I’m more familiar with the printer. 
 

Anyway - photo below, power will run out the base, down a pipe and into a solar charger battery.  Need to source some neoprene or similar to seal the dome. 

32613E6F-09FE-47E5-96FC-46F0EA088337.jpeg

Oh, that's neat. I've got some aluminium tape which I'm using to wrap my enclosure (aside from the home) to help reject solar load - it'll also completely reject UV. Could layer that and/or black flocking over the PLA and it'd be fine for extended use I'm sure.

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