Wireless All Sky Camera

115,690

701

498

Published

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

15 People Made This Project!

Recommendations

  • Creative Misuse Contest

    Creative Misuse Contest
  • Clocks Contest

    Clocks Contest
  • Water Contest

    Water Contest

498 Discussions

0
user
CoreyS67

Question 23 days ago

Hi Thomas,

Great project! I have been looking to do this for a while and finally ordered in an ASI290MC.

I seem to have a problem with the images being completely washed out (all white). At first I assumed this was an issue of over-exposure (5 seconds), but after playing around I have found I get the same results no matter what exposure length I use. However if I change the file format to PNG instead of JPG, I get a good image. (Have attached a couple of manually generated examples - done during daytime with 250us exposure time.)

I assume this is something to do with the underlying image library but I'm not sure where to start. Any ideas what might be causing this or how to remedy?

Cheers and thanks!

Corey

PS: I recognize the image isn't in focus -- still need to fix that but figured I'd start with getting the image capture working first.

IMAGE.JPGIMAGE.PNG
3 more answers

Hi Corey,

What happens if you cover the lens? Does it still deliver an all white JPG image?

Hi Thomas,

Sorry for the delay in responding. I did finally get it working, but have spent the weekend rewriting things in Python instead of bash scripts and C++. (I'm just more comfortable in Python.) This also allowed me to set it up as a proper Service under systemd so I can restart things without a reboot if necessary.

If anyone is interested, I've posted the Python code at: https://github.com/smartc/skycam

Haven't had a chance to create a readme file yet so instructions are non-existent but hopefully legible enough for those who know Python. Will try to update with a Readme when I have a chance later in July. Have not gotten to Keograms or Startrails in the python code yet and my web programming is more than a little rusty so no GUI.

Note that my Python script also assumes you are using PushOver.net for notifications. Just comment out the relevant "import pushover" and "sendPushOverAlert(...)" sections if not of interest.

Cheers!

Corey

Thanks Corey, it's nice to have an alternative and I bet there's a lot of people who are already quite familiar with Python as well.

V0.6 is also using systemd. I haven't merged it into master yet as it's still in the testing phase.

0
user
TimD196

Question 22 days ago

Hi Thomas,

Very impressed with this project and am looking forward to installing permanently on the roof of the house! I have a couple of issues and wonder if you can help?

1. I'm using an ASI 178MC with RPi3. Keograms and startrails always create without problem, but timelapses always create a 0 byte MP4 file, no matter what the exposure and period settings are.

2. Setting the binning to anything other than '1' in setting.json gives the attached result. How can I correct this?

All the best and thanks for your awesome hard work.

Tim

image-20180625231603.jpg
4 more answers

Many thanks for taking the time to respond Thomas. I shall give that a try tonight and update you in the morning.

Any thoughts on the 'binning' issue, as binning 3x3 would not only give the same reduction in file size, but also allow my exposures to be reduced 9 fold.

All the best, Tim

startrails-20180625a.jpg

I will take a look at the binning issue. It's definitely a bug and I'll see what needs to be done in the code.
In the meantime, you can divide your width and height by the binning value as long as the camera supports that binning.
For example, the ASI224 supports binning 2x2, so I can set bin:2 and width: 652 and height: 488.

You'll have to check what the ASI178 supports.

Nice Startrails by the way !

Thanks matey...

ThomasJ1 says..."Nice Startrails by the way !"

All thanks to you and your hard work with the software. I just plonked the camera on top of the caravan roof and pressed go ;-)

Hi Tim, the ASI178 has a very large sensor so when it stitches images into a video, it takes a lot of RAM and throws an "out of memory" exception on the RPi. I think this memory usage can be adjusted but it would be better in your case to shrink the images before running them through avconv.

https://www.imagemagick.org/script/mogrify.php

You can call that command in timelapse.sh before calling avconv
I haven't tested it but it should look like this:
magick mogrify -resize 960x720 images/$1/*.$EXTENSION

Put that before the avconv line. Let me know if it fixes it or if you need more help on that.

Thomas

Hi Thomas,

Very impressed by the quality of your project.

I've decided to give it a go, with raspberry pi 3 and ASI 120MC-S. I've installed rasbian latest version (in headless mode), cloned the git repo, ran sudo ./install.sh, then plugged/unplugged camera, setup SFTP, installed the gui.

everything seems to work in that I can connect remotely, the gui is operational, BUT I don't get any image.

I tried to run ./allsky.sh and I get this below. Any clue what could be the problem?

Manu

pi@allsky:~/allsky $ ./allsky.sh

Starting allsky camera...

Resizing

******************************************

*** Allsky Camera Software v0.5 | 2018 ***

******************************************

Capture images of the sky with a Raspberry Pi and an ASI Camera

Add -h or -help for available options

Author: Thomas Jacquin - <jacquin.thomas@gmail.com>

Contributors:

-Knut Olav Klo

-Daniel Johnsen

-Yang and Sam from ZWO

-Robert Wagner

No Connected Camera...

Open Camera ERROR, Check that you have root permissions!

Information:

- Resolution:1980158340x2129579668

./allsky.sh: line 22:1270 Segmentation fault./capture $ARGUMENTS

pi@allsky:~/allsky $ Uploading

cd: Access failed: No such file (/allsky)

pi@allsky:~/allsky $

Screen Shot 2018-06-24 at 22.56.00.png
8 more answers

It looks like the camera is not seen by the code. Can you run 'lsusb' to see if it is listed properly?

It is the USB3 version of the ASI120 so you shouldn't need to do a firmware upgrade. I'm just trying to rule out a cable issue. Are you also using a good 2.5A power supply?

lsusb return

pi@allsky:~ $ lsusb

Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter

Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I'm not running an additional powersupply. I'm only using the USB cable to power the raspberry pi3 (which comes from the mac usb port). however it is a 2.1A usb supply. do you think that's not enough? a ASI consumes only 150 mA. and the Pi3 shouldn't consume more than 500 mA. so not sure that's the issue

Screen Shot 2018-06-26 at 09.15.11.png

Hi Emmanuel,

I am quite positive this is the issue. I've had previous users reporting the same kind of problem. If you have access to a 2.5A power supply, you could confirm this is the problem. The fact that the camera is not listed in your usb devices is a good indication.

USB3 ports can only deliver 900mA and USB2 deliver 500mA so I don't think the Pi + camera are getting enough juice here.

Interesting, i've switched to using a USB2 cable instead of USB3 and it works!. I get the live view. etc

next problem isI get

Uploading

cd: Fatal error: Host key verification failed.

Saving...20180626 21:10:5185 (0%) [Connecting...]

put: image-resize.jpg: Fatal error: Host key verification failed.

Resizing

Sometimes this happens when it's the first time you connect to a host. Let's say your host is myhosting.com, then you should try to open a terminal and ssh to it:

ssh myhosting.com

It should ask you if you trust this host and want to permanently add it to your known hosts. Just say yes and it should fix your problem with the allsky upload.

ok. I've ordered a 2.5A power supply I'll let you know. thanks

Hi Emmanuel,

Have you restarted the RPi after the install?
This error "Open Camera ERROR, Check that you have root permissions!" comes from the installation of the udev rules. ZWO's documentation says that in order to trigger the new udev rules, le camera has to be unplugged / re-plugged.
Another way is to simply restart the RPi.

That should fix your issue but let me know if you're still blocked.

Thomas

Hi Thomas, thanks for quick reply. I did restart the PI, I've also unplugged and re-plugged. doesn't do anything. any further clue?

Hello there

Ive looked at the entire bunch of files and everywhere where I found the /pi/ directory I have replaced it with /linaro/ hoping that this way I get the 178MM Asi camera running on my spare LInaro board but still no joy....
Any ideas what I still have to do or better formulated to correct the mess that I've probable made.

Thanks

1 reply

Hi Emil, have you replaced it in install.sh? I would start with this file and re-run the install script: sudo ./install.sh

Let me know how things go.

Thomas