Installing the Raspberry Pi

April 19th, 2014 5 min read


This post is part of the MagicMirror series. Check out the other posts here:


    Ads via Carbon

    So, now that all the hardware is done, it’s time to install the Raspberry Pi. To meet all the needs for the Magic Mirror, the Raspberry needs the following features:

    • Wifi connectivity
    • 90 degrees screen rotation to match the portrait screen orientation.
    • A local webserver to host the interface.
    • A browser running full screen to display the interface.

    Edit 2016/04/11: A new version of the interface is available. Including an installer and integrated web server.

    Basic installation

    The operating system of choice is Raspbian, due to it’s flexibility and wide open-soure community support. So after downloading the image, it was time to write the image to the SD card.

    Now, since copying an image takes a long time, there are three options:

    1. You use the rdisk method as discribed in the Raspberry documention.
    2. You grab a cup of coffee, sit back, and enjoy your caffeine intake while you wait.
    3. Both of the above.

    I choose number 3. As soon as this was done, i booted up the Raspberry, logged in, and start the configuration wizzard by entering sudo raspi-config on the command line. In this config, there are few important items that needed configuration:

    • Make sure the system boots to desktop (in stead of commandline or scratch).
    • Configure the timezone to make sure the Magic Mirror will display the correct time.
    • In the advanced options section, make sure the video memory split to 128MB.

    If you try to do the same: feel free to fiddle around with all other options. But remember: if you screw up, you need to take an other coffee and reinstall the OS.

    Wifi connectivity

    Since I don’t want any additional cables to the Magic Mirror, I use wifi to connect the Magic Mirror to the internet. The installation of a wifi dongle really depends on the brand and type. Therefore a complete write down is useless. The best alternative? This magic website

    To be honoust, this is the part that took most of the time during the installation. But once set up, it works flawlessly.

    Screen rotation


    The Magic Mirror is built to be used in portrait mode. Therefore I need to rotate the screen 90 degrees clockwise. Resulting in a 1080 x 1920 resolution. While i was afraid this would be the biggest issue, it turned out to be very easy to accomplish.

    The ‘BIOS’ settings of the Raspberry Pi are stored in the /boot partition of the system. This partition contains a config.txt file with all the settings. To rotate the monitor, add the following line to this file:


    For a more reliable connection to the monitor, I’ve uncommented the line that enables HDMI hotplugging:


    After saving the config file and rebooting the Raspberry I couldn’t suppress a smile: it worked like a charm! No more neck cramps.


    To host the interface (which is simply a webpage), i needed an Apache webserver to be running on the Raspberry. Since this is one of the most common uses of the Rasberry, the installation of Apache is very streamlined.

    First I made sure i was running the latest system software by running the following command:

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

    No it’s time to actually install apache:

    sudo apt-get install apache2 apache2-doc apache2-utils

    Done! That’s all there is. But to make sure I was able to use some PHP scripts on the webserver (more about that later), I also added PHP support:

    sudo apt-get install libapache2-mod-php5 php5 php-pear php5-xcache

    Done … again! Reboot, and the webserver is up and running! I dropped a index.php file in the /var/www folder, and pointed my browser to the Raspberry’s ip adress and yes, it worked.


    Now, to make sure the Raspberry actually shows the webpage I will be using Chromium in kioskmode. Chromium is an open source browser which is able to run on the Raspberry’s OS.

    Once again, installing was easy:

    sudo apt-get install chromium x11-xserver-utils unclutter

    But this time, it needed some extra configuration to disable the screensaver and autoboot in kioskmode. To do this i edited /etc/xdg/lxsession/LXDE/autostart and added a # before:

    Edit 2015/3/2: As commenter Roland points out, please use  the following file in the new Raspian version: /etc/xdg/lxsession/LXDE-pi/autostart

     @xscreensaver -no-splash

    Additionally, I added the following lines:

    @xset s off
    @xset -dpms
    @xset s noblank
    @chromium --kiosk --incognito http://localhost

    This completely disables all screensaving features, and makes sure chromium will start after boot an points to the localhost webserver in full screen mode.

    Time to save the file and reboot once more to check if it works. Since the Raspberry isn’t worlds fastest computer, it took a while, but eventually the testsite appeared on the 90 degrees rotated screen … Yeah!

    On to the last part of the project. The development of the interface.

    EDIT 2015/10/30: If you’re having issues installing Chromium, check out this link: Chromium 45 on Raspbian Jessie (Thanks to reader Vincent)

    Loading comments …
    ©2021 -