Wednesday, November 12, 2014

Raspberry Pi Video capture

License for copying

How To Create A Raspberry Pi Video Capture Unit – Part 1

One hundred and fifty posts later I decided I should really complete a project I’ve been thinking about ever since I got my first Pi. That is a simple video capture unit that would be able to record video, in a loop, with the minimum amount of hardware and setting up.

I wanted a standard setup I could quickly deploy around the house, garden, car or bike. The software needed to be easy to setup so I could use it at short notice. I also wanted it to be basic enough that someone else could use it as a basis for their own Pi camera projects.
This sort of idea isn’t exactly unusual and there are plenty of Pi based camera projects out there but I wanted something I was happy with and did exactly what I needed without any fancy features. Re-inventing the wheel can be fun despite what other people might tell you!


My requirements were something along these lines :
  • Easy and quick to configure
  • Basic Python script that is easy to follow
  • Ability to define number and duration of video files to store
  • Minimise hardware items
  • Minimise wiring, soldering and construction time
  • Provide a method to stop recording and correctly shutdown Pi
  • Provide a quick method to attach to a tripod
  • Provide a method to review footage on a PC
Although there are plenty of additional features I could have added I wanted to keep this simple. So you won’t see WiFi, Bluetooth or any web connectivity in this version.
Here is a photo of my finished system :
RPiSpy Video Capture Unit


The hardware I used is listed below :
  • Raspberry Pi (Model B)
  • Cyntech standard case
  • 8GB SanDisk SD card
  • 32GB Kingston Flash Drive
  • Camera module
  • 8mm metal washer
  • 3D printed tripod mount
  • RAVPower RP-PB13 14000mAh USB power bank
RPiSpy Video Capture UnitI needed 1 switch and 1 LED so used an already assembled BerryClip add-on board. This was a quick way of giving me an LED and Switch without me needing to do any additional wiring. You can easily complete this project with your own LED, switch and resistors wired up to the appropriate GPIO pins. In order to fit everything in the case I need to drill holes to accommodate the LEDs, buzzer and camera. The switch was recessed but still usable.
Sticky pads were used to secure the camera in place. The metal washer was glued in place on the outside to allow cheap magnetic lenses to be attached if required.

Tripod Mounting

In this project I used the Cyntech case as it is good value, easy to modify and has a nice Raspberry Pi logo on it. My friend Graham 3D printed me a plastic insert which held a metal nut compatible with my tripod. This beautifully simple modification makes the whole unit easy to mount in a fixed position without having to balance it on piles of books.


When the Pi is powered up a cron job is started which looks for a network connection. If there is no network the main Python script is run. I didn’t want the script to start when connected to a network as this is when I wanted to download video without the camera being active.
The main script reads the configuration file and starts recording a video file. The files can be saved onto the SD card or a USB flash drive. When the pre-set duration is reached the file is closed and a new one is started. If the total number of video files reaches a pre-set limit then the oldest one is deleted. The device can continue recording over-writing files as required.
The configuration file let’s you set the total number of files to keep, the duration of each file as well as camera properties such as frame rate and resolution.
When you are finished you can hold down the button to quit the script and shutdown the operating system. The power can then be removed.

RAVPower RP-PB13 14000mAh Power BankPower

Around the house it is easy enough to use mains power but when I want to use the unit on the car or bike I just use my Ravpower RP-PB13 14000mAh USB power bank. I’ve had this battery for a while now and it has been in fairly regular use in my household.

Car Mounting

With a windscreen mount from eBay it’s easy to create a simple dash cam!
Dash Cam Windscreen Mount
Here are some additional photos :
Part 2 details the installation and setup procedure if you are interested in creating your own version.
How To Create A Raspberry Pi Video Capture Unit – Part 2

How To Create A Raspberry Pi Video Capture Unit – Part 2

Following on from Part 1 I’ll explain how you can install the Python software and get your own Video Capture Unit up and running.

You don’t need to build your unit in exactly the same way as mine but as a minimum you need :
  • Raspberry Pi
  • SD card with Raspbian
  • Camera module
  • 5V power supply
  • 1 LED attached to GPIO4 via current limiting resistor (ie 330 ohm)
  • 1 Switch attached to GPIO7 with 10K pull-down to ground
If you want to be able to easily transfer video files to a PC you might also want to use a :
  • USB Flash Drive (8GB+)
The setup might be spread over a desk or installed in raspberry pi case. The choice is yours.
RPiSpy Video Capture Unit


The software is available from the RPiSpy Video Capture Unit BitBucket repository and consists of the following main files :
  • instructions.txt
  • prepare_mp4.bat
This file contain the user defined settings used by It allows the user to adjust various parameters. If “/boot/” exists it is copied over this config file. The can be used to edit settings on a Windows PC which can see the /boot/ partition on the SD card.
This script is run when the Pi boots. It looks for a network connection and only runs if it doesn’t find one. This allows the Pi to boot normally when you have connected it to your network to copy video files.
Summary of these installation instructions for reference.
This script provides an easy way to convert the recorded h264 files to MP4 files. It may take a while to convert depending on the total duration of the videos. It uses MP4Box and is meant to run via Windows.
This script provides an easy way to convert the recorded h264 files to MP4 files. It may take a while to convert depending on the total duration of the videos. It uses MP4Box and is meant to run on the Pi itself.
This is the main Python script which does most of the work. It is called from when the Pi boots.


First prepare a fresh SD card with Raspbian. Use a recent download from the official site. Why Raspbian? I use it for everything!
Power up the Pi and login. You will now be in the home directory. Expand the file system and Enable the Pi Camera using the config tool :
sudo raspi-config
Ensure you’ve got the latest firmware using :
sudo rpi-update
Create a new directory and navigate into it :
mkdir rpispy_vcu
cd rpispy_vcu
Now we can download the archive file from BitBucket using :
If you type ls you should see the master.tar.gz file sitting in the current directory. Use the following command to extract the files from the archive :
tar -xvf master.tar.gz --strip 1
Typing ls should show you a list of the files :
You can remove the archive now using :
rm master.tar.gz
The Python scripts control the Raspberry Pi Camera Module using the Picamera module. This is installed by default on the latest version of Raspbian.
Then finally install MP4Box (aka gpac) which can be used to convert the h264 files recorded by the camera to slightly more usable MP4 files :
sudo apt-get -y install gpac

Config File Setup (optional)

If you want to be able to edit the config file in Windows you will need to place a copy in the /boot/ directory. You can do that using :
sudo cp /boot/
When the script runs at boot time it will check if there is a file in /boot/. If there is it copies it over The main script would then run and use the new settings.

USB Flash Drive Setup

In order to save our video files to a removable drive we need to get the Pi to automatically mount the USB flash drive. This is a fairly easy process and is described in my How To Mount A USB Flash Disk On The Raspberry Pi tutorial. Follow the tutorial so that your drive is mounted as “/media/usb”.
If you don’t want to use a USB flash drive and you want to store videos on your SD card you will need to make a directory :
mkdir ~/rpispy_vcu/videos
and set the VIDEO_PATH parameter in the file to point to ‘/home/pi/rpispy_vcu/videos/’. Don’t forget to update /boot/ if you are using that file.

Autorun On Boot Setup

To run the script automatically when the Pi boots you can use ‘cron’. To edit it we use the command :
sudo crontab -e
Using your cursor keys scroll to the bottom and add the following line :
@reboot python /home/pi/rpispy_vcu/ &
Make sure you get this line correct as the script will fail to run on boot if there are any mistakes. Note that it ends in an ampersand symbol.
To save these changes click “CTRL-X”, then “Y” and finally “Return”. You should now be back at the command prompt.

First Run

RPiSpy Video Capture UnitShutdown your Pi and remove the power. Disconnect your network cable. Reconnect the power and boot the Pi. The Pi will boot and you will hear the buzzer sound once. The camera is now recording!
When you want to stop recording hold down the button until you hear a double beep from the buzzer. The Pi will shutdown. Wait 10 seconds before removing the power cable.
In part 3 I will cover converting the resulting video files into MP4 files which makes them easier to play in a media player or editing application.
How To Create A Raspberry Pi Video Capture Unit – Part 3

How To Create A Raspberry Pi Video Capture Unit – Part 3

In Part 1 and Part 2 of this set of articles I explained how I made a simple video recording device with the Raspberry Pi, a camera module and a plastic case. It’s simple enough to be mounted wherever you need a video camera.

In this final part I will explain how I extract the resulting video files from the unit and convert them to MP4 files. This makes them easier to play on other devices and media software.

Converting The Files Directly On The Pi

To convert the files using the Pi you can use the “” script. Plug the Pi into a network and power it up. We do not want the Pi to start recording video but the main script will not run if a network connection is detected.
The script uses MP4Box to do the conversion. If you haven’t installed it previously you can do so using :
sudo apt-get install gpac
Now you can navigate to the location where your video files are and check a copy of the script is present. Run the “” script using :
It may take a while but the h264 files in the directory will be converted to MP4. You will need to make sure there is sufficient space available to do this as you will end up with a h264 and MP4 file for each clip.
Once the script has finished you can transfer the resulting video files via SSH or FTP to another computer.

Converting On A Windows PC

My preferred method is to write the video to a USB drive. This can then be plugged into a PC and the “prepare_mp4.bat” script will then convert the h264 files and give you a set of MP4s. In order to use this method you will need to :
Your MP4 files will be prepared and saved in the “d:\temp” directory. You can use a different directory but you will need to update the batch file appropriately.
Your video capture unit is now ready for another adventure!
Dash Cam Windscreen Mount

Example Video Footage

Here is a two minute compilation I created from footage I filmed while the camera was attached to my windscreen :
The camera resolution was set to 1280×720 although the YouTube video was exported as 1920×1080. The video isn’t very exciting but shows how the camera deals with the varying daytime lighting conditions it comes across.
This entry was posted in Camera Module, Python and tagged , , , . Bookmark the permalink.

Friday, October 17, 2014

Running Ubuntu on a Chromebook or other such gizmo

From Ian Morrison.

here is a bit of the post:

As an alternative to my post about Linux on RK3288 devices (see you might instead want to try Linux through a chroot environment.

You will still need an RK3288 device that is rooted, a terminal emulator installed and an SD card loaded with the RFS from the previous post.

Then you will need to download the script to run the chroot command from

To enter the chroot environment, in a terminal window first 'su' and then simply type:

Video showing install

Wednesday, October 15, 2014

hints for setting up raspian. NFS Timezone keyboard

here are some notes about changes on a fresh raspian setup.

Raspian is set to UK keyboard.

sudo dpkg-reconfigure keyboard-configuration

Raspian is set to UTC

change on internationalization on raspi-config menu.

To mount nfs, rpcbindd is not running: 

# /etc/init.d/rpcbind start
After that started nfslock,
#/etc/init.d/nfslock and tried to remount the nfs share and all went fine.
apt-get -y install nfs-kernel-server nfs-common portmap

then proceed with mounts.
TODO:  change so that cifs mount stanzas have settings that can be modified to be usual local.  On raspian, main id is "pi".

Raspberry Pi as Apple Time Machine server

from a blog that cratered.  Via

this also references two other blogs.  One is copied because it is no longer accessible (guy was using wordpress, probably got hacked).

the other is from here, still works:

I’ve been trying to get the Raspberry Pi to run as an Apple Time Machine server for a while now. I originally wanted to get it going under Arch Linux for ARM but after numerous  attempts without any luck I decided to switch over to the Raspian image. I’ll assume that you’ve already got the Pi up and running with a static IP address…
What you need:
- Raspberry Pi (I’ve got the B model with 512MB of RAM) with a static IP!
- Memory Card with Raspbian preloaded (I used 2012-12-16-wheezy-raspbian.img)
- External HDD with power supply like this
- Networking devices and cables (Ie: router/ switch)

1- Formatting the external HDD

Firstly you need to use a mac to format the external HDD to the case sensitive Mac Journalled file system. To do so, take your external HDD and plug it into a mac running some kind of OSX and open up Utilities > Disk Utility. From the menu on the left containing all the drives connected to the mac, select the external HDD. Be 100% sure you’ve selected the right drive as we are going to erase all data on the selected drive. With the correct drive selected select the erase option from the horizontal menu on the right hand side of the window.
To format the drive correctly select Mac OS Extended (Journaled) and name the device anything you like, I chose to name my drive TimeMachine. Hit Erase.
Once the drive has finished formatting move over to the next option in the menu, Partition.
Here we want to create one partition for the whole drive so select the options below and then hit Apply;

Partition Layout: 1 Partition

Name: Time Machine
Format: Mac OS Extended (Journaled) – case sensitive if possible
Size: Largest possible (Should already be filled out)

2 – Getting the Raspberry Pi ready for the Mac File System

Firstly, let’s go ahead and remove the HDD from the mac and plug it into the Pi. After doing so we are able to get some vital information about the external HDD from the Pi’s bash terminal. We need to know the UUID of the partition we created using Disk Utility on the mac. To do so we use the command:
$ sudo blkid
Please make a note that the $ should not be included in the actual command, it’s just to signify the use of a non-root bash terminal. Anyway after inputting the command and hitting enter you will be prompted for the users password. After that all the connected devices containing storage media will be listed. If you, like me, only have the one HDD attached you should be looking down at /dev/sda1 where /dev/sda is the path to the device and /dev/sda1 is the path to the first and, in most cases, only partition. Please make note of the long UUID for the partition labled “TimeMachine
We now need to download and install the correct support for the Mac’s file system so that we can go ahead and mount the partition later on.. But first we must run an update to make sure everything is current:
$ sudo apt-get update
To then install the support for the partition run the command:
$ sudo apt-get install hfsplus hfsutils hfsprogs
You will be prompted for a Y/n answer once or possibly multiple times, hit y and enter at each prompt. The Pi will start downloading all the necessary packages and automatically install them. Once it is all finished you will be given the command prompt back.

3 – Mounting the TimeMachine partition to a newly created directory

These next few steps require that we have a directory created to mount the TimeMachine partition to so let’s go ahead and create that quickly…
$ sudo mkdir /mnt/TimeMachine
Now we are going to create a more permanent mounting scheme using the /etc/fstab file. The fstab file is read and acted upon every time the system boots and automatically mounts the drives listed to the directories listed. In a way it’s like a boot script but just for mounting partitions of media to given directories. To edit the file we must open it as the root user in a text editor with the command:
$ sudo nano /etc/fstab
Now the terminal will change to a text editor with a list of possible commands at the bottom of the screen. With the arrow keys navigate to the last line of the file and input:
UUID=”XXXX-XXXX-XXXX-XXXX” /mnt/TimeMachine hfsplus rw,force,exec,auto,users 0 3
Where the XXXXs represent the UUID that you made a note of in the previous step (2). After doing so use CTRL + O to write the data out to the file, overwriting the previous file… So make sure you are only adding a line to the bottom and not erasing any of the other data. CTRL + X to exit. Also please note that now one of the external HDD’s partitions is in the /etc/fstab file therefore the Raspberry Pi WILL NOT boot without the HDD attached to the USB port… Please remember this as it’s caught me out on a few occasions.
Now lets reboot the Raspberry Pi, remembering that the fstab file will auto mount the TimeMachine to the /mnt/TimeMachine directory.
After the reboot is completed navigate to the directory with the TimeMachine partition and create a test directory to check everything is working
$ cd /mnt/TimeMachine
$ sudo mkdir test

Also use the mount  command to check that /dev/sda1 is mapped to /mnt/TimeMachine. Also make sure that the letters rw are in the same result.. ensuring that we have read/write access to the partition.
The final part of step 3 is to give the user pi ownership over the partition as this is the user we will be using to log into the share from the Mac(s). We do so with the following command:
$ sudo chown -R pi /mnt/TimeMachine

4 – Getting Netatalk and Avahi installed

Finally we need to install the services that the Pi will be using to communicate with the Mac’s on the network. To accomplish this task we must install a bunch of packages and then install Netatalk from source. Netatalk is the package used to advertise the TimeMachine shared drive and communicate the back-up data. Install the previously mentioned packages with:
$ sudo apt-get install avahi-daemon libavahi-client-dev libdb5.3-dev db-util db5.3-util libgcrypt11 libgcrypt11-dev
As in step 2 you will be prompted, select Y at each prompt.
Now we are going to grab Netatalk 3.0 (not 3.0.1!) from sourceforge and compile it from source. Please follow closely below…
$ cd
$ wget
Once Netatalk has finished downloading we need to extract it:
$ tar xvfj netatalk-3.0.tar.bz2
The contents of the tar-ball will be extracted to /home/pi/netatalk-3.0  so we need to enter that directory and get compiling! Note that compiling might take a while on the Pi!
$ cd netatalk-3.0
$ ./configure –with-init-style=debian –with-zeroconf
$ make
$ sudo make install

5 – Configuring Netatalk for a Time Machine share

Now with Netatalk and the other misc packages installed we can go ahead and configure Netatalk. For those of you familiar with Samba, the Netatalk configuration file should seem quite similar. To configure Netatalk we edit the file with:
$ sudo nano /usr/local/etc/afp.conf
Make the file look like this, without the <<< comment of course):
; Netatalk 3.x configuration file
; Global server settings
hostname = TimeMachine RasPi
log file = /var/log/netatalk.log
log level = default:info
basedir regex = /home
cnid scheme = dbd
; Display each user home directory in this format
home name = Home: $u
[Time Machine]
; Our Time Machine volume
path = /mnt/TimeMachine
cnid scheme = dbd
file perm = 0660
directory perm = 0770
time machine = yes
Now save the file with CTRL + O and enter, use CTRL + X to exit.
Now we must get the Netatalk and Avahi services running with the commands:
$ sudo /etc/init.d/netatalk start
$ sudo /etc/init.d/avahi-daemon start

With the services running there is just one more thing to do on the Pi, set them to start at boot.
$ cd /etc/init.d/
$ sudo update-rc.d netatalk defaults
You will get two lines, the second looks like a bit of an error, don’t worry it’s fine.

5 – Connecting from the Mac(s)!!!

Now we are ready to go back to the Mac(s) and start backing up! At the desktop in finder hit; Go > Connect to Server and type
Where XXX.XXX.XXX.XXX is your Pi’s IP.. It should prompt you for a user name and password.. use the login credentials you use for logging into your pi.. Ie; pi & PASSWORD
You should now see the share in a finder window.. Go ahead and set it up as a Time Machine drive under Settings > Time Machine > Select Disk
On a final note, I’ve found it to be quite slow, but after that first initial back up it’s fine. I’ll leave the rest up to you..
This guide is a re-hash of these two guides:
Simon’s Guide
Iurii’s Guide

Simon's guide is also a dead link, copied from here.

refer to http:/ blog entry in (snapshot was on 9/10 to catch the entry)

Raspberry Pi, Raspbian, HFS+, AFP and Time Machine

Posted by on September 6, 2012

Since getting my Raspberry Pi I have installed a few different operating systems and had a good little mess about.  One great use I have found for it is plugging in external drive and utilising it as a Time Machine / Time Capsule backup device for my Mac’s.  At such a low price point with a 2Tb drive you can have a working time capsule for under £100! Certainly an attractice prospect for backups!
(This little HOWTO assumes you are running Raspbian)
There are a few steps you need to take in order to get this working, as you will need the Raspberry Pi to support HFS+ as well as running AFP to enable Time Machine.
To enable HFS+ you should install the following
sudo apt-get install hfsplus hfsutils hfsprogs
This will install the necessary packages to mount the HFS+ formatted drive.
Getting the drive to mount as read/write can be achieved by the following command
mount -o force /dev/sdx /mnt/blabla
 It is also worth noting that if the drive appears as sdb the actual data on the partition will be one higher so sdb1.
If the drive doesnt mount running a fsck first can help
fsck.hfsplus -f /dev/sdaX (change X to your appropriate drive)
Hopefully this should see your HFS+ drive mounted under raspbian.  Now all we need to do is share the drive over AFP and enable Time Machine.
AFP + Time Machine
We need to install a few packages before we can move onto installing AFP support, as netatalk requires a DB as well as encryption.
sudo apt-get install avahi-daemon libavahi-client-dev libdb5.3-dev db-util db5.3-util libgcrypt11 libgcrypt11-dev
Once all dependencies are installed download the latest source code of netatalk.  After unzipping build with the follow commands
./configure –with-init-style=debian –with-zeroconf
make install
Now we should have a working install of netatalk which gives us AFP support for the drives we mount using HFS+.  All that is left is to configure afp.conf and start netatalk as a service.
afp.conf is located in /user/local/etc/
Open this file and edit as appropriate by following the instructions at netatalk.  However for a simple get started setup the following will give you a drive shared to be used as a Time Machone backup.
; Global server settings
uam list =
[Time Machone Raspberry]
path = /mnt/test
time machine = yes
With everything configured all that is left to do is run netatalk and your Time Machone backup will appear in the finder under OS X.
This is a very rouch guide on how to get everything running under raspbian but hopefully it will providers a jumping off point for further research in order to fine tune the setup to exactly how you want it.

Other guy's guide

Time Capsule for $25

The real article name might be something like: Configuring Raspbery Pi to serve like a Time Capsule with Netatalk 3.0 for Mountain Lion.  But it's too long ;)

Here I will describe the process of using Raspberry Pi like a Time Machine in my network. To be able to backup your MAC's remotely (Like it would be NAS of some kind). It assumes you have a Raspberry Pi and have installed a Raspbian there and have a ssh connection, or somehow having access to it's console. Refer to my previous article for details.

Now that we have a Pi that is ready for action let's animate it. So to make it suit you as a Time Capsule (NAS) for your MAC's you need to do those basic steps:
- connect and configure USB hard drive(s)
- install support of HFS+ filesystem to be able to use MAC's native filesystem
- make mount (auto-mount on boot) of your hard drive
- install Avahi and Netatalk demons
- configure Netatalk daemon to make it all serve as a Time Machine
- configure avahi demon
- put avahi and netatalk demons into autolaunch on system boot

1. Setup a Hard drive.

I assume you know what you are doing and understand you have to have a hard drive formatted under your mac's HFS+ filesystem. That you, like me, used as an external hard drive for backups before this. Just for example. Or bought it... Whatever. One word you will need (or assume you have) an external USB drive to follow me farther.

Start your drive (in case it has external power). I think Pi would handle only drives with external power. But who knows ;). And connect it to your Pi. Let it spin for some seconds to be recognized.
Now connect to console of your Pi and let's roll.
leopard$ ssh pi@
pi@'s password: 
Linux raspberrypi 3.2.27+ #250 PREEMPT Thu Oct 18 19:03:02 BST 2012 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Oct 29 01:04:39 2012
pi@raspberrypi ~ $
As you can see I have a clean system installed from latest (as for 24.11.2012) downloaded image.

Let's do some magic. Because Raspbian does not support Apple's filesystem out of the box. At least we need to mount it write enabled. Which is not set up by default too. SO let's start from typing command blkid under root and looking at output.
pi@raspberrypi ~ $ sudo blkid
/dev/mmcblk0p1: SEC_TYPE="msdos" UUID="8B12-9112" TYPE="vfat" 
/dev/mmcblk0p2: UUID="AAAAAAA-1111-1111-......." TYPE="ext4" 
/dev/sda1: UUID="AAAAAAA-1111-1111-......." LABEL="Time Machine" TYPE="hfsplus" 
/dev/sda2: LABEL="Data" UUID="1234567890......." TYPE="ntfs" 
pi@raspberrypi ~ $
Note UUID of your device. Mine is called sda1 and has a partition type hfsplus.  Hurray! Drive is connected and is recognized by Pi.

2. Install support of AFP filesystem (MAC's native).

Now let's install tools we need for HFS+ filesystem mounting. We need  to mount it RW to be able to backup.
pi@raspberrypi ~ $ sudo apt-get install hfsplus hfsutils hfsprogs
Press "y" in the process of install. You will get HFS+ support libraries installed. So let's move on to mounting.
After this you should be able to mount your HDD. You may try it or skip to making permanent mounting config via /etc/fstab (Step 3).
pi@raspberrypi ~ $ sudo mount -o force /dev/sda1 /mnt/TimeMachine
pi@raspberrypi ~ $ cd /mnt/TimeMachine
pi@raspberrypi /mnt/TimeMachine $ ls -l
total 116
drwxr-xr-x 1 root      99      6 Jan 11  2012 Backups.backupdb
drwxrwxrwx 1  501 dialout     31 Feb  1  2012 !DVD-s
-rwxr-xr-x 1 root root    115716 Sep  1 07:23 tmbootpicker.efi
pi@raspberrypi /mnt/TimeMachine $
You may see your files from a HDD. Hurray! Again ;). Btw you can look at how is your device was mounted by typing mount command into prompt. It will show your mounted volume and mode it was mounted. So you will see something like this:
pi@raspberrypi /mnt/TimeMachine $ mount
/dev/root on / type ext4 (rw,noatime,user_xattr,barrier=1,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=118872k,nr_inodes=29718,mode=755)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=23788k,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=47560k)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620)
/dev/mmcblk0p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=ascii,shortname=mixed,errors=remount-ro)
/dev/sda1 on /mnt/TimeMachine type hfsplus (rw,relatime,umask=22,uid=0,gid=0,nls=utf8)
Note last line with /dev/sda1 mounted in mode "rw". Yes everything works well. Let's move on.

3. Make mount (auto-mount on boot) of your hard drive

Let's create a directory for our new tome. We will need this to mount filesystem.
pi@raspberrypi ~ $ sudo mkdir /mnt/TimeMachine
Lets unmount our tome (in case you did tested it exists with me).
pi@raspberrypi ~ $ sudo umount /dev/sda1
And add a proper fstab entry to auto-mount this hard drive on boot. Open fstab:
pi@raspberrypi ~ $ sudo nano /etc/fstab
And add a line to the end of the file, indicating our Time Machine tome mounting preferences. Mine was:
UUID="AAAA-BBBB..." /mnt/TimeMachine hfsplus rw,force,exec,auto,users 0 3
Where AAAA-BBBB...  is your devise UUID from that blkid command remember?
I used UUID to be sure it won't matter if I'll switch hard drives places in USB ports. But you may use /dev/sdXX, where XX is your device counting numbers in /dev. Mine in this case was /dev/sda1.

Note: You can skip reboot.

Let's now do a reboot to make sure it all spins in automatic mode ;).
pi@raspberrypi ~ $ sudo reboot

Broadcast message from root@raspberrypi (pts/0) (Wed Nov 21 19:13:49 2012):
The system is going down for reboot NOW!
After system boots up run mount command to make sure we are ok in rw mode. Btw you may play with commands:
# to unmount volume:
pi@raspberrypi ~ $ sudo umount /dev/sda1
# to mount again:
pi@raspberrypi ~ $ sudo mount UUID="AAAA-BBBB..."
While you will find your string. BTW you can read about how and why in /etc/fstab manual here... Or google about it.

Note: if your HFS+ tome does not mount and/or mounted read only. You should try to run fsck for hfsplus partition type manually.
pi@raspberrypi ~ $ sudo fsck.hfsplus -f /dev/sda1
Anyway we must now have an rw mode HFS+ volume mounted and ready for our Time Machine. So Lets move on...

Checking your user permissions. As we will use user "pi" farther along the article we must add him ability to manage Time Machine data. (In case you are not mounting empty drive). You should consider changing all the data owner to user "pi" to make sure we will be abler to backup in future:
pi@raspberrypi ~ $ sudo chown -R pi /mnt/TimeMachine

4. Install and configure Avahi and Netatalk demons

First make sure you have the latest packages lists, running:
pi@raspberrypi ~ $ sudo apt-get update
And updating what necessary.

Now install all the required packages with db and encryption support in order Avahi and Netatalk demons to support for HFS+ filesystem:
pi@raspberrypi ~ $ sudo apt-get install avahi-daemon libavahi-client-dev libdb5.3-dev db-util db5.3-util libgcrypt11 libgcrypt11-dev
After this is complete we will have almost everything required for our little demon.

Download and unpack 3.0.0 (latest, as for now is 3.0.1 but I had problems with it spinnig) Netatalk demon sources. For e.g. using command: $ wget You may get Netatalk at SourceForge. And unpack using e.g. tar: tar -xvf netatalk-3.0.0.tar.bz2

After you are ready with unpacked netatalk distribution go ahead and make custom configuration of it. Enter directory of unarchived netatalk and execute command:
pi@raspberrypi ~/netatalk-3.0 $ ./configure --with-init-style=debian --with-zeroconf
It will do the proper configuration for our needs. After this is done run:
pi@raspberrypi ~/netatalk-3.0 $ make
pi@raspberrypi ~/netatalk-3.0 $ sudo make install

5. Configure Netatalk daemon to make it all serve as a Time Machine

Now when you will have all this done go edit a configuration file of Netatalk. From version 3.0 it is located in /usr/local/etc and has Samba-like look. You can symlink this file to /etc/afp.conf if you wish... 
pi@raspberrypi ~ $ sudo nano /usr/local/etc/afp.conf
And insert this sample configuration. This config file works with latest edition ( now it is 10.8.2 ) of OS X Mountain Lion. So the config:
; Netatalk 3.x configuration file

; Global server settings
; Name of your computer in apple devices network
hostname = TimeMachine Pi
; IP of your Pi
afp listen =
; logging config
log file = /var/log/netatalk.log
log level = default:info

basedir regex = /home
cnid scheme = dbd
; Display each user home directory in this format
home name = Home: $u
[Time Machine]
; Our Time Machine volume
path = /mnt/TimeMachine
cnid scheme = dbd
file perm = 0660
directory perm = 0770
time machine = yes

; Example to add a new static share:
; [My AFP Volume]
; path = /path/to/volume
It is quite well commented so you will be able to copy-paste and edit ;).

6. Configuring AVAHI services 

Now you would probably want to have a Time Capsule as a separate share in your network shares. Note this step is optional. But if you plan to use your pi for more than 1 thing, like I do... I'd recommend to do it. Create a special afpd services configuration file by executing:
pi@raspberrypi ~ $ sudo nano /etc/avahi/services/timecapsule_afpd.service
Then add this contents to file:
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
      <name replace-wildcards="yes">TimeCapsule %h</name>
After this is configured for your desired settings. Go run your demons:
pi@raspberrypi ~ $ sudo /etc/init.d/netatalk start
pi@raspberrypi ~ $ sudo /etc/init.d/avahi-daemon start
Avahi demon was installed from package. So you might need to actually run restart instead of start command. Now go check your Mac's Network Shares.

7. Put avahi and netatalk demons into autolaunch on system boot

We have installed here an avahi demon from package. So it must be written to all system run-levels during installation. Only thing here is compiled Netatalk 3.0 so you can make a proper trick here by putting it to run with default init.d command:
pi@raspberrypi ~ $ cd /etc/init.d/
pi@raspberrypi ~ $ sudo update-rc.d netatalk defaults
update-rc.d: using dependency based boot sequencing
update-rc.d: warning: default stop runlevel arguments (0 1 6) do not match netatalk Default-Stop values (1)
pi@raspberrypi /etc/init.d $

Tuesday, August 19, 2014

Booting sun blade w/o sun keyboard. (there is no L1 / A or "Stop" A sequence possible on a 101 keyboard.

quoting Derrick

Recently, I received a Sun Blade 100 as a gift. After doing some research on which OS is the best for this machine, I decide to go with FreeBSD. So, my journey with Sun began here.
I only used Sun/Solaris in my engineering courses in college, I don’t have much experience with Sun hardware. I assumed that the experience should be similar – I was wrong.
So, here is what I have: A Sun Blade 100 connected with a regular USB PC keyboard. Note that Sun comes with its own keyboard, which has additional keys like STOP.
Anyway, after downloading the image of FreeBSD 8.1 Sparc64 and burning it into a DVD (You can burn it on any OS), I tried to boot the machine from DVD (Note that Sun Blade was release in 2002. You may need to verify that it is a DVD reader. You can replace the CD reader by any IDE DVD reader if needed.). And I received the following error messages:
Boot device: net  File and args:
Timeout waiting for ARP/RARP packet
Timeout waiting for ARP/RARP packet
Timeout waiting for ARP/RARP packet
Timeout waiting for ARP/RARP packet
Timeout waiting for ARP/RARP packet
Apparently, this machine does not know how to boot from CD/DVD automatically. After reading 20 posts, I finally got a solution:
If you have a Sun Keyboard:
1.) Push the power button to turn on the machine
2.) Pressing STOP and A key together
1.) Push the power button to turn on the machine
2.) After the beeping sound, push the power button twice in a short time.
After trying it for few times, I finally got into the OpenBoot:
Aborting auto-boot sequence.
So, I want to boot from CD:
boot cdrom
That’s it. The installation of FreeBSD on Sun is pretty much the same as on PC, except that the color of the installation menu looks a little bit weird.
If you experience any difficulties on booting from CD, make sure that both harddrive and DVD drive are jumpered to Cable Select, also you can verify the connections by running this command in the OpenBoot:
which will return something like:
Device 0 (Primary Master)
   ATA Mode: XXX
Device 1 (Primary Slave)
   Removeable ATAPI Model: YYY
Now you can install FreeBSD on your sparc64 machine!

Few things I’ve learned from running FreeBSD on Sun Machine (Sparc64)

  • Sun Blade 100 uses ECC (Error Correction Codes) memory. It doesn’t like the regular desktop memory.
  • Sun Blade 100 is old, the CPU speed is equivalent to Pentium II. It takes a long time to compile applications from ports. I recommend to install the applications using pkg_add first, and then run portmaster to update all apps. It will save you lots of time.
  • freebsd-update does not work on sparc64 machine. If you want to upgrade the FreeBSD system, you need to rebuild the kernel.
  • Sun Blade 100 is a heavy duty snail. For example, it can handle lots of inquires at the same time without crashing, but the processing speed is extremely slow. I don’t recommend using it for any applications that use more than 10% of CPU resource, e.g., Webserver (dynamic content), Database or Web Framework. I tried running all of my websites (including this blog) on Sun, which resulted terribly slow. My recommendations: Firewall, Router, Load Balancer.
That’s it! Have fun with Sun + FreeBSD.

Friday, August 1, 2014

OpenVMS licensing notes from various people

notes from people about signing up for VMS Hobbyist licenses.

John reinhardt

It's easier (and cheaper) to get your member number through DECUServe. Just telnet to, log in with the username REGISTRATION and then follow the prompts.  You'll end up with a DECUServe account on their system named EISNER and you can get your member number by typing HOBBYIST at the command prompt.

See the Hoffman Labs site page <> for steps.

Then once you have that number go to <> to register for your OpenVMS license PAKS.  They should arrive the next business day in your email.

Fairly easy and totally cheap.

John H. Reinhardt

It's easier (and cheaper) to get your member number through DECUServe. Just telnet to, log in with the username REGISTRATION and then follow the prompts.  You'll end up with a DECUServe account on their system named EISNER and you can get your member number by typing HOBBYIST at the command prompt.

See the Hoffman Labs site page <> for steps.

Then once you have that number go to <> to register for your OpenVMS license PAKS.  They should arrive the next business day in your email.

Fairly easy and totally cheap.

John H. Reinhardt 

Sean Caron

I don't think they'll issue hobbyist licenses to Explorer Members. You have
to pay $50 now AFAIK. (please correct me if this is not the case?)

Years ago (well, back in 2009, IIRC) I was able to talk them into doing it
for free (or maybe I just confused them & they mistakenly did it for me),
but this time around when I brought my VAXen out of storage to play with, I
just paid up. Honestly I'm happy to pay $50/year to be able to run VMS on
all my VAX machines.

When you sign up as an ordinary Encompass member, you'll get an actual
member ID number, which is what you plug into the form.

Also, I found that apparently within the last few months, the duty of
handling the hobbyist license has kind of bounced around within HP or
something, such that there was a little bit of delay in processing my
request. I found that for best results, you want to use the form at -

Don't use the form site, I think it's broken or
something; I never got a response from anyone when I used it.


Jon Tabor
Ah, found it.  I had signed up through DECUServe (,
which appears to still be functioning and still free (though accepting

Steven M Jones
On 04/08/2014 10:30 AM, Seth Morabito wrote:
The process is pretty simple now, though the page has jumped around a
bit over the past year. For now, use this URL (it may change in the
I tried the form at several times, trying to sort
out which "chapter" my old-school US DECUS membership had morphed into
(short answer: forgot about DECUServe). But in the end, I got no
response of any kind from any of these attempts...

I'll think happy thoughts and try the form at CCSS - I'd rather work
within the program if possible.



Wednesday, July 30, 2014

updated recipe to make a video streamer on raspberry pi.

shows still streaming, and encoded.  Uses mjpeg streamer

Thursday, July 24, 2014

raspberry pi video streaming via vlc and raspivid

The first example seems to work. The second one not so well.

Here I'm documenting how to stream from the Raspberry Pi Camera board using VLC. Most of this is covered in the Raspberry Pi forums in this thread.
The camera needs to be setup using the various instructions on the Raspberry Pi website and the only additional software package that needs to be installed is VLC which can be installed by doing sudo apt-get install vlc with further details about it on the VideoLan website.
The most reliable streaming method seems to be via RTSP and the command line to launch it is.
raspivid -o - -t 9999999 |cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/}' :demux=h264
This causes the video from the camera to be streamed from port 8554 of your Raspberry Pi. This can then be viewed by launching VLC on your PC and open a 'Network Stream' with the addressrtsp://<IPofRaspberryPi>:8554/
RTSP works well on a local network, but can be hard to expose through a router to allowing streaming over the internet. To over come this VLC can be configured to stream via HTTP, this seems to use a bit more CPU on the Raspberry Pi and can suffer from dropped frames however it only uses one port and can be easily port forwarded through most standard routers. The command for this configuration is
raspivid -o - -t 9999999 |cvlc -vvv stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8554}' :demux=h264
Once more this can be viewed on your PC by using VLC and opening a 'Network Stream' with the address http://<IPofRaspberryPi>:8554/
One final way of streaming the video is over HLS (HTTP Live Streaming). This, apparently, allows the video to be easily streamed to iOS devices. For this to work a web server needs to be installed on the Raspberry Pi. A popular choice is apache that can be installed using sudo apt-get install apache which will then serve the files stored in /var/www. To setup VLC to generate the HLS stream you can run
raspivid -o -  -w 920 -h 540 -t 9999999 |  vlc -v -I "dummy" stream:///dev/stdin  :sout="#std{access=livehttp{seglen=10,delsegs=true,numsegs=5, index=/var/www/streaming/stream.m3u8, index-url=http://<IPofRaspberryPi>/streaming/stream-########.ts}, mux=ts{use-key-frames}, dst=/var/www/streaming/stream-########.ts}" :demux=h264

(Remembering to correctly set the IP address of your Raspberry Pi). Again this can be played back using VLC by opening a Network Stream of http://<IPofRaspberryPi>/streaming/stream.m3u8 however HLS can consume all the CPU on the Raspberry Pi

Another page about streaming video from pi to web

Saturday, June 21, 2014

Removing a Readynas 1100 or NV+ disk tray with bad button

The early Netgear Readynas NV+ (sparc) and 1100 units (4 across) all had a design which must have looked good on paper.

However the buttons that are supposed to push in, and displace a latch upward, allowing the arm to extract the drive typically is frozen.  I don't know if they ever worked early on, but nearly all of the original ifarant units and the first netgears, which all seem to be about the same just don't work.

there is a small spot in one of the holes you can stick a small probe into and actuate the latch thru a small lever action.

This video of my unit, while removed shows the actuation.  I'll share the raw video, a Youtube video of it, and since I'm not the first one to do this, another illustration for reference.

Disk Tray Removal, Youtube

Raw video (google drive)

A longer version of opening the Duo (and probably the NV)

Here is one of the newer units with a reviewer extracting the drive.

Readynas Duo (at about 2:19, has extract)

An annoying old review of the Readynas 1100 (for reference what one looks like)
Almost feel bad calling it annoying since the reviewer is a Jesuit priest.

Readynas 1100 Review

Thursday, June 12, 2014

wifi to serial module

this will be fun to play with

Product Name:

HC-21 Embed WIFI to Serial Port Wireless Module UART

1: working voltage 3.3 V + / - 0.3 V.
2: an average of 420 mw power consumption.
3: work humidity 5% ~ 5% (no condensation).
4: working temperature and 55 ℃ ~ + 125 ℃.
5: overall size 20 mm *37 mm.
6: interface type standard 3.3 VTTL level, UART interface.

info link