Introduction: A Raspberry Pi or Mr. Clock-workers Server

A couple of month ago I bought a R-PI computer board in a kit that includes the board, the PI camera and a 16 GByte SD card.
I tried around and found that it is a very nice peace of technology.
But I was not able to find a use case for that board.

Last week I have had the idea to build a NAS system for use on conventions and exhibitions to store music, videos and some how to´s on it. In the cardboard there was a glas dome and the idea was born to build a computer with nearly all parts visible.

Step 1: The Parts

Part list:

Picture No. 1
  • Raspberry PI model B with 512 MByte ram
  • Raspberry PI camera
  • 16 GByte SD card
  • WLAN USB stick (TP-LINK TL-WN722N)
  • Freecom 500 GByte USB hard disk
  • 4  - Port USB - HUB (Typhoon)
  • Glasdome 11" high / 6,3" diameter

Picture No. 2
  • 7 Port USB HUB
  • Switch mode power supply, providing +5V switched, +5V permanent, +12V, -12V (VOLTEK SPEC7188B) more infos here: CLICK. The power supply acts like a ATX computer power supply. It provides +5V a a permanent voltage to be used to switch the power supply on and of via a special input wire.

Picture No. 3
  • Vintage lamps, formal used with a 230V neon bulb. I replaced the bulbs by LED bulbs normally used as replacements parts for the 6,3 V bulbs in pinball machines.
  • A bakelite switch to control the power supply
  • A momentary switch to control the ATXraspi circuit.
  • A vintage meter. Used to display the +5V power
Picture No 4.
  • ATXraspi circuit to control power on/off. See here: CLICK



Step 2: Stripping the Electronics and the USB Cables

Carefully I removed the cases from the HUB, the WLAN stick and the hard disk.
I removed the mantel from all USB cables and the USB plugs to give them a more technical look.
This can be done very carefully with a sharp knife.

I soldered the +5V wires directly to the PCB of the 4 port USB HUB

Step 3: Building the Frame and Mounting the Parts

The frame for mounting the inner parts is made of wood.
Later painted to black. I drilled some holes for the cabling and attached some brass washers.

Then I mounted all the parts on that wooden framework.

On picture No. 6 you can see the cabling between the PI and the HDD and the 4 port USB hub.
The second USB port of the Pi was connected to the 7 port HUB in the base case.

In this phase I connected everything together temporary and tested the whole system.

Step 4: Mounting the Frame to the Dome and Final Cabling

Picture No. 2
The frame was mounted on the socket of the glas dome.

Picture No. 3
The ATXraspi switch controls the power of the R-PI. The PI has no power on / power off circuit like an normal computer. With this circuit it is possible to to control the shutdown procedure of the PI by pressing the power button 4 seconds. than a small script is started and shutdown the PI. After a correct shutdown the circuit switches the main power of the PI of. How to connect the ATXraspi to the PI can be found here: CLICK.

All Raspberry PI connections are connected via short cables to the backplane of the base case.

Step 5:

The base is made of MDF to cover the power supply, all the cables and the 7 port HUB for external connections.
The backplane hols special "pass trough" connectors for HDMI, LAN, composite video and audio.
Ventilation holes are for the passiv cooling airflow to keep the power supply cool.

Step 6: Finishing the Case

After painting and gluing the case I mounted everything together and did a final test.

The basic operation system RASPIAN is up and running. :-)

The temperature inside the glas dome is (after 48h) less than 28 C!

Step 7: The Power Circuit

Beside the basic OS the machine needs additional software to act as a NAS and a WEB server and control the power circuit.

Lets start with the power circuit.

Open a terminal windows on the PI and copy and paste the following commands into the terminal.
Commands are in BOLD
This commands where taken from the LowPower labs homepage: CLICK

Maybe this already installed on your PI

GIT is necessary for a lot of software add ons for your PI:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git-core


Download the WiringPi control to control the GPIO pins and make it:

git clone git://git.drogon.net/wiringPi
cd wiringPi
./build


Copy the bash script to the right position and set the prober rights to it:

cd ~
wget https://raw.github.com/LowPowerLab/ATX-Raspi/master/shutdowncheck
sudo chmod 755 shutdowncheck


After this you have to add the script to the rtc.local file to make shure, that the script will be executed on startup.
To do this you can use the build in editor nano:

sudo nano /etc/rc.local

This opens the editor.
Copy the following line and past it to the last line of the rc.local file.

(cd /home/pi && exec ./shutdowncheck) &

To save the file press ctrl o
To exit press ctrl x

Reboot the PI by typing:

sudo reboot

After the reboot you will find the following lines on your screen:

ATXRaspi shutdown script starting…
Asserting pins (7=in,low; 8=out,high)


I you press the power button for a longer period the power LED starts flashing. Release the button and the PI will shutdown automatically.

Step 8: Making a NAS System From Your PI

I attached a 500 GByte HDD to my PI. To enable other users in the network you have to install SAMBA.
To make everything simple I decided to have only one generic user to have access. I used the default user pi.

Installing SAMBA is a simple straight forward process. Just open a terminal again.

First get an install SAMBA and some tools:

sudo apt-get install samba samba-common-bin

After this you have to configure SAMBA. This will be done by editing the SAMBA config file: smb.conf

sudo nano /etc/samba/smb.conf 

This will open the nano editor and the smb.conf file.
In the file you will find the Authentification section. To enable user security you have to remove the # in front of the

# security = user

line. See below:

####### Authentication #######

# "security = user" is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
# in the samba-doc package for details.
   security = user


At the end of the file please ad the following:

[sharename]
comment = SAMBA share
path = /media/data
writeable = yes
guest ok  = no


Where[sharename] is the name of the SAMBA share that will appear in the file manager of WINDOWS or in the Finder of MAC OS.
The PI is mounting all USB devices under the folder /media/. So have a look in the PI file manager for the name of the hard drive and place it in the line: path = /media/data. My drive name is data.

Press ctrl o to save and ctrl x to exit.

Assign a password and enable the user pi for SAMBA:

sudo smbpasswd -a pi

Please type the new password twice.

The next step very important it will assign rights to the whole USB drive.

sudo chown -R pi:pi /media/data

Remember to put the right drive name in the command.

Last step: Restart SAMBA.

sudo /etc/init.d/samba restart

After this the PI is visible in the network. If you connect to it, you will be ask for the username and the password you gave to the user pi.

This is a very configuration.
For more information and if you like to do more complex you can use the following reference:

http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/


Step 9: The WEB Server

I used APACHE web server to provide information's to visitors on exhibitions an conventions.
Installing APACHE on the PI is very simple:

First you have to add a special user and a group to run the services. Otherwise it will not start:

(sudo is your best friend!)

sudo groupadd www-data
sudo usermod -a -G www-data www-data


Than install APACHE:

sudo apt-get install apache2

After the first start you may see an error message that the FQDN can not be resolved
To fix this please do the following:

sudo nano /etc/apache2/httpd.conf

and insert in the empty file:

ServerName localhost

Press ctrl o to save and ctrl x to exit.

And modify the hosts file:

sudo nano /etc/hosts

127.0.0.1 localhost
127.0.0.1 Servername 


Where ServerName ist the computer name of your PI.

Press ctrl o to save and ctrl x to exit.

Restart your PI and open the browser on your Raspberry. Type localhost in the address line and see the "it works" message of the APACHE server.

The web sites of the APACHE server can be found in the path:

/var/www

on the SD card.

To configure your APACHE server you can refer to:

http://httpd.apache.org/docs/current/en/

Have fun!

Raspberry Pi Contest

Finalist in the
Raspberry Pi Contest