A PirateBox is a Linux based system built using free software for the Raspberry Pi that provides private sharing of digital content. The PirateBox creates a local WiFi network, independent from the Internet, with anonymous file sharing and chatting capabilities.
I wanted to make a PirateBox and create a cool looking case for it. I used a laser cutter to cut the pieces of the case from 1/8" thick birch plywood and painted it to look as shown in photos 1 and 2. A small Python program controls custom hardware that makes the arcs above the skull glow when the PirateBox is up and running. Another small Python program controls a push button switch that illuminates when the Raspberry Pi is powered up. When the switch is pressed, the program shuts down the Raspberry Pi preventing the problems that can occur if you just unplug a running Raspberry Pi.
The "PirateBox Wiring Diagram" shows how the various components are connected to the Raspberry Pi. The second diagram and the schematic show the wiring for the LED circuit board. Since the three large LEDs draw more power than the Raspberry Pi can provide, the LED circuit board is powered separately and uses an optoisolator to keep the LED circuit isolated from the Raspberry Pi.
The PirateBox can be painted with different color schemes to create the skins shown in step 19.
This instructable assumes you have experience with setting up and running a Raspberry Pi, that you have experience soldering components to printed circuit boards, and that you have access to and experience with a laser cutter.
I made this at TechShop.
Step 1: Parts
The following parts are needed to construct the Raspberry Pi PirateBox:
Raspberry Pi Parts:
LED Circuit Board Parts:
Shutdown Switch Parts:
Hardware for the Faceplate:
Cables and Cable Mounting Hardware:
Tools (Not pictured):
Equipment for installing Raspberry Pi software (Not pictured):
Step 2: Cut the case parts with a laser cutter
The first step is to cut the parts for the case out of a sheet of 1/8" (3mm) birch plywood. A 45 watt Epilog laser cutter at TechShop was used to cut out and engrave the parts. All of the case parts can be cut out of one 18" x 24" sheet of the plywood.
The laser cutter settings used were:
The finished parts are:
Next, the laser cutter was used to cut a panel out of 1/8" 40-60% transparent sign lighting white acrylic. This part will be mounted on the top panel and is used to diffuse the light from blue LEDs.
The laser cutter settings used for cutting the acrylic were:
The cut acrylic part is shown in photo 8 (with the protective paper on) and photo 9 (with the paper removed).
The laser cutting design files are in the ZIP file attached to this step. The file contains CorelDraw (.cdr) and Encasulated PostScript (.eps) files for the designs.
Step 3: Assemble the case
Gather all of the wood parts for the case and align them as shown in the photo 1. Make sure to align the two side pieces with the cutouts as shown in photos 2 and 3. If these are not aligned as shown, the cutouts will not properly match with the electronics inside the case.
Using a small brush, put wood glue on the edges of the side parts and clamp them together as shown in photos 4 and 5. Clamp just enough to the hold the pieces together but don't make it super tight or it will be difficult to fit the top and bottom panels on.
Gently, flip over the case and put glue on the edges of the bottom panel and push it into place as shown in photo 6. Place some heavy objects on the corners as shown in photo 7 and allow the case to dry over night.
The glued the case is shown in photo 8.
Step 4: Paint the top of the case
Paint the faceplate and top panel as follows:
The finished panel is shown in photo 9.
Step 5: Assemble the top panel
Assemble the top panel as follows:
Step 6: Paint the case
Paint the rest of the case to match the top panel per the instructions below. If you are making a case with the natural wood color, skip this step.
The painted case will look like photos 8 and 9.
Step 7: Build the LED circuit board
The LED circuit board sits under the faceplate acrylic panel and illuminates when the Raspberry Pi WiFi is up and running. Assemble it as follows:
The fully completed LED board is shown in photo 10.
Step 8: Prepare the switch
Using the following parts: push button switch (photo 1), jumper wires (photo 2), 470 ohm resistor (photo 3), and heat shrink tubing (photo 4), prepare the switch:
The completed switch is shown in photo 17.
Step 9: Mount the LED circuit board inside the case
In this step, the LED circuit board will be mounted inside the case (photo 1) using the 3/8" #4-40 machine screws, nuts, and 1/8" #4 nylon spacers (photo 2).
Step 10: Prepare the Raspberry Pi
The first step in preparing the Raspberry Pi is to install and configure the Raspbian software.
The second step is to install and configure the PirateBox software. Boot the Raspberry Pi and log in. Issue the following commands (note that in the list of commands below, the wget command may get split across two lines because of the formatting of this instructable in your browser - the command needs to be entered on a single line: wget and the whole URL in quotes).sudo apt-get update sudo apt-get -y install lighttpd sudo /etc/init.d/lighttpd stop sudo update-rc.d lighttpd remove sudo apt-get -y install dnsmasq sudo /etc/init.d/dnsmasq stop sudo update-rc.d dnsmasq remove sudo apt-get -y install hostapd sudo /etc/init.d/hostapd stop sudo update-rc.d hostapd remove sudo apt-get -y install iw wget "https://s3-us-west-1.amazonaws.com/talk2bruce/instructables/piratebox/piratebox-ws_current.tar.gz" tar xzf piratebox-ws_current.tar.gz cd piratebox sudo mkdir -p /opt sudo cp -rv piratebox /opt sudo ln -s /opt/piratebox/init.d/piratebox /etc/init.d/piratebox sudo update-rc.d piratebox defaults sudo /etc/init.d/piratebox start
There will be an error message after the last command that indicates that the network interface could not be started: this error occurs because the the WiFi USB adapter is not plugged in. This error is OK at this point - it will not adversely effect the PirateBox. It will work correctly when the Raspberry Pi is rebooted with the WiFi adapter plugged in.
The third step is to install the Python program that will illuminate the LEDs when the WiFi is up and running and to install the Python program that will shutdown the Raspberry Pi when the push button is pressed.
Create the directory where the Python programs will reside by issuing the following commands at the command prompt:cd /home/pi mkdir python_programs cd python_programs
Issue the following two commands to get the Python programs:wget "https://s3-us-west-1.amazonaws.com/talk2bruce/instructables/piratebox/rpi_halt_btn.py" wget "https://s3-us-west-1.amazonaws.com/talk2bruce/instructables/piratebox/illuminate_leds.py"
Using a text editor, edit the "/etc/rc.local" file and add the line below to the bottom of the file before the line with "exit 0". Since "/etc/rc.local" is a system file you will need to use the sudo command when you start your editor - for example "sudo nano /etc/rc.local". The line of code you are adding will automatically start the Python program that monitors the shutdown button. Make sure to put the ampersand ("&") at the end of the line.python /home/pi/python_programs/rpi_halt_btn.py&
Lastly, use sudo and a text editor to edit "/etc/network/interfaces" to make the contents look like exactly like this:auto lo iface lo inet loopback iface eth0 inet dhcp #allow-hotplug wlan0 iface wlan0 inet manual #wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf #iface default inet dhcp post-up python /home/pi/python_programs/illuminate_leds.py
The last line runs the Python program that illuminates the blue LEDs when the WiFi is up and running.
The Raspberry Pi is now setup!
Shutdown the Raspberry Pi using the commandsudo halt
and disconnect all of the cables from the Raspberry Pi.
Step 11: Mount the Raspberry Pi inside the case
In this step, the Raspberry Pi will be mounted inside the case (photo 1) using the 1 1/4" #4-40 machine screws, nuts, and the 1/4" #4 or #6 nylon spacers (photo 2).
Step 12: Install the USB power cables
As shown in photo 1:
Use a cable tie (photo 3) to secure the cables outside the case (photos 4 and 5).
Step 13: Attach the rubber feet to the case
Flip the case over (photo 1). Using the corner holes as a guide, adhere the rubber feet (photo 2) to the bottom of the case as shown in photos 3 and 4.
Step 14: Install the shutdown switch
Unscrew the collar from the push button switch. Insert the wires and switch through the cutout on the side of the case. Slide the collar over the wires and screw it onto the switch to secure the switch to the case. The engraving on the case can be used as a guide to make sure the switch is straight. The installed switch is shown in photo 1.
Step 15: Wire the GPIO pins
In this step, the LED circuit board and the shutdown switch will be connected to the GPIO pins on the Raspberry Pi that control their function. Locate the GPIO connectors in photo 2.
The wiring is now complete!
Step 16: Assemble the WiFi antenna
Attach the antenna to the USB WiFi adapter as shown in the photos.
Step 17: Test the PirateBox
All of the assembly is complete and it's now time to test the PirateBox.
Testing is now complete!
If things are not working properly, first check to make your power adapters are properly plugged in to the outlet strip or wall sockets. Some outlet strips have power switches - make sure the outlet strip is on. Next check the GPIO wiring. The next thing to check would be the Raspberry Pi software - you can hook the Raspberry Pi to a monitor and keyboard to make sure it's booting properly - if not, the easiest thing to do is reinstall Raspbian and the rest of the software. If everything is working except for the LED circuit board, then check the wiring on the board.
Step 18: Viola! The Raspberry Pi PirateBox is complete!
Put the top on the case (photo 1) and Viola! The Raspberry Pi PirateBox is now complete!
Step 19: PirateBox Skins
The PirateBox can be made with a variety of skins. Photos 1 and 2 show the case with the natural unpainted wood. Photos 3 and 4 use a yellow color scheme. Photos 5 and 6 use a metallic silver spray paint: when metallic silver paint is combined with the natural texture of the wood, the case looks like it's made of brushed aluminum. Photos 7, 8, and 9 show a blue color scheme with a black skull and a 16mm metal push button with blue LED ring (Adafruit ID 481).
The possibilities are endless!
Step 20: How the Python Programs Work
There are two custom Python programs used in this instructable to create the Raspberry Pi PirateBox.
The first program "rpi_halt_btn.py" is started during the boot process by the commandpython /home/pi/python_programs/rpi_halt_btn.py&
in the "rc.local" system file. The "&" at the end of the command makes the program run as a separate process that keeps running until the program exits.1 import RPi.GPIO as GPIO 2 import os 3 GPIO.setmode(GPIO.BCM) 4 GPIO.setup(25, GPIO.IN, pull_up_down=GPIO.PUD_UP) 5 print "\nrpi_halt_btn: started and now waiting for GPIO halt button to be pressed." 6 try: 7 GPIO.wait_for_edge(25, GPIO.FALLING) 8 except KeyboardInterrupt: 9 GPIO.cleanup() 10 GPIO.cleanup() 11 os.system("halt")
The function of each line is as follows:
The second program "illuminate_leds.py" is run by the commandpost-up python /home/pi/python_programs/illuminate_leds.py
in the system file "/etc/network/interfaces". The "post-up" command is run when the network interfaces are up and running. In this case, it's when the WiFi is up and running.1 import RPi.GPIO as GPIO 2 GPIO.setmode(GPIO.BCM) 3 GPIO.setup(23, GPIO.OUT)
The function of each line is as follows:
Step 21: Errata and Notes
In Step 3 photo 1 and the photos in steps 6 and 9, the engraving for the cable clamps in the photos is incorrect. The labels "RPi" and "LED" are reversed. The correct correct labeling are shown in photos 1 and 2 on this step and the incorrect in photo 3. The design files for laser cutting attached to step 2 are correct.
Incorrect looking photo
In photo 6 of step 4, the painted area is slightly different than the rest of the photos for the step. I missed taking a photo of that part and used a part for an another PirateBox I constructed where I taped it slightly differently.
After I started to document this instructable, the developer of the PirateBox software changed his implementation for the Raspberry Pi to no longer use Raspbian but to use ArchLinux. The ArchLinux implementation is incompatible with the instructions and software I developed for the shutdown switch and the LED circuit board. To make sure that the Raspbian software known to work with these instructions remains available for this instructable, I preserved a copy of PirateBox software and that's what's downloaded in step 10 with the command:wget "https://s3-us-west-1.amazonaws.com/talk2bruce/instructables/piratebox/piratebox-ws_current.tar.gz"
For reference, the original file can be downloaded with the command:wget "http://downloads.piratebox.de/piratebox-ws_current.tar.gz"
The official PirateBox website can be found here: http://piratebox.cc/