Magic Mirror – Part 1: Installing the Raspberry Pi

To meet all the needs for the Magic Mirror, the Raspberry needs the following features:

  1. Wifi connectivity
  2. A local webserver to host the interface.
  3. A browser running full screen to display the interface.

 

Attention!
I am using a Raspberry Pi 1 Model B+.
The Model B+ is the final revision of the original Raspberry Pi. It replaced the Model B in July 2014 and was superseded by the Raspberry Pi 2 Model B in February 2015.

 

Basic installation

The operating system of choice is Raspbian, due to it’s flexibility and wide open-soure community support.

Attention!
The following guide is intended for Raspbian JESSIE.

Currently there is the version release date is 2015-11-21. The installation requires a 4GB or larger SD card, which has a speed classification of Class 6 or higher (recommended 8GBClass 10).

Step 1

First download the Raspbian Image from the official website at http://www.raspberrypi.org/downloads. After downloading the zip file must be unpacked. This is an IMG file, which contains the operating system.
Windows users will also need the Win32 Disk Imager tool in the binary version to dub the images on the SD card. After downloading the zip file must be unpacked.

Step 2 (Windows)

Open the downloaded Win32DiskImager.exe. In field Image File you must insert the downloaded Raspbian Image. In the next field device you have to select the drive letter to which the image have to be installed. When you have ensured that both statements are correct, click on Write and the image will be written to the SD card.

Step 3

Put the SD card in your Raspberry Pi. Before you connect the mini-USB connector for power supply, connect the Rasperry Pi with your router via Ethernet. If you want to set up the Raspberry Pi remotely, you have to make a SSH connection after it has started. Otherwise insert a keyboard via USB and a screen via HDMI just before the start.

Step 4

After some initiations were made for the first start of Raspbian comes a gray-blue surface, including a menu, through which you can move with the arrow keys, Enter and Escape on the keyboard. In these few settings will be executed now.
If an SSH connection is used, we need to call the tool with the following command:

sudo raspi-config

Step 5

First, select the item Expand File System so Raspbian uses the entire space on the SD card. After a short time the extension is confirmed. However, the drive will be extended not until the next boot. This may take some time in which the Raspberry Pi is not responding.

Step 6

Now we select the menu Internationalisation Options > Change Locale. In the list we navigate to de_DE.UTF-8 UTF-8 and activate this line by spacebar. Then we click the Tab key and click OK. Following the system asks how the correct output is to be ensured by other language applications. There we choose en_GB.UTF-8 for system-wide language and confirm by pressing Enter.

Step 7

Subsequently, back in the main menu we choose Internationalisation Options > Change Time Zone and set the correct time zone. For me this would be Europe and Vienna in Austria.

Step 8

Then we go to Finish through Tab in the main menu and agree that the Raspberry Pi is restarted.

Step 9

After the Raspberry Pi has booted again, we update the Raspberry Pi by using the following command in the console. Remeber: the default user listens to the name pi and the password is raspberry.

sudo apt-get update && sudo apt-get upgrade

Step 10 (optional)

As a final step, it is advisable to extend the swap to double the size of the RAM, but should 1024MB be sufficient. At Raspberry Pi B or B+ exactly as in the Raspberry Pi 2 Model B consequently to 1024 MB and for older models optionally correspondingly less. How to do this, I described in the following.

A known problem of Raspberry Pis is the up Model B+ very limited RAM. From 256 MB in Model B Rev 1.0, 512MB from Model B Rev 2.0 it was in the Raspberry Pi Model B 2 on 1 GB RAM and thus on a decent size. However, there is still the SWAP, one can easily expand under Debian. In simple terms the SWAP is a latch which is treated similarly to the RAM, but on a permanent storage medium (in the case of Raspberry Pis the SD card) stored. The advantage is that this expansion is generally inexpensive, but it is by far not as fast as the RAM.
How to extend the SWAP under Raspbian to a reasonable size, I explain below.

Requirement: installed Raspbian or comparable distribution

Step 10.1

First, we have to create the SWAP file. Rule of thumb: RAM * 2 = SWAP, but it is sufficient for most applications on the Raspberry Pi the RAM plus – if ever needed – max. 1024MB SWAP. Consequently, I would take not more than 1024 MB on the SD card for the SWAP even with a Raspberry Pi 2 Model B.

sudo su -c 'echo "CONF_SWAPSIZE=1024" > /etc/dphys-swapfile'
sudo dphys-swapfile setup

Step 10.2

After we have created the swap file, we have to activate it once.

sudo dphys-swapfile swapon

Done! Now your Raspberry Pi has enough SWAP for the worst case.