Apr 282016

About a month ago, I was contacted by the Kano team and was offered an awesome chance to try out their amazing Kano Computer kit.

I received it earlier this month but didn’t get to play with it until now, but as they say, patience is a virtue!
But without further ado, lets start having a look at the Kano Computer Kit.
Continue reading »

Apr 232016

For those who actually do follow my blog, you may have noticed the lack of posts recently. This has been because I’ve moved house!
But I do have some posts that I really do need to get to, and also still need to try and set up my workspace so I can get back to putting up quality posts.

For those who would like to check out what I have coming up, keep reading!
Continue reading »

Dec 302015

The SD Card on my Raspberry Pi died this week. So I decided that this time, I’d use Salt to manage my Pi and not have to worry about backing up my configuration from the Pi itself as Salt would be managing it for me!
Continue reading »

Nov 182015

I’m a Dad/Electrical Engineer/Tinker/Hacker/Woodworker/crazy hobbyist and I’m always building weird projects. I thought my latest project “RPiKids” was worth sharing with everyone. I have young kids with NO exposure to console gaming. I wanted to build them a system that was not just fun, but a system that could begin to explain at least the hardware fundamentals of computers. Watching their little faces soak in the Linux command line kernel unpacking, installing all sorts of subconscious goodness has been a real joy!
Continue reading »

May 212013

I recently had an email from one of my readers enquiring about making timelapse videos with the Raspberry Pi.

Since I already had a webcam connected to one of my Pis, I set about making it take timelapse shots.
There are a myriad of ways to accomplish this, but I decided to use motion as it took the least configuration to get it to do what I wanted it to do.

Getting motion was as easy as apt-get install motion on my Raspbian powered Pi.
I also needed mencoder to encode the resulting images into a video. Mencoder is also found in the repositories, so a quick apt-get later and I also had mencoder installed.

In order to get timelapse shots, I had to setup motion to take pictures at intervals.
On line 295 in the default motion.conf, there is this following line

snapshot_interval 0

Change that to the number of seconds between each snapshot.

snapshot_interval 5

I’m also allowing remote access to the webcam so that I can check in on it.
On lines 413 and 429, change the webcam_localhost and control_localhost to off.

After changing those, I restarted the motion daemon for the changes to take effect.
Once motion is started, you will start seeing files in /tmp/motion (or wherever you decided to save the files)
The ones ending in -snapshot.jpg are the ones that we will be using for the timelapse movie.
If you have motion detection activated, you will see other files in the directory but we can ignore those.

To create the movie, we are going to use mencoder. This part could also be done with ffmpeg, which I may cover in a later post.
I wrote up a small script to run the mencoder command –

mencoder mf:///tmp/motion/*-snapshot.jpg -mf w=320:h=240:fps=25:type=jpg -ovc copy -oac copy -o output.avi

The resolution (-mf w=320:h=240) should match the resolution setup in motion.
When the script is run, it will take all files in /tmp/motion/ that end in -snapshot.jpg and make a movie out of them. The output file is set by the -o switch, in this case I’ve used output.avi.
Setting this script to run once a minute for example, will keep the timelapse video up-to-date to the last minute.

Once the file has been created, you’ll be able to view the file on another computer very easily.
The only issue with this timelapse movie, is that it will keep getting longer and longer and longer, as there is nothing cleaning up the old files.

So what we’ll do, is add an extra line into the script to remove any files older than a certain time, and that way we can control the length of the timelapse movie.
If we wanted to make the timelapse movie 10 minutes only, we’d add the following line before the mencoder line

find /tmp/motion -name "*.jpg" -type f -mmin +10 -delete

Resulting in this

find /tmp/motion -name "*.jpg" -type f -mmin +10 -delete
mencoder mf:///tmp/motion/*-snapshot.jpg -mf w=320:h=240:fps=25:type=jpg -ovc copy -oac copy -o output.avi

That way, whenever the script is run, we’ll have a 10 minute long timelapse video !