Wireless All Sky Camera

131,410

719

634

About: Most of the things I build usually relate to either astronomy, physics or woodworking in general.

An all sky camera is a device designed to take pictures of the entire sky over a certain amount of time, usually to monitor meteor showers or other astronomical phenomena.

I built mine to monitor the northern lights. I live in the Yukon and we sometimes get beautiful aurora displays during the night. However, I also have a day time job and I need my 8 hours of sleep. I created this camera to record a movie of the entire night. That way, I can replay the movie in the morning and never miss any aurora night.

Step 1: Requirements and Materials

My requirements for this camera are the following:

  • needs to photograph most of the sky
  • needs high sensitivity to low light
  • should be weather proof
  • no wires should run to the house
  • needs to be autonomous
  • needs to create a movie from pictures and upload it to the internet
  • needs to start at dusk and stop at dawn

After thinking about it for a while, I decided that the device should include its own computer and send the pictures using wifi. As for the camera, I decided to use an astronomy camera that would be small enough and was powered over USB.

Here's the list of materials:

  • ASI224MC camera from ZWO (ASI120MC or MM works too and is cheaper)
  • wide angle lens Arecont 1.55 (It gives a wider field of view than the lens that comes with the camera)
  • Raspberry Pi 2 (or 3)
  • 64 GB micro SD card
  • Wifi module (no need if Raspberry Pi 3)
  • Short right angle USB cable
  • 4" ABS pipe with end caps
  • Acrylic dome

I thought about adding a dew heater but after a few month of testing, I never got any frost on the acrylic dome. This is possibly due to the heat produced by the raspberry pi itself.

Step 2: Wiring

In this instructable, I will assume that you already have raspbian installed on the SD card.

The wiring is relatively easy. Plug the USB cable to the camera on one side and the raspberry pi on the other. Plug the wireless dongle into one of the 3 remaining USB ports of the pi. Insert the micro SD card in its slot and plug the raspberry pi to its 5V adapter.

In order to keep things tidy, you can fix your camera and computer onto a plywood board like I did on the picture.

Step 3: Build the Enclosure

The enclosure is made of a 4" ABS pipe, a flat end cap and a threaded end cap with its lid.

The flat cap goes on top and is drilled to the diameter of the camera. The threaded cap goes at the bottom and a hole (for the extension cord) is drilled in the centre of the lid.

The acrylic dome can be fixed onto the top end using weather proof silicone. I used an acrylic ring but it makes things more complex than they need to be.

You can now fix the enclosure onto your deck, your roof or any other location with a good view of the sky.

Step 4: Software

Update: If you need to change the way the capture works, you might have to make changes to the C++ source and compile it on your Raspberry PI. To do this, follow PeterD192's detailed instructions in the comments.

Update 2 (Nov 11th 2016): I have set up a GitHub page with an install script to make things easier for everyone: https://github.com/thomasjacquin/allsky If you use it, you shouldn't have to use any of the following instructions.

Original Instructions:

In order to capture images with the camera, we need to run a program in the terminal. ZWO provides an SDK in order for developers to communicate with the camera. Using this SDK, I modified one of their C++ example and compiled it for the raspberry pi. Here's a list of dependencies that need to be installed in order to get the program running.

  • OpenCV to capture the image of the sky (You can get a compiled version here)
  • Sunwait to calculate the civil twilight of your location. There is a compiled version in the archive. Make sure you copy it to your path:
    sudo cp ~/allsky/sunwait /usr/local/bin
  • Required dependencies:
    sudo apt-get update && sudo apt-get install libusb-dev libav-tools gawk lftp entr imagemagik

To make things easy, I have attached an archive. Extract it at /home/pi/allsky.

From the lib folder, you will need to run this in order to use the camera without being root:
sudo install asi.rules /lib/udev/rules.d

You will also need to add libASICamera2.so to your library:
sudo cp ~/allsky/lib/armv7/libASICamera2* /usr/local/lib

Another thing you will need to do in order to automate everything is to run the main program on startup of the pi. You can open ~/.config/lxsession/LXDE-pi/autostart and add this line:
@xterm -hold -e ~/allsky/allsky.sh

Remember to set your wifi connection in order for the pi to upload videos.

allsky.sh contains all the parameters you might want to play with: GPS coordinate, white balance, exposure and gain.

Step 5: Collect Images

Now that the raspberry pi is ready, you can plug your all sky camera. The startup script should call allsky.sh which in turn calls the binary file named "capture". It will determine if it's day time or night time. In case it's night time, the capture will start and take a picture every 5 seconds (or whatever value you set in allsky.sh). At the end of the night, the capture will stop and avconv will stitch them together and upload a video to your website using FTP.

Step 6: Watch Your Time Lapse Videos

The video produced by avconv should weigh between 30 and 50 mb depending on the length of the night (here in the Yukon, we can get from 18 hours to 0 hours of night time) and should be viewable on any web browser.

In the event that you find something interesting in the video, you can access the individual images on the raspberry pi. They will be in a folder named after yesterday's date.

Here's a page showing my own videos with almost all night archived starting January 18th 2016. Some have beautiful northern light, others have clouds, snow or rain.

Space Contest 2016

First Prize in the
Space Contest 2016

23 People Made This Project!

Recommendations

  • Trash to Treasure

    Trash to Treasure
  • Tape Contest

    Tape Contest
  • Arduino Contest 2019

    Arduino Contest 2019

634 Discussions

0
None
StewartW20

5 weeks ago

Hi,
first of all this project is superb and am just setting up
i am going to use the GUI and have a couple of questions...
first of all when I boot the rpi will the camera start recording images straight away, all settings at default, or do I have to start it somehow, as I can’t see a way to do this via the GUI
so if it does not start straight away on boot, then how do a start via GUI...
i can see the commands to do it via the terminal, but am wanting to avoid that if possible...
many thanks..
secondly where can I see the finished video the next day, I am not using a web site for upload, just want to view myself, so I assume it’s stored on the rpi somewhere...?
stewart

1 reply
0
None
dnubeStewartW20

Reply 4 weeks ago

Hi Stewart,
Images should get stored in a directory with the date such as here:
/home/pi/allsky/images/20190313/

I believe the Pi should start recording images by default, on boot-up. It will only capture images at night. Depending on version it might also capture a "live" image during the day by default (can't remember if this option was on or off by default in latest version).

If you have configured it to use the GUI interface, the settings are stored in a different place, namely:
/var/www/html/settings.json

Hope this helps.
DaveNL

1
None
dnube

Question 6 weeks ago

178MC Gain/OffsetI've finally got around to playing with gain/offset settings on my
178MC. Had been using gain 139 offset 50 for a number of months - I
think this is default, or maybe unity. Or might have been default
settings for a different model ZWO - can't quite remember!



Anyway, one evening last week during early dusk, I experimented with different settings. From what I found from this web site:


https://www.astrobin.com/forum/c/astrophotography...




these are a picklist of gain/offset options provided in the camera's ASCOM driver:

ASCOM1 180 25 (Unity?)

ASCOM2 0 25 (highest Dyn Range?)

ASCOM3 270 340 (lowest read noise?)



also found reference to this setting somewhere:

Other1 200 150



So tried them all and found that Gain 270 Offset 340 gave the best result (ie. areas in shadow were brighter). Have been running with
this for a few days and can definitely notice increase in number of
stars visible. For comparison, here is time lapse before change (Gain
139 Offset 50):


https://youtu.be/1IJiNhrs6YU




And here is video from Sunday past with Gain 270 Offset 340.


https://youtu.be/GvrX5WLSfZ0




Have to admit I'm still at bottom of learning curve when it
comes to these cmos cameras. Anyone else have
experience/observations/suggestions on gain and offset settings for the
178MC (or any other ZWO for that matter)?





DaveNL

PS. Note that to change the offset - it is the "Brightness" value in settings.json file.

0
None
plawlor

8 weeks ago

I'm having an issue with one of my allsky cameras. Was having issues with 120MC, so swapped it out for a 224MC and rebuilt the Pi from the ground up. It took one image when it first booted, but will not take any more pictures. Live View continually shows the first image. Log file shows:

Feb 20 16:05:05 allsky allsky.sh[602]: /home/pi/allsky/allsky.sh: line 25: 658 Segmentation fault. /capture $ARGUMENTS

Same log entry on every image capture attempt since.

Any thoughts?

Thanks.

8 replies
0
None
plawlorplawlor

Reply 6 weeks ago

Funny story :)

I climbed the ladder and opened up the housing so I could pull the SD card and rebuild from scratch. Discovered that the USB cable somehow became disconnected from the Pi :) Who knew? All good now. Sorry for wasting your time. I probably should have checked that first!

Peter

0
None
ThomasJ1plawlor

Reply 8 weeks ago

Also, did you modifiy the settings through the GUI or by editing settings.json manually? The one that needs editing is at /var/www/html/settings.json

0
None
plawlorThomasJ1

Reply 7 weeks ago

Hi Thomas,
Yes, using the GUI and the settings I posted are from /var/www/html/settings.json.
I've tried both changing exposure and resetting all settings to default. Same behaviour.
I think my next step will be to rebuild the Pi again and see what happens.
Peter

0
None
ThomasJ1plawlor

Reply 8 weeks ago

Do you see the same behaviour with the default settings?

0
None
ThomasJ1plawlor

Reply 8 weeks ago

Can you try setting the exposure to something different such as 1000?

0
None
plawlorThomasJ1

Reply 8 weeks ago

Done. No change in behaviour.

0
None
plawlorThomasJ1

Reply 8 weeks ago

settings.json:
{"width":"0","height":"0","exposure":"0","maxexposure":"7500","autoexposure":"1","gain":"75","maxgain":"75","autogain":"0","gamma":"50","brightness":"50","wbr":"53","wbb":"90","bin":"1","delay":"10","daytimeDelay":"5000","type":"1","quality":"95","usb":"40","filename":"image.jpg","flip":"0","text":"","textx":"15","texty":"30","fontname":"0","fontcolor":"255 255 255","fonttype":"0","fontsize":"0.7","fontline":"1","latitude":"46.3N","longitude":"63.01W","angle":"-6","time":"1","darkframe":"0","showDetails":"1"}

config.sh:
#!/bin/bash
source /home/pi/allsky/scripts/ftp-settings.sh
# Set to true to upload current image to your website
UPLOAD_IMG=false
# Set to true to upload timelapse video to your website at the end of each night
UPLOAD_VIDEO=true
# Set to true to send data to your server at the end of each night
POST_END_OF_NIGHT_DATA=false
# Set to true to generate a timelapse at the end of the night
TIMELAPSE=true
# Set to true to generate a keogram at the end of the night (image summary of the night)
KEOGRAM=true
# Set to true to upload the keogram after it has been generated
UPLOAD_KEOGRAM=false
# Set to true to generate a startrails image of the night. Will skip brighter images to avoid over-exposure
STARTRAILS=true
# Images with a brightness higher than the threshold will be skipped for startrails image generation
BRIGHTNESS_THRESHOLD=0.1
# Set to true to upload the startrails after it has been generated
UPLOAD_STARTRAILS=true
# Set to true to enable automatic deletion of archived data (images + videos)
AUTO_DELETE=true
# Set this value to the number of archived nights you want to keep. Needs AUTO_DELETE=true to work
NIGHTS_TO_KEEP=30
# Path to the dark frame for hot pixels subtraction. Can be jpg or png.
DARK_FRAME="dark.png"
# Set to 0 to disable Daytime Capture
DAYTIME="1"
# Path to the camera settings (exposure, gain, delay, overlay, etc)
CAMERA_SETTINGS="/var/www/html/settings.json"

Thanks,
Peter

0
None
RedAxis1

7 weeks ago

Hi Thomas,

I'd like to say this is a amazing bit of software, I've never used a Raspberry pi before and found following your instructions very easy to follow and use. I have my allsky up and running, just having one small issue, I hope you might be able to tell me what I'm doing wrong?

I get all the images, star trails, Keogram and can log in and see everything, but the timelapse file is showing as 0 bytes, every single jpg image has a file size. It's just the timelapse.

Timelaspe=true in the settings

Any help would be much appricated, thank you in advance.
David

7 replies
0
None
ThomasJ1RedAxis1

Reply 7 weeks ago

Hi David,
Can you try generating it by hand?
./scripts/timelapse.sh 20190226 for example
This should give you a bit of feedback in the terminal. What camera do you use?
Thomas

0
None
RedAxis1ThomasJ1

Reply 7 weeks ago

Hi Thomas, Thank you for your reply.. I tried running the script, looks like it failed, please see attached image. Camera is ZWO ASI178mm

IMG_0066.JPGIMG_0069 (1).JPGIMG_0064.JPG
0
None
ThomasJ1RedAxis1

Reply 7 weeks ago

Hi David,

Looks like a memory allocation issue. This happens with cameras that have a very large sensor. The Raspberry Pi is a small computer and it doesn't have the capacities to allocate more memory to the avconv process.
There are a few ways to fix it, you can run the image magick's mogrify command to shrink all your images before running the timelapse or you can set bin 2 in the camera settings.
For images already taken, try the mogrify function from the images directory. ex:
mogrify -resize 50% *.jpg
For future images, just set the binning mode to 2. Owners of this model have reported it to fix the problem.

Thomas

0
None
dnubeThomasJ1

Reply 7 weeks ago

Hi Thomas/David,
I have the 178MC and had similar memory issues. Binning 2x2 is an easy approach but I did not want to lose so much resolution. So I ended up experimenting with the Mogrify command. And found that using 75% resolution worked for me:
mogrify -geometry 2322x1560 -path /home/pi/allsky/images/$1/75/ /home/pi/allsky/images/$1/*.jpg
(I create a new folder for the mogrified images, create the timelapse and then delete the mogrified images. That way I can keep the original full resolution images).

I also adjusted the Pi3s SWAP space following this post:
https://www.raspberrypi.org/forums/viewtopic.php?t=78759

Takes several hours to complete the timelapse (currently finishes about 1pm) but it has been stable consistent for weeks now.

DaveNL

0
None
RedAxis1dnube

Reply 7 weeks ago

Thanks Dave, I will give this a try, really helpful

0
None
ThomasJ1dnube

Reply 7 weeks ago

Thanks for the feedback Dave, that's really helpful.

0
None
RedAxis1ThomasJ1

Reply 7 weeks ago

Thank you so much, makes a lot of sense.. I will give this a try.
David