The night sky is perhaps the greatest natural visual experience known to man. It's there, above us, on a nightly basis, and yet so few of us know what to look for. But with a bit of night time photography, that can change.

Of course, few of us own cameras that are suitable for snapping in darkness. Even if you did, sitting up until dawn with a tent and a flask of your favorite warm drink might not be your ideal night out. That's where our old friend the Raspberry Pi, complete with a camera module, comes in.

Getting Night Photography Right With a Raspberry Pi

I've been trying to snap the stars and moon -- perhaps even the Aurora Borealis -- using my Raspberry Pi for months. Almost every time, it fails, or at best returns distinctly average photos and timelapses.

And then I go on YouTube and see videos like this:

So where am I going wrong? Where are you going wrong, when your photos of the night sky look like a chalkboard at best? Let's find out.

6 Things You Need for Night Photography With a Raspberry Pi

You can't just pop outside and take a photo of what's above you with a Raspberry Pi. Several peripherals and conditions are required to make it worthwhile.

1. A Clear Night

This might seem entirely obvious, but you would be surprised at the number of people who try to photograph the sky (or specifically the moon) and wonder why their photos are largely grey or brown.

Now, it's unusual to get an entirely clear night in many places, and a few clouds never hurt anyone. But if you're in a location that gets a lot of cloud and inclement weather, the solution is simple: wait until a change in season, or move elsewhere.

2. No Light Pollution

In some parts of the world, the deep, dark blue night sky is a tremendous spectacle, with stars, planets, shooting stars, even satellites whizzing by, all visible to the naked eye.

But in more developed areas, the sky is less blue, less deep, and its features less defined. For this, we can thank light pollution: the bleeding of light from heavy industry, busy roads, and large towns and cities. In short, light pollution is an irritating phenomenon, that stops you observing the heavens with as much clarity and depth as you might like. And it causes problems for photography, too.

While man-made lighting can make for an interesting photo, you'll miss out on so much of the night sky if you don't take steps to vanquish it from your images.

3. A Portable Power Source

Unless you live in a rural area, simply sticking the Raspberry Pi in your backyard overnight isn't going to cut it, thanks to light pollution.

As such, you're probably going to need some sort of portable power source, such as a rechargeable battery that will deliver enough juice to the Pi to keep it going overnight. If you're feeling particularly creative, you could take the DIY option and build your own battery pack with six or more AA batteries. I used a compact RAVPower battery on my previous Raspberry Pi time-lapse projects, which gave perfect results over several hours without any considerable drop in charge.

You will, of course, also need the right Raspberry Pi hardware.

4. Raspberry Pi 2 or Later

You might find it possible to do time-lapse with an original Raspberry Pi or a standard B+ model, but for the best results you need a device that can handle many images snapped over a long period. As such, we would recommend the Raspberry Pi 2 or Raspberry Pi 3.

5. Raspberry Pi Camera Module

You don't have to be strict about this, as various USB cameras are compatible with the Raspberry Pi. However, we can't stress how much more of a superior experience you will have using one of the two official camera modules.

camera raspberry pi device

At the time of writing, the Raspberry Pi Foundation has released two cameras: a standard PiCam module, followed by a NoIR model. The latter is designed to filter out infra-red for photographing in darkness. This doesn't necessarily mean that the NoIR device is better for night time photography, however!

In truth, either should be fine. We used a Raspberry Pi camera module, so everything that follows is based on that set up.

6. A Tripod or Mount

Finally, you need to have some sort of equipment to mount your Raspberry Pi. This might be a standard camera tripod (of the type used for a DSLR), or a mobile phone tripod. Whichever you choose, you need to make sure that the Raspberry Pi and its camera module are securely mounted, and positioned firmly, safely, and level.

It might be a bit tricky to get a smartphone tripod level, but the main concerns are safety and stability. You'll also need to make sure the battery or power supply is safely positioned. Duct tape may prove useful here!

Find Your Position

Our tips on how to connect your Pi to a laptop over SSH without access to your home network will prove useful here. Otherwise, you can simply set the time-lapse script off at home, then head out. When it comes to compiling the time-lapse, simply omit the irrelevant images.

As alluded to above, different locations will yield different results. This example is in a place of considerable light pollution:

What is lacking -- thanks to the light -- is depth. Although you cannot see the light physically polluting the sky, the heavens are simply not dark enough to reveal the real depth. Bad weather made it impossible to follow this up with a second time-lapse. Less light pollution would deliver a far superior collection of images.

This particular shot involved weather-proofing the Raspberry Pi, which essentially meant sealing it in a plastic box with a small hole for the camera module. I chose a box large enough to hold the camera module, too, and left it overnight in moorland. Next morning, the Pi was still running, and the results above speak for themselves.

Time to Start Snapping

Once you're ready, you'll need to input a suitable command. We can use the raspistill command for this, which will work on a fully updated Raspberry Pi (remember to update the Pi after installing the camera module if you've bought one recently).

With the Pi and camera module in position, you can run the script, preferably in a new directory with an appropriate title

        mkdir space
cd space

Python scripts can be used, but the raspistill command is a more instantaneous and easily configurable option.

        raspistill -rot 90 -ss 1900000 -ISO 800 -t 21600000 -tl 60000 -o image%04d.jpg -w 1280 -h 960
    

In this example, we have set:

  • Rotation to 90 degrees (-rot 90) for a landscape shot.
  • Shutter speed to 19 seconds (-ss 1900000).
  • ISO to 800 (-ISO 800).
  • Total capture length 3 hours (-t 21600000).
  • Time-lapse delay of 60 seconds (-tl 60000).
  • A resized image of 1280 x 960 (-w 1280 -h 960).

The latter option is important to keep the amount of space taken by the time-lapse photos to a minimum. Especially useful if you have a basic 8 GB microSD card!

We'd recommend tweaking these settings and taking single image photos to check the quality before running a time-lapse. Simply remove the time-related conditions, and specify a filename:

        raspistill -rot 90 -ss 1900000 -ISO 800 -o image-test.jpg -w 1280 -h 960
    

Once you're happy, run the command with the tweaked conditions, specific for you're the scenes you're hoping to capture.

You can then leave the Pi to its own devices. Perhaps you could connect over VNC occasionally to check the progress of the time-lapse.

Take It to the Next Level

Once you have mastered making a night-time time-lapse movie with your Raspberry Pi, you might like to try some slightly different approaches.

Do You Want Trails With That?

While time-lapse photography is great for recording the motion of heavens, another option is available. If you've ever spent more than a few moments looking at night sky photography, you'll have come across some shots that look like a series of broken concentric rings. These are trails, stars photographed over a long exposure time, given the impression of movement.

For this more detailed observation of what is taking place above you, consider a dedicated piece of software called Meteotux Pi.

Again designed to capture trails, the results are quite stunning, almost like a game of Missile Defense!

Describing itself as a "program to record continuous high resolution images of night time fireballs, aeroplanes, satellite flashes, etc." Meteotux Pi comes with full instructions and yields some stunning results. The developer has included a time-lapse script in the instructions, and suggests you run it from 4 PM to 7 AM.

Show Your Night Sky Time-Lapse to the World

Okay, so you should now have a reasonably good time-lapse of the night sky. At worst, you'll have a few constellations skating across the screen. You might even have the moon in there, or one or two planets -- not that they'll be particularly identifiable.

For that, you'll need to change the way you focus on the stars. A telescope (or perhaps binoculars mounted on a tripod) is the answer here. With most cases, the Pi is light enough to not cause any problems with the balance of a telescope or binoculars. The best results will be gained by attaching the camera module directly to the optical device's eyepiece, however. If this is a problem, you can swap the ribbon cable for a longer replacement -- up to four meters!

Again, you can use time-lapse here, or perhaps even video. Focus your telescope on the Moon, or even capture Saturn's dance across the sky.

You can do all of this and more. Share your results below and let us know how you got on using your Raspberry Pi to photograph the night sky!

Image Credits: Nattika/Shutterstock