My initial Raspberry Pi experiments…

Lately, so many have been talking so much about the Raspberry Pi (Google also says: "About 8,710,000 results (0.35 seconds)" ).

Like they say, 1 billion flies cannot be wrong, so I got creative and went to the local geek store here in town, Kjell&Co and bought a unit, 349 SEK.

In addition to that you would need an SD Card for storage. Either you strip the SD Card from an old camera or one of your childrens’ toys, or you buy one. At least 2 GB must be used, but it is recommended to have even more. Kjell&Co says 129 SEK.

To power the device, you would need some kind of mini-USB cable, either to an adaptor or to your computer. I have a spare USB output on my NAS and am going to use that one.

Additionally, you need to find a monitor cable of some kind. The Pi supports HDMI and/or Composite in its end. Do whatever conversion you have to do between your devices. I chose a composite to start with, as I simply did not have any HDMI monitor, nor cable at home. A composite cable is normally shipped with most other strange electronic equipments and after a while you end up with hundreds of these yellow cables in your drawers.

Finally, to start the work, you would need a keyboard (USB) and possibly a mouse (USB).

2013-08-04 21.05.10

Above you can see the device next to my smashed phone from my Africa trip (accident on the highway). And … errhm … the dust seen on the black table is of course photoshopped and I have no idea how it got stuck on the picture. The phone is (was) a Samsung Galaxy SIII Mini.

A lot of information is provided in the forums, the how-to-guides, Raspberry’s home page, etc., etc. With this post, I just wanted to highlight how simple things were and how quickly it was done.

The SD card must first be formatted and prepared with an image file. The image files can be downloaded from Raspberry’s pages. Eventhough, they claim to have an installation backage for N00Bs I would not recommend using it. Instead download the raw image file of your favourite dist. The Raspbian has got best reviews “out there” and I kind of fancy debian.

As mentioned on the Downloads pages, you need to install an SD formatter program (SDFormatter) as well as a image copying program (Win32DiskImager). Drag-and-drop won’t work in Windows per se (surprise).

So, format the SD card per the instructions, erase it completely. Then unzip the raw image file to the Desktop or whereever. Use the image copying program to copy the file to the SD card.

Before you remove the SD card you have (with similar setup as mine) to edit the config.txt file found in the root of the SD card hierarchy. Open with wordpad to avoid the issue with line-break characters (or lack of…)

To set composite PAL (as in Europe) uncomment the following line:
sdtv_mode = 2

It is also quite likely you have a monitor with a 16:9 ratio, so also include
sdtv_aspect = 3

Now, eject the SD card and slide it in the Raspberry Pi reader.

That’s it! Hopefully 🙂 Power up the device by inserting the USB cable and hope to see some information on the screen.

What you probably will find is the raspi-config (effectively a tool to change the text start-up files, like the config.txt that we manually edited before).

Enable boot to desktop, change the keyboard settings and set the time zone (internationalisation), enable SSH and expand the file system to start with.

Restart and make sure you find the desktop. (You should see a very large Raspberry…)

Go and hook up an ethernet cable to your router and also check if you get internet access.

Given that was OK we should now start to remove things from our tiny little Raspberry. We want to get rid of most cables.

First start to install the SSH-mounting of external/remote drives (unless they are ftp-based only, like the crap Seagate NAS). In a terminal:

sudo apt-get install sshfs fuse fuse-utils libfuse2

Then as always, just to annoy your sys-op, make sure to exchange the public keys such that you can log on in a seemless fashion.

On both machines (your raspberry and the remote on which you have the disks to mount):

ssh-keygen -t rsa

Find the latest .pub files (public key) on each computer. Cross-copy them to each computer. So .pub file from computer A goes to computer B, and vice versa. Then append them to the (possibly already existing authorized_keys file).

cat >> ~/.ssh/authorized_keys

Double check that you can now ssh in to the server without having to provide the password.

On the raspberry, creating the mounting point(s) for the server disk(s). For example:

sudo mkdir /mnt/remote
sudo chown pi /mnt/remote

First make sure that the non-root user pi can also run the fuse (mounting):

sudo usermod -G fuse pi

And then run the command to mount:

sshfs user@remote.server: /mnt/remote/

You can also make sure that the Pi keeps the connection alive by adding a alive interval to your ssh config file:

echo "ServerAliveInterval 120" >> ~/.ssh/config

Check that the files are properly mounted and that you can access them with read-write permissions. In order to automatically load the files next time you logon, you would have to either change in the /etc/fstab file or in the /etc/rc.local file. I prefer to do the latter.

/usr/bin/sshfs -o idmap=user -o allow_other -o reconnect user@remote.server: /mnt/remote

Make sure to add the allow_other to avoid any mysterious root-priviliges.

Then assign a fixed ip and punch a hole in your firewall/router to enable convenient access to Mr. Pi from outside your safe-house and you have all the access you want. Given this access, we should now make the final step to be able to remove most cables from the Pi: install a VNC server, like for example tightVNC which is small enough to fit (The Pi only has 512MB RAM).

In short, one can follow these steps:

but there are some flaws to that description. For example, I cannot make the vnc start automatically upon boot. This is however less of a problem, since it can be done through a remote terminal anyway. Especially, since the keys have been exchanged, it is a one-liner in shell.

On our Windows machine, with the TightVNC viewer installed, we now get a nice interface to the tiny little thing!

From here on, it’s just rock and roll… sort of.

I now have the device connectede to my NAS through its USB port and a short Ethernet cable to the router. There are of course USB-to-Wifi modules to buy too.

2 thoughts on “My initial Raspberry Pi experiments…

  1. I hooked up mine via hdmi to a 21″ TV and used the USB port on the TV as power supply. Bought a small (unpowered) USB hub for connecting mouse and kbd, and used the remaining USB port on the pi for a wifi dongle, worked fine.

    You know you can play minecraft on the pi ( and write python scripts to automagically build (or destroy…) stuff and move the player around. You can’t play remote though, you need the pi to be directly connected to a monitor. However, you can run python scripts from a remote machine and mess with the kids when they are playing 😉

  2. Aah, the power of remote access … moahaha. As Dogbert once said, it is a nice way of hurting people without getting blood on your hands.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.