During the solar eclipse on March 20th 2015 it was nothing but clouds over here in The Netherlands.
So besides following the eclipse on TV I also watched the satellite images on the SAT24 site to track the Moon’s shadow over the continent.
I got the idea to create a small bash script that downloads the satellite images every X minutes in a separate directory.
Those images can be stitched together to create a nice movie.

So, here’s the code:

INFRARED=false
TMPDIR=/home/pi/sat24/tmp
IMAGEDIR=/home/pi/sat24/images
CURRENTIMAGE=$(date +"%Y%m%d%H%M")

wget -O $TMPDIR/temp.jpg "http://www.sat24.com/image2.ashx?region=eu&ir=$INFRARED"

MD5NEW=`/usr/bin/md5sum $TMPDIR/temp.jpg | cut -d ' ' -f 1`
MD5OLD=`/usr/bin/md5sum $TMPDIR/prev.jpg | cut -d ' ' -f 1`

if [ "$MD5NEW" != "$MD5OLD" ]; then
{
cp $TMPDIR/temp.jpg $TMPDIR/prev.jpg
cp $TMPDIR/temp.jpg $IMAGEDIR/$CURRENTIMAGE.jpg
}
fi

It’s pretty straight forward.
The image file name is the current date and time and a new image is downloaded using wget.

The only thing that needs an explanation is the md5sum stuff.
Sometimes it happens that the script downloads a image from a few minutes ago and not the current one.
That means that most of the time it’s an image you already have.
I guess this has something to do on the Sat24 side: web servers not in sync or load balancers that don’t balance load.
With md5sum you create a MD5 hash which is ‘unique’.
If the new image has the same MD5 has as the previous image, this new image can be discarded because you’ve already downloaded it.

To make this script run automatically, simply add it to the crontab (I’m using the cron of user pi on my Raspberry Pi here):

<code>*/4 * * * * /home/pi/sat24/sat24.sh</code>

I use intervals of 4 minutes but you can tune that if you like.
Oh, and do not for get to turn on the execute bit of your script.

Okay, you’ve been running this script for a couple of days and you’ve collected hundreds of images.
Now it’s time to stitch them together and make an animation!

Thanks to a great command line tool called avconv (previously known as ffmpeg), you can create a movie file using separate images:

cat images/*.jpg | avconv -f image2pipe -c:v mjpeg -i - -r 25 -map 0 -s 1280x780 -filter:v "setpts=4.0*PTS" out.mp4

Err…yes! It’s that simple!
Just cat the files and pipe them into avconv.
The -s 1280×780 parameter creates a 720p HD video file.
The -filter:v “setpts=4.0*PTS” parameter slows the playback rate down because 0therwise the animation goes a bit too fast. You can fiddle with the number to your taste.
The video created is called out.mp4 which you can rename if you want, of course.

And this is the result:

[embedplusvideo height=”569″ width=”640″ editlink=”http://bit.ly/1LOQlqs” standard=”http://www.youtube.com/v/HQTfJ9c49mM?fs=1&vq=hd720″ vars=”ytid=HQTfJ9c49mM&width=640&height=569&start=&stop=&rs=w&hd=1&autoplay=0&react=0&chapters=&notes=” id=”ep2165″ /]

Some double images might be downloaded once in a while, which you can delete by yourself by wading through the images directory.
Or you could write a script that checks and deletes duplicates for you.

SkySafari is a great astronomy app for smart devices like the iPhone, iPad and Android.
The SkySafari Plus and Pro versions add the possibility to remote control your GoTo telescope mount using the special SkyFi adapter.
This adapter sends serial (RS-232) commands, received with a wireless connection, to the handset of the GoTo mount.
Using SkySafari in combination with SkyFi increases the number of objects you can observe and current events in the sky (like comet PANSTARRS at the moment) are found easily this way.

I was wondering if it would be possible to create something like SkyFi using the Raspberry Pi.
And yes, it is possible. Quite easy actually!

What do you need?

  • Raspberry Pi configured with a working network connection (wifi preferred, of course).
  • USB to Serial cable.
  • GoTo telescope mount
  • PC Serial to GoTo handset cable. Shipped with your GoTo mount.
  • SkySafari Plus or Pro
  • Basic Linux knowledge

Now how are we to receive the commands from SkySafari?
This is done by the Serial To Network Proxy (ser2net).

Install ser2net:

sudo apt-get install ser2net

Add the following line, using your favorite text editor, at the end of the ser2net configuration file (/etc/ser2net.conf) which contains the port where ser2net is listening on:

4000:raw:0:/dev/ttyUSB0:9600 NONE 1STOPBIT 8DATABITS

In this case, I chose port 4000. You may choose another port but be sure it is between 1024 and 65535 and does not conflict with any other daemons listening on the same port.

Restart the ser2net service with the new configuration:

sudo /etc/init.d/ser2net restart

Next, configure your telescope in SkySafari.
My setup has a SkyWatcher SynScan GoTo on a EQ3-2 equatorial mount.
Be sure to enter your setup and don’t copy my settings bluntly 😉

skyfi_settings

The IP address in the picture above corresponds with my Raspberry Pi. Of course, you should enter the IP address of your Raspberry Pi.
Same goes for the listening port. I’m using port 4000.
If you configured a different one for ser2net, enter that one.

After that is done, you should try to connect SkySafari with your mount in the Scope menu and you’re off to go!

The Philips SPC900 and ToU Cam Pro II webcams are still very popular by amateur astronomers who want to try out some basic planetary astrophotography.
I happen to be such a person.
A few years ago I said farewell to the Windows operating system and started to use Ubuntu Linux.
I am still very pleased about my decision.

Last Friday was the first imaging session in a while.
Planet Jupiter was tracked by my mount, webcam was plugged into my telescope and connected to my laptop.
I started up my favorite capturing tool wxAstroCapture.
An over exposed image was displayed on my screen so I had to tweak around with the gain.

Bang! Kernel panic.

Using the sliders for controlling gain, brightness etcetera caused the operating system to crash.
After rebooting it happened again, thus so far an evening of webcam imaging 🙁

Now what’s the cause of this?

Philips webcams use special drivers (PWC) to make them work under Linux.
Imaging software such as wxAstroCapture and Qastrocam-g2 use the Video For Linux (V4L) API to communicate with these webcam drivers.
Version 1 of the V4L API was included with the older 2.6 Linux kernel but was replaced with V4L version 2 when Linux kernel 3.x was introduced.
The current status of the webcam drivers is that they aren’t 100% compatible with V4L version 2 and causes, in my case, the OS to crash.

The solution is quite simple: switch back to a Linux 2.6.x kernel.
When booting your machine, choose in the GRUB boot menu the Previous Versions option.
Select a 2.6 kernel version to your taste and the machine will boot with this version.

If you try to use your favorite imaging tool, you’ll notice it works like a charm again.

My laptop runs Ubuntu 12.04 at the moment. I guess switching to another kernel version on other Linux distros with this similar problem will be just as easy.

Happy camming! 🙂