Stream from your #RaspberryPi camera module using mjpg_streamer

After many hours trying to get streaming working with the PiCam, I found this solution on Miguel Grinberg’s blog. It uses mjpg_streamer to stream stills from the camera. You basically set up your camera to write single pictures to /tmp in timelapse mode and then mjpg_streamer pseudo-streams from the single image file.

You can read how to do it here.

When I did it, I ended up with a black picture. I believe this has to do with the speed at which the photographs were taken. My eventual script to start the stream was as follows:

mkdir /tmp/stream 2>/dev/null
nohup raspistill --nopreview -w 640 -h 480 -q 5 -o /tmp/stream/pic.jpg -tl 500 -th 0:0:0 -t 9999999 &
LD_LIBRARY_PATH=/usr/local/lib mjpg_streamer -i "input_file.so -f /tmp/stream -n pic.jpg" -o "output_http.so -w /usr/local/www" &

I teamed this streaming solution up with my PiRingo Christmas decoration so that people controlling the decoration could see it in action. I’ve yet to open this up to the public as I need a way of fixing the camera above the decoration. The cable is being a bit of a sod as it’s terribly springy!

rpi-update and apt-get update/upgrade on the #RaspberryPi explained

I’m just sitting here running updates on my Pi in an effort to get camera streaming working and I thought it would help to give an explanation of the various updates you might want to run. I found a rather good answer on Stack Exchange and thought I’d replicate it here for reference. Thanks to Caleb and Ivo Rocha for the original:

  • rpi-update is a tool to upgrade the firmware for your Raspberry Pi. Firmware is a small package of code that usually lives on a special chip of a computer that helps the software know how to talk to the hardware. However, in the case of the Raspberry Pi, the firmware will live on the first partition of the SD card.
  • Raspbian is an operating system or the core software for your Raspberry Pi. Software (including the OS) lives on second partition of the SD card and is all the stuff that gets executed when you use your device.

Both of these need updating independently. For convenience, the rpi-update tool is included in the Raspbian distribution of Linux because it is a useful software tool that manages the firmware of your Pi’s. You should run it periodically to make sure your devices have the latest firmware. Separately, you need to keep your software up to date using the standard Debian software management tools like sudo apt-get update && sudo apt-get upgrade.

Each of these functions is separate, and updating one will not update the other. Upgrading your distribution to the latest software packages might get you a new version of rpi-update, but unless you RUN rpi-update your firmware will not get updated.

Since the place the firmware is stored is actually flashed to the first partition of the SD card (sort of like a BIOS), you will not need to run this on every device. Once you load a new version of software or firmware onto an SD card, any device you plug that card into will be running that version.

Best practice

I added this bit after a blog comment from Foundation guru Gordon Hollingworth.

Please note that although the rpi-update updates the firmware, it also will update the linux kernel (if there is a new one!) But so will sudo apt-get upgrade…. So if you do it in the wrong order then you could upgrade the firmware (with rpi-update) and then downgrade it with apt-get update/upgrade

Make sure you do it in the following order:

  • sudo apt-get update
  • sudo apt-get upgrade
  • Then, if you want the bleeding-edge version… sudo rpi-update

That will make sure you end up with the latest version of the kernel.

As others have commented, rpi-update is useful if you want the latest, latest, latest version of the firmware, but does carry with it a few risks to the stability of your system.

Report from the #RaspberryPi Bake Off – 12th December 2013

Dorothy Molloy of Climbing Turn has blogged about her involvement as an Ambassador at the recent Raspberry Pi Bake Off held at North Herts College. She describes the number of kids they had involved and the tasks they carried out. Great reading. Well-known Raspberry Pi people David Whale (@whaleygeek), Ryan Walmsley (@ryanteck) and Charlotte Godley (@charwarz) were heavily involved in this and it’s nice to read all about this exciting event.

Read the account here

You can also ready Charlotte Godley’s account here

Linux User & Developer do another #RaspberryPi special @LinuxUserMag

The UK’s Linux User & Developer magazine (@LinuxUserMag) has once again come up trumps for Pi owners. This month they feature 10 projects for the Pi. I can’t list them here because I don’t yet have my copy (and I’m hoping for a subscription as a Christmas present!) but it’ll be an interesting read, as always!

For more information about this issue, click here