My RPi lab setup

SONY DSCHere is a run-down of what I install on my lab unit. I have the Rasperry Pi 1080p camera and a breakout board attached.

  1. Get the Pi software up-to-date
  2. Do basic config
  3. Enable AppleTalk
  4. Install Motion support for Pi Camera module
  5. Install Samba client support to be able to mount a windows server or NAS volume through cifs

1. We start with getting the unit up-to-date

sudo apt-get-update & apt-get upgrade

2. Change password, enable the camera module and change time zone with the config menu:

sudo raspi-config

3. Install AppleTalk support to make easy to mount from my Mac

sudo apt-get install netatalk

Command-K to connec to the pi:

connect to rpi   Skärmavbild 2013-09-08 kl. 15.40.45

4. Install Motion with support for the Pi camera

sudo apt-get install -y libjpeg62 libjpeg62-dev libavformat53 libavformat-dev libavcodec53 libavcodec-dev libavutil51 libavutil-dev libc6-dev zlib1g-dev libmysqlclient18 libmysqlclient-dev libpq5 libpq-dev

Download the software directly from here:

wget https://www.dropbox.com/s/xdfcxm5hu71s97d/motion-mmal.tar.gz

Expand the downloaded file. A ‘motion’ directory and a config file will be the result:

tar zxvf motion-mmal.tar.gz

There are a few changes in the config to do, such as:

  • Specify a media folder (unless the default /home/pi is ok)
  • Specify a custom port & login for the embedded webserver (that shows a live video from the camera)
mkdir motion-imagessudo
chmod -R 777 motion-images
vi motion-mmalcam.conf
# Target base directory for pictures and films
# Recommended to use absolute path. (Default: current working directory)
target_dir /home/pi/motion-images

############################################################
# Live Stream Server
############################################################
# The mini-http server listens to this port for requests (default: 0 = disabled)
stream_port 8080

Then finally run the motion camera with this command:

./motion -n -c motion-mmalcam.conf &

To avoid the red LED to go one as soon as the camera is shooting, edit the boot config file:

sudo vi /boot/config.txt

and add one line at the end:

disable_camera_led=1

5. Install Samba client support so that we can mount a Windows server:

sudo apt-get install smbclient

Create a directory to act as mount point for the network device:

sudo mkdir /mnt/nas

Now issue the mount command to get read/write access. Please note that this mount will be forgotten after a reboot.

sudo mount -t cifs -o user=myuser,password=foo, rw, file_mode=0777, dir_mode=0777 //192.168.0.100/backup /mnt/nas/

This will give read/write access. Drop “rw,file_mode=0777,dir_mode=0777” to only get read-only. Verify that we access the content:

pi@pilab ~ $ ls -l /mnt/nas
total 1024
drwxr-xr-x 0 root root 0 Sep 29 2009 Aperture Library.aplibrary
drwxr-xr-x 0 root root 0 Dec 12 2009 Documents
drwxr-xr-x 0 root root 0 Aug 10 22:05 iTunes backup från Mac OS
drwxr-xr-x 0 root root 0 Aug 10 22:00 LightRoom
drwxr-xr-x 0 root root 0 Aug 23 00:09 raspberry

This is the place to put the mount command to be executed from startup:

sudo vi /etc/rc.local

Add the mount command right before the ‘exit 0’ line:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
 printf "My IP address is %s\n" "$_IP"
fi
# Mount my NAS volume
sudo mount -t cifs -o user=myuser,password=foo, rw, file_mode=0777, dir_mode=0777 //192.168.0.100/backup /mnt/nas/
exit 0

Done