topamax once a day

Dropbox on Raspberry Pi via SSHFS

This tutorial will demonstrate how to mount Dropbox (or any filesystem) over the network on the Raspberry Pi using SSHFS (Secure SHell FileSystem). For this procedure to work for your Dropbox share, you will need another machine somewhere that is running Dropbox, and is accessible to the Raspberry Pi via SSH.

Note: The following is not actually specific to the Raspberry Pi, nor to Dropbox. The tutorial generalizes for other systems and architectures that are not officially supported by Dropbox, as well as for mounting of other non Dropbox shares over the network.

How it works

SSH is a secure protocol for communicating between machines. SSHFS is a tool that uses SSH to enable mounting of a remote filesystem on a local machine; the network is (mostly) transparent to the user.

On the local computer where the SSHFS is mounted, the implementation makes use of the FUSE (Filesystem in Userspace) kernel module. The practical effect of this is that the end user can seamlessly interact with remote files being securely served over SSH just as if they were local files on his/her computer.

Installation (remote host)

The first step is to configure the remote host that the Raspberry Pi will connect to via SSH.  It will need to be running Dropbox, if you need to install it, follow the instructions for your respective OS here. If you are not yet a Dropbox user, and this has finally persuaded you to join, signup for Dropbox here.

Next, the remote machine will need to be running OpenSSH server. For Windows and Mac instructions on how to set up OpenSSH server, I recommend this tutorial on Lifehacker.  For Linux users, OpenSSH server is available in most every package manager. To install on Ubuntu, for example:

sudo apt-get install openssh-server


Installation (Raspberry Pi)

Now that the remote host is configured, you can setup the mount on the Pi.  This first requires installation of the sshfs package.  Open a terminal on the Pi and install it like this:

sudo apt-get install sshfs

Then add the user pi to the FUSE users group:

sudo gpasswd -a pi fuse

Once added to the fuse group, log out and log back in again for the change to take effect. Next, create a directory to mount Dropbox (or other remote share)

mkdir ~/Dropbox

Now use sshfs to mount the remote share on the newly created mountpoint. Be sure to change the user@remote-host and path to Dropbox to match your own settings:

sshfs -o idmap=user user@remote-host:/home/user/Dropbox ~/Dropbox

For example, connecting to another machine on your local network will look something like this:

sshfs -o idmap=user michael@ ~/Dropbox

The idmap=user option ensures that files owned by the remote user are owned by the local user. If you don’t use idmap=user, files in the mounted directory might appear to be owned by someone else, because your computer and the remote computer have different ideas about the numeric user ID associated with each user name. idmap=user will not translate UIDs for other users.

That’s all there is to it! To unmount,

fusermount -u ~/Dropbox

Automount Dropbox on boot

To configure the Dropbox SSHFS to automatically mount at startup, we first need to enable SSH keyless remote login.  The first part of this task is to generate an RSA crypto key so we can securely login to the remote machine running Dropbox without entering a password.  In a terminal on the Pi, run:

ssh-keygen -t rsa

Hit enter three times when prompted, accepting the default settings for the RSA ssh keys. Now copy the public part of the key to the remote host using the ssh-copy-id command:

ssh-copy-id -i ~/.ssh/ user@remote-host

You will be prompted for the password on the remote one last time. Once entered, terminal output will confim the key was added sucessfully.

Now that you can login remotely without password, the final task is to configure the share to automatically mount on startup. There are a few ways this could be accomplished, I decided to use cron for the task. Open the global crontab for editing:

sudo crontab -e

And add a line to the end like this:

@reboot sshfs user@remote-host:/home/user/Dropbox /home/pi/Dropbox

Then press CTRL and X to exit the editor, then Y to confirm the changes (if using nano, the default text editior).

That’s it! Reboot the Pi, and your Dropbox share will mount automatically on startup.

Another method to accomplish this task would be to add a line to /etc/fstab to automatically mount the Dropbox SSHFS share.



Peer Guardian on Raspberry Pi

This tutorial will show how to compile and install Peer Guardian on a Raspberry Pi.  The process requires the at least the or newer Debian image (or manual kernel re-compilation).  This will NOT work with since the kernel does not have net filtering enabled. Also, you will need a decent sized SD card (4GB at least) … the dependencies alone require 382 MB.

First, install the required package dependencies. In a terminal on the Raspberry Pi:

sudo apt-get install libnetfilter-queue-dev lsb-qt4 libdbus-1-dev qt4-dev-tools libdbus-1-dev libdbus-glib-1-dev firehol firestarter ufw zlib1g-dev

Next, download and extract the Peer Guardian source archive, then change directory to the root of the tree:


tar -xvf pgl-2.1.3.tar.gz

cd pgl-2.1.3/

Now we are finally ready to start the build! To compile, run make, then install Peer Guardian with make install:


sudo make install


sudo /usr/lib/lsb/install_initd /etc/init.d/pgl

Now reboot the Pi:

sudo reboot

And on start-up you will see the confirmation that it starts:

Starting PeerGuardian Linux: pgld.

Note: this takes much longer than usual for the first boot, be patient!

To start the GUI from the LXDE menu, select Internet -> pgl-gui

The default settings are very strict and you will likely want to change them.  It even blocks access to the apt sources, so until you changes the settings, even ‘apt-get update’ will fail.


Raspberry Pi Physical Gmail Notifier

This tutorial will demonstrate how to easily turn your Raspberry Pi into a physical Gmail notifier, in only 10 lines of python! If the configured Gmail account has unread messages, the LED will be illuminated, otherwise dim.  The project was inspired by the Arduino/Mac version by J4mie adapted for use on the Raspberry Pi.

Here is a diagram of the wiring of the LED with a 330 ohm resistor in series (created with Fritzing):


The python script uses the feedparser module to simplify interaction with Gmail and the RPi.GPIO module to control the GPIO pins. The easiest way to install these is using the python pip package manager. If you don’t have it installed, you can install the pip package manager using apt-get. In a terminal on the Pi:

EDIT: For and newer, the Python development headers (python2.7-dev) are also required:

sudo apt-get install python-pip python2.7-dev

Next, for pip to work correctly you will need to update to a newer version of distribute using easy_install:

sudo easy_install -U distribute

Then install the feedparser and GPIO modules with pip:

sudo pip install feedparser RPi.GPIO

Once the pre-requisites have been installed, download , or copy and paste the following Python script to the Raspberry Pi:

The final step is to configure the script to run every minute as a cron job. To do so, open the global crontab for editing:

sudo crontab -e

Then add this line to the end of the file (adjust to the location of the python script):

* * * * * python /home/pi/

That’s it! From now on, cron will execute the script once every minute.  If you have unread messages, the GPIO pin will be pulled high, lighting the LED, otherwise, it will be disabled, dimming the LED.


Arduino on Raspberry Pi

Connecting an Arduino to a Raspberry Pi is simple. In a terminal, install the Arduino IDE:

sudo apt-get install arduino

This will take a while to download and install all of the dependencies. Once completed, you can start the IDE from the terminal:


Or, from the LXDE menu, Electronics->Arduino IDE. Note: This is IDE version 0018, and does not seem to recognize boards newer then the Duemilanove. Update: The IDE version in the package manager has been updated to version 1.01 and should work with newer boards like the Uno and Leonardo now as well.

The 1 amp power supply I have connected to my Raspberry Pi was not sufficient to power both the Pi and the Arduino through the USB port, so I connected the Arduino through a powered external USB hub. This may not be necessary with a larger power supply connected to the Pi. Update: A larger power supply will not overcome this limitation; the micro USB port on the Raspberry Pi is fused with 1100mA. –Thanks cavebeat


Alternatively, the 5V GPIO R_Pi Pin can be used to power the Arduino. Just connect the 5V GPIO pin on the Raspberry Pi to the VIN pin on the Arduino, and respectively GND from one board to the other.


This eliminates the need for the externally powered USB hub, but can make development more of a chore due to the USB port restriction: the keyboard and Arduino will need to be swapped in and out to flash the Arduino.

Raspberry Pi NES Emulator

This tutorial will demonstrate how to install Nintendo NES/Famicom emulator on the Raspberry Pi running Debian.  Begin by installing the necessary dependencies. In a terminal, enter:

sudo apt-get install scons libsdl1.2-dev libsdl1.2debian-esd subversion libgtk2.0-dev

Checkout the most recent sources using subversion:

svn checkout fceultra

The repo has moved here:

svn checkout svn:// fceultra

Change directory into the root of the source tree

cd fceultra/

Compile and install FCEU using the scons build tool:

sudo scons GTK=1 install

That’s it! To run:


Then select the ROM with from the title bar menu, File->Open ROM, or with Ctrl+O.

You can easily setup a gamepad too, like the USB NES RetroPort. This adapter converts an authentic NES controller to USB.   To configure, run fceux using the inputcfg flag to setup configure.  Press the corresponding buttons in series as they are prompted. Note: There are two dashes ( – – ) together in the command below:

fceux –inputcfg gamepad1


Raspberry Pi + OpenCV

OpenCV is a suite of powerful computer vision tools. Here is a quick overview of how I installed OpenCV on my Raspberry Pi with debian6-19-04-2012.  The guide is based on the official OpenCV Installation Guide on Debian and Ubuntu. Before you begin, make sure you have expanded your SD card to allow for the install of OpenCV. Its a big package with lots of dependencies. You can follow my instructions here.  Once you have expanded the SD card, open up a terminal and install the following packages:

UPDATE: You can execute the following steps with a simple call to the Ansible playbook playbook-opencv. Note that you have to edit the pis.yml file with your pi ip address and update group_vars/pis.yml with your pi password.

git clone
ansible-playbook site.yml -i pis.yml -vvvv

Note: The make command will take HOURS to run. Please be patient.

sudo apt-get -y install build-essential cmake cmake-qt-gui pkg-config libpng12-0 libpng12-dev libpng++-dev libpng3 libpnglite-dev zlib1g-dbg zlib1g zlib1g-dev pngtools libtiff4-dev libtiff4 libtiffxx0c2 libtiff-tools


sudo apt-get -y install libjpeg8 libjpeg8-dev libjpeg8-dbg libjpeg-progs ffmpeg libavcodec-dev libavcodec53 libavformat53 libavformat-dev libgstreamer0.10-0-dbg libgstreamer0.10-0 libgstreamer0.10-dev libxine1-ffmpeg libxine-dev libxine1-bin libunicap2 libunicap2-dev libdc1394-22-dev libdc1394-22 libdc1394-utils swig libv4l-0 libv4l-dev python-numpy libpython2.6 python-dev python2.6-dev libgtk2.0-dev pkg-config

There are some dependency issues with the order of the install, mostly with regard to libjpeg issues, so be sure to install in this order. You will see some broken package errors if you attempt to install all the dependencies in one step.

Next, pull down the source files for OpenCV using wget:


Once finished downloading, extract the archive, remove the no longer needed archive (to save space), change directory to the top of the source tree, make a directory for the build, and change into it:

tar -xvjpf OpenCV-2.3.1a.tar.bz2

rm OpenCV-2.3.1a.tar.bz2

cd OpenCV-2.3.1/

mkdir build

cd build

Next, you will need to configure the build using cmake. If you aren’t sure about what options you want/need or are unfamiliar with cmake, this line will create a standard configuration:


Alternatively, you can configure the build using a GUI interface. This can be helpful to build with support for additional OpenCV features. To use the cmake GUI, run:

cmake-gui ..

In the cmake GUI, click ‘configure’ to pre-populate the build options. Select or remove any desired features, then click ‘configure’ again, check the output and ensure that there are not any modules that cmake cannot find. If everything looks good, click ‘generate’ to create the makefiles, then close cmake-gui. Now we are ready to start the build! To compile, run make, then install with make install:


sudo make install

As you can see from the image, this will take a LONG time… over four and a half hours to compile!

Finally, we need to make a few configurations for OpenCV. First, open the opencv.conf file with the following code:

sudo nano /etc/

Add the following line at the end of the file(it may be an empty file, that is ok) and then save it:


Then edit the system-wide bashrc file:

sudo nano /etc/bash.bashrc

Add the following new lines to the end of the file:

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig export PKG_CONFIG_PATH

Now that everything is installed and configured, on to the demos!  The C demos are here:

cd ~/opencv/OpenCV-2.3.1/build/bin

C demos in build/bin demos worth checking out (that don’t require a webcam):




The python demos are located in samples/python:

cd ~/opencv/OpenCV-2.3.1/build/bin

These demos also don’t require a webcam:

python ./

python ./

python ./