Evaluation Type: Independent Products
Did you receive all parts the manufacturer stated would be included in the package?: True
What other parts do you consider comparable to this product?: null
What were the biggest problems encountered?: null
This article reviews the Raspberry Pi (RPi) being used as an always-on computer, which will be used as a torrent box (only using non-copyrighted material) that can be controlled from Windows, MacOS, Linux and Android.
To accomplish this goal I will use the Raspbian Linux distribution as the software platform, and Deluge as the torrent client. It will be run in daemon mode and no graphical interface will be used in the Raspberry Pi. Deluge will be controlled in 3 different ways: a) from any browser through its web interface; b) from Windows, Linux and MacOS computers through the installation of its graphical interface on these computers; and c) from Android-based devices through the installation of the Transdroid application.
The always-on feature can be strengthened by using a hardware watchdog timer if the BCM2836 also has one (which is very likely), as its predecessor BCM2835 from the RPi 1 had.
Connectivity to the RPi will be enhanced through the use of a dynamic DNS client, so it can be accessed from outside of its LAN.
A USB hard-drive will be used for storage of the downloaded material, which will be shared on the LAN through SAMBA, so it can be accessed from computers running Windows, Linux and MacOS, besides other devices like Smart TVs, video games, tablets, smartphones etc. It will be accessed whether or not this new RPi also needs additional power to power an external HDD (it is very likely it will).
This is a project which can exercise many features of the Raspberry Pi 2.
Go to http://www.raspberrypi.org/downloads/ and download the most recent raspbian image. Bear in mind that by downloading and installing raspbian you are agreeing with the Oracle Binary Code Licence Agreement, since raspbian contains Java SE Platform Products. I recommend you to download the image via torrent, since you can use it later to test you setup and leave your Pi seeding it to help other users.
After the download finishes, just follow the instructions on http://www.raspberrypi.org/documentation/installation/installing-images/README.md to write the image to your SD card. Please be careful since if you mess things up during this process you can erase your own data. You have been advised!
After preparing the microSD card simply insert it in Raspberry Pi's microSD slot, connect your Pi to your LAN through an ethernet cable and power it over micro-USB. Make sure you have a DHCP server on your LAN, because the Pi will try to configure its network address automatically through DHCP. After waiting a couple of minutes for it to boot you'll have to find out what is its IP address. You can either check it on your DHCP server (if the DHCP server runs in your router there is a good chance it is only a matter of opening the router's setup interface) or use a tool called nmap. In this case simply open a terminal shell and type:
sudo nmap -sP <YOUR_NETWORK_ADDRESS>
After discovering the Pi's IP address you can connect to it over SSH. On a terminal window type
When prompted for a password, enter raspberry. You should see some messages and then a command prompt like this:
pi@raspberrypi ~ $
Now you should go through the initial configuration of your Pi. Type sudo raspi-config. You might want to expand the filesystem (option 1) so you can use all the available space in the microSD card, change the user password (option 2), and configure your locale(s) (option 4.1) and timezone (option 4.2). If you change anything that requires a reboot your connection to the Pi will be closed and you'll have to ssh into it again. You should also update the OS and reboot it one more time to make sure you are running its the most up-to-date version. All of this can be done with the following command:
sudo apt-get update && sudo apt-get upgrade && sudo reboot
You'll probably want to give your Pi a permanent IP address, so you don't need to discover its IP address every time you want to connect to it. You can do this editing the /etc/network/interfaces file, changing the lines around iface eth0 inet dhcp (including itself) to make them look like this (change the values with the appropriate values for your LAN):
Alternatively, you can configure your LAN's DHCP server to always give the same address to your Pi over DHCP.
Since the idea is to use this as NAS and BitTorrent box, you'll probably want more storage than your microSD card can provide. The easiest way to expand the Pi's storage is by plugging a USB flash drive or a USB hard drive in one of the Pi's USB port. If you're using a hard drive, you might need to use a powered USB hub, since the Pi may not be able to provide enough energy to power your hard drive over USB. This will mainly depend on how power-hungry your drive is and what is the capacity of the power supply you're using to power the Pi. If you plug your hard drive and it doesn't show up on dmesg, or if you have usability issues like your drive being disconnected from the system, than you probably don't have enough power.
If your drive is formated as NTFS, install ntfs-3g for write support (otherwise it is going to be mounted read-only):
sudo apt-get install ntfs-3g
Than you'll need to add an entry in the /etc/fstab file for your drive to be mounted automatically. The best way to do it is using the partition UUID, which can be discovered using:
ls -laF /dev/disk/by-uuid/
The entry that points to sda1 is your partition UUID (assuming that's the only drive you have plugged in the Pi at once since its boot). With that information add a line to /etc/fstab like this:
Where /mnt/hd is the directory where you want your drive to be mounted (you'll need to create it if it doesn't already exists).
I'll choose Deluge as the BitTorrent client, since its a lightweight multi-platform client which uses a client-server architecture. That means we can run the Deluge daemon, which is the part that does the actual download and sharing, in one machine, and the Deluge client, which is the user interface to control the daemon, in a different machine. We'll run only the Deluge daemon on the Pi, and later we'll will install the Deluge client on one of our LAN machines.
To install the Deluge daemon on raspbian simply issue the following command:
sudo apt-get install deluged deluge-console
To configure Deluge we'll first start and kill it just so it creates a default configuration file:
deluged && sleep 5 && killall deluged
And then configure a user name and a password to access the deluge daemon remotely. To do that add a new line with the following format to the end of the ~/.config/deluge/auth file:
Changing username and password appropriately. The number in the end is the access level and 10 means full access.
Next you'll have to enable remote access to the daemon using the CLI client (that's the only reason we've installed the deluge-console package, fell free to remove it afterwards if you want). So start deluged again and fire up its console UI.
Once inside Deluge's console, type:
config -s allow_remote True
These will enable remote access to the daemon and shut it down, so after leaving the console UI you'll have to start it again typing deluged one more time on your shell prompt.
Last but not least, you'll want to configure your Pi to start deluged upon boot, so you don't have to worry about manually starting it after a reboot (which may be due to a number of reason, like a power failure etc.). For this you'll have to create two new files *as root* with the following content:
/etc/default/deluge-daemon (If you want to run deluged under a different Linux user than pi, you'll have to change the DELUGED_USER variable accordingly).
Then set the correct permissions to both files and tell the OS to run /etc/init.d/deluge-daemon on every boot with the following commands:
sudo chmod 755 /etc/default/deluge-daemon /etc/init.d/deluge-daemon
sudo update-rc.d deluge-daemon defaults
Now that we have our Deluge server running in the Pi, it is time to configure the UI which will control it on a PC in the same LAN. The Deluge downloads page give you pointers to packages to different Linux ditributions, Windows versions and Mac OS X. After installing it in you OS of choice, fire it up and go through the following configurations:
Now go to File -> Quit and start Deluge again. You'll be presented with the Connection Manager dialog. Click the "Add" button to add a new server and enter the information of your Deluge server running on the Raspberry Pi (host name or IP address, user name, and password). Click "Add" to finish the "Add Host" dialog and you should see an entry for your server with the status indicator green. Now select it and click "Connect".
You can repeat this process on different PCs on your LAN. You may also want to check some of Deluge preferences now (like where it is going to store its downloads, bandwidth allocation etc) through the same preferences dialog you've used to disable the client's classic mode.
It is also possible to control Deluge through its web interface. To be able to do so you need to install the deluge-web package on the Pi and run it with the following commands:
sudo apt-get install deluge-web
After that point your browser to port 8112 of your Pi's IP address and you should be greeted with the login screen (default password is deluge):
If you're running Deluge's Web UI there is a very useful Android app that can control Deluge through the web API: Transdroid. It is simple and easy to install and configure, just follow the directions on the website.
Now we want to be able to access the files on the Pi easily over the network, and to accomplish that we'll use Samba. Samba is an implementation of the SMB/CIFS protocol for Linux, which is the protocol that provides Windows file sharing, printer sharing and directory services. We'll install the Samba server on the Pi and configure a file sharing of the mountpoint of our external drive.
To install the Samba server and tool, type:
sudo apt-get install samba samba-common-bin
Next you'll have to edit its main configuration file, /etc/samba/smb.conf, and change the following parameters:
Now restart the Samba server with the following command:
sudo service samba restart
And add a Samba password to the default pi user, so it can access the share through the Samba server.
sudo smbpasswd -a pi
That's all on the server side of Samba. Now you can simply browse to your network shares using your favorite file browser on your favorite OS.
If you want to be able to access your Pi from outside of your LAN, you'll need to give it a well-known name in the DNS network and setup port forwarding on your router on internet gateway. To have a DNS name when you don't have a fixed IP, you'll need to use a Dynamic DNS service. There are plenty of these services available around the web, some of which are free and others which are not. I personally like freedns.afraid.org, which is free, easy to use and has been performing well. It could either be configured directly on your router (if supported) or on the Pi. Fiddling with routers is out of the scope of this article, but there are plenty of information around the web on how to setup both the DDNS and port forward for all the routers out there that support these features. To configure DDNS on the Pi (in case your router does not support it) follow the instructions on the DDNS service website. If you're using afraid.org, look for quick cron example.
A timer is an entity which counts down an specific amount of time until it expires. Timers are used to trigger an infinite amount of different actions both in hardware and software. A watchdog timer is used to reset a system after the system has been hung for a specified amount of time. The system starts the watchdog timer with a predefined time value and it is expected to reset the timer periodically, before it expires. If it fails to do so the watchdog timer assumes the system is hung and forcibly resets it.
Watchdog timers can be implemented in software or hardware. The Raspberry Pi 2 ships with a hardware watchdog timer, and that is what we'll use to reset or Pi in case it hangs for some reason. This way we can recover from (some) failures even if we are physically away from the Pi.
First you need to install the daemon that will start and feed the watchdog, and set it to be run during system boot:
sudo apt-get install watchdog
sudo update-rc.d watchdog defaults
Now edit /etc/default/watchdog to make the watchdog daemon load the driver for the RPi2 hardware watchdog timer. The file should look like this:
We also need to configure some parameters of the watchdog daemon in the file /etc/watchdog.conf:
There are a whole load of other things you can check for and actions you can take to recover from errors using the watchdog daemon. If you're interested check the manpages of watchdog and watchdog.conf.
These are some packages that you can remove to free some space on your microSD card:
sudo apt-get remove minecraft-pi python-minecraftpi sonic-pi wolfram-engine deluge-console
I recently got a RPi-2 to add to it little sister the 2- RPi-B's I have. I love the RPi-2 but had problems with the 2/2015 version of Raspbian made for the Pi-2. Although it is lightweight and runs fast, I kept having SD card corruption every time I rebooted or shutdown. I posted this on the Raspberry Pi forums and just kept getting the usual (bad SD card, low voltage, not shutting down correctly). I tested all that it was fine. I believe there is a bug in the latest version of Raspbian (too bad because I like the operating system). Using the same Hardware and Power Supply, I loaded Ubuntu for the RPi-2. It works flawlessly. It is a bit more heavy weight than Raspbian and hence runs a but slower that the Rapbian image but I love it. I have ported all the software I had running on my Pi-B to this platform and have been running it for over a month with no problems. I presently run (JC-Block - telemarketer and junk call blocker, OpenVPN, a home brewed program that text's me when a call has been blocked, SSMTP, Mailx, Motion software, and another home brewed GUI based Python program that manages the call blocker concurrently) Did I say I love my Pi-2?
Feeling bad to have missed this Roadtest.