Wireless All Sky Camera

186,051

786

873

Introduction: Wireless All Sky Camera

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

Makerspace Contest

Participated in the
Makerspace Contest

46 People Made This Project!

Recommendations

  • Toys & Games Contest

    Toys & Games Contest
  • Furniture Contest

    Furniture Contest
  • Big vs Small Challenge

    Big vs Small Challenge

873 Comments

0
ckambiselis
ckambiselis

Question 2 months ago

Hi,
I'm trying to make this work on a Rock Pi S with their Debian Buster, I got it running with the GUI, but can't get the camera to show up on Live View, it only shows a broken thumbnail icon and on the images tab it is empty. I had to install a few things missing like make and usbutils, to get it to see my ASI178MM and rerun the install.sh but there is one error I can't get past

* Compile allsky software
cc capture.cpp -o capture -Wall -Wno-psabi -g -D_LIN -D_DEBUG -lpthread -DGLIBC_20 -lASICamera2 -I/usr/include/libusb-1.0 -lusb-1.0
/usr/bin/ld: cannot find -lASICamera2
collect2: error: ld returned 1 exit status
make: *** [Makefile:57: capture] Error 1

Thanks
Oscar

0
ThomasJ1
ThomasJ1

Answer 2 months ago

It looks like the Make script can't find the ASI library. It should be located in /home/pi/allsky/lib/{your architecture}/libASICamera2.a
What is your architecture? You can run uname -m to find out.

0
ckambiselis
ckambiselis

Reply 2 months ago

Hi,
Did the change in the Makefile and the error is gone, but I'm still not getting an image in Live View.

I do get this at the end of the install
* Autostart script
sed: can't read /etc/xdg/lxsession/LXDE-pi/autostart: No such file or directory
but I don't expect it to be a problem, and going to fix it later when I find the correct folder.

Did a service status check and I giving code=exited status=127, btw is it a problem that I run the install using the root user?

0
ThomasJ1
ThomasJ1

Reply 2 months ago

Are you saying that there is no liveview-image.jpg in the /home/pi/allsky directory or that the preview is broken on the GUI? or both?
There are 2 parts in the software. The allsky service captures images and saves them. The GUI gives you an interface to play with settings and view images easily.
The install should be run with sudo so I think you're fine.
You can disregard the LXDE-pi warning.
Is the user called pi as well on your system?

0
ckambiselis
ckambiselis

Reply 2 months ago

The preview is not available in the GUI, didn't check the folder, running the installation on a new image right now using the non root user just in case. No there is no "pi" user.

The installation just finished, and I'm getting a fatal error for
capture.cpp:5:10: fatal:error: opencv2/imgcodecs/legacy/constants_c.h: No such file or directory, pretty sure I didn't get that while on root, since it's pretty obvious in red color.

0
ThomasJ1
ThomasJ1

Reply 2 months ago

Check in the folder. Then you'll know if it's an issue with the capture or the GUI.

0
ckambiselis
ckambiselis

Reply 2 months ago

The image.jpg is the original from git, I also changed the settings to RAW8 and image.png since my camera is monochrome, but that didn't help either.

0
ThomasJ1
ThomasJ1

Reply 2 months ago

You should try running the software manually to get debug information.
cd ~/allsky
./allsky.sh

0
ckambiselis
ckambiselis

Reply 2 months ago

I finally got it somewhat working by adding the following in the original Makefile

ifeq ($(platform), aarch64)
OPENCV = $(shell pkg-config --cflags opencv) $(shell pkg-config --libs opencv)
CC = g++
AR= aarch64-linux-gnu-ar
CFLAGS += -march=armv8
ZWOSDK = -Llib/armv8 -I./include
endif


It takes pictures but it doesn't seem to use most of the camera settings.

0
ThomasJ1
ThomasJ1

Reply 2 months ago

Nice! If it takes pictures then it should be using the settings. Maybe it's not pointing at the proper camera settings file. Why do you say it's not using the settings?

0
ckambiselis
ckambiselis

Reply 2 months ago

Sorry about that, found the problem, even though the time was right, Lat and Lon was the default and it was running in daytime mode with auto exposure even though I was changing the ISO exposure settings. One weird thing is that the metadata overlay doesn't work at full resolution, but it might have to do something with the USB connection being too slow for full resolution since the board has only USB2 and I also get banding and sometimes partial frames.

0
ScottG221
ScottG221

2 months ago

I have an observatory with a PC. I have an extra small PC that I can install Linux. More powerful, Ethernet available, runs cooler. But I don't know Linux well. So my question: will this run on Ubuntu or similar distro or does it need the Pi hardware architecture?

0
ThomasJ1
ThomasJ1

Reply 2 months ago

It should run on any Linux distribution. I tested it about a year ago on Ubuntu.

0
rhine59
rhine59

2 months ago

Fantastic job - many thanks from the Yorkshire Dales Dark Skies National Park. Have built the Pi and website today and have the camera or order, so look forward to publishing the photos and videos. Richard Hine - UK

0
sbkirby
sbkirby

Tip 2 months ago

I've created the STL files for a 4" Threaded Mount for a RPi HQ Camera Module. The files also include a domed cover to fit on top of the mount. All these files are available at https://www.thingiverse.com/thing:4659815

allsky_camera.jpg4x4 Plug top.pngPXL_20201121_174519481.jpg4x4 Plug bottom.png
0
AlphaA3
AlphaA3

Question 3 months ago

I have two waterproof enclosure. One is rectangular and one is square but have transparent top. I was thinking to use the transparent top because you can see and check the components without opening the case, but I'm afraid the components itself including the raspberry pi will get damaged from the sun exposure due the transparent top. So which one do you guys think it's better? Both will use the acrylic dome of course. Thanks :)

IMG_20210204_121634.jpg
0
Romain84
Romain84

Question 3 months ago

Hello,
I have a small c++ question,
In the code capture.cpp when you call :
system("scripts/saveImageNight.sh &");
system("scripts/saveImageDay.sh &");
Do you know how I could pass as argument the current camera exposure time (the variable asiExposure I think) ?
So I can use this value in my own python codes that I call in saveImageNight.sh.
Thank you !

0
Frank59R
Frank59R

Question 4 months ago on Step 3

Hi Thomas,
first of all let me say that I am following your amazing projekt since 2 years. During the last days I found some time to download your latest version from github and to setup my ZWO cam together with my rpi 3. Almost everything seems to be running: gui is up, liveview ist working, service ist running.

There ist one single problem: keogram can't be compiled. I am getting this error:
keogram.cpp: In function ‘int main(int, char**)’:
keogram.cpp:141:2: error: ‘Rect2f’ is not a member of ‘cv’
cv::Rect2f bbox = cv::RotatedRect(cv::Point2f(), imagesrc.size(), angle).boundingRect2f();
^~
keogram.cpp:142:25: error: ‘bbox’ was not declared in this scope
rot.at(0,2) += bbox.width/2.0 - imagesrc.cols/2.0;
^~~~
Makefile:66: die Regel für Ziel „keogram“ scheiterte
make: *** [keogram] Fehler 1

I am running on raspbian stretch (updated this morning).

Can you help?

Best regards, Frank

IMG_1356.jpegIMG_1227.jpeg
0
ramonlopez
ramonlopez

Question 4 months ago

Good morning Thomas, congratulations on the project! I have managed to get my AllSky camera on and the image capture works correctly but not the timelapse, it only makes a file of approximately 48 kb and I do not know what the failure will be. The Startrails does not generate them either, only an image of a moment of the night appears. Thanks for your help!

Sin título.jpg