My PirateBox experience

My previous post detailed what PirateBox is, but how do you get one?

Well, there are a few approaches. You can try to find someone selling pre-built boxes, but where is the fun in that?

If you want to make your own you can buy one of the supported Routers (buy links near the top few steps), or build one from a $35 computer called a Raspberry Pi (Note that you will also need a SD/SD Micro card, and a WiFi adapter if you go this route, and it is a bit more in depth to get set up, but it’s more fun 🙂 )

Continue to the experience!

If you go with one of the routers, just use the link I posted above and follow that guide. I didn’t do that though, since I already had a Raspberry Pi lying around with nothing to do.

So begins my adventure into Raspberry Pi and PirateBox.  I’d be lying if I said anyone do this, but if you are decent with computers, make sure you have the most compatible WiFi adapter, and don’t mind learning, you’ll get it going.

First off, What do you need to buy? Well, I started with a Raspberry Pi B+ model.

This is the newest model of the Raspberry Pi which benefits from the B Models added memory, and also has 2x as many USB ports (which really doesn’t matter for this project.

Next you’ll need a compatible WiFi adapter. Most of these are rather large, but I found one that is tiny, though it has more setup steps to follow. I’ll list those in detail in this article though so don’t worry if you get this one, it works.  This is the list of all (known) compatible adapters, the one I got is the Edimax EW-7811Un.

It appears to be a newer, but identical model to the other Edimax adapter listed on the site.

You’ll need a microSD of at least 1GB (I recommend 2GB+) or if you are on any RPi earlier than the B+ you will need a full sized SD card (with the same capacity requirements)

Next up, I knew I wanted this thing to not be tethered to the wall, so I bought a 11,200mAH power bankWhich is about 4x the battery capacity of most modern smartphones. Suffice to say this thing can run the Piratebox for well over 8 hours straight. IT has a 1A and 2A output port so you can easily charge a phone or something while running the PirateBox and it will barely put a dent in this power pack. The Pi B+ is recommended to be run on a 2Amp port, but I have had absolutely no issues running on the 1Amp port, and I think Id have to have all 4 USB ports, ethernet port, camera addon, and a display running to get it to use up more than the power it’s getting.

Next up I bought a case. Not necessary, but if I put this somewhere public I don’t want anyone messing with the board or trying to steal the SD card. I went with ModMyPi’s Modular B+ case.

They offer additional risers and stuff you can order with this if you need to fit more things in the case, which I did. I ordered one Riser so that I could later fit the whole power pack contents inside the case (not recommended, but totally doable)


PART 1. – THE BUILD

I didn’t take a ton of pictures of the build, but I’ll explain the process here. it wasn’t terribly hard.

Initially I had the intent of having a display mounted in the lid of the case, which I actually had working for a short time.
1030141304
But it became evident that the pressure from the battery packs was damaging the panel once I combined them, and soon it stopped working. This is why there is currently a big square hole in the middle of my case (which I filled with some artwork).

First I realized the battery packs would not fit due to the case having a ridge around the HDMI port side. I dremeled out just enough area there without damaging the structure to fit in the battery packs.
1103142155
1103142156I then cut the top portion of the case and metal shell of the battery pack off and mounted that on the side, and re-soldered the wires running to the control board, cut a groove in the riser, and mounted that to the side of the case. Lastly I screwed everything together and called it done! (this is not before trying to assemble everything with the LCD panel and board inside too, and breaking the panel! 🙁 )

Screen is dead :(
Screen is dead :(

The case has nail grooves on the back so you can hang it on a wall. I’m going to see how well the battery bank charges on a solar panel, and see if it’s feasible to make a fully self powered version of this.

All done! Aside from the art card I put in the square hole.
All done! Aside from the art card I put in the square hole.

RaspberryPirateBoxYou can download the art for the insert HERE (600dpi PNG file):

 


PART 2 – THE SOFTWARE

 

Now, this is where things get a bit advanced for the feint of heart. Especially if you used the same wireless adapter I used.  But fear not, there is a support forum, and I have detailed my exact experience in… detail. So, lets get going shall we?

1. Ok. So first off you need to load up the pre-built PirateBox image for Raspberry Pi onto your Pi.  I recommend you follow their official Raspberry Pi Guide, as that will be kept up to date, while mine may not be.

If you are using the same wireless adapter that I am, you will need to do a few steps right after you ssh into the Raspberry Pi. So if you’re using the exact adapter I did, stop following the official guide after Step 3, and read this. If not, just follow their guide only.

2. Boot the Pi with the SD card, wifi adapter, Fat32 formatted flash drive, and with a ethernet cable plugged. You need to ssh into the box, so you need to find it’s IP address. I use an app called Fing on android which will print all your LAN devices IPs.  Once you have the IP you can use Putty to do ssh into the box, and point it’s host address to the IP address you learned)
the username and password are both root by default.

3. Once you see a prompt, go ahead and change your password with the command

passwd

4. OK, now we need to switch the hostapd with the one built from Realtek’s source, which the devs have been kind enough to include for us, so:

pacman -U /prebuild/hostapd/hostapd-8192cu-0.8_rtw_r7475.20130812_beta-3-armv6h.pkg.tar.xz

Note: that filename could change someday, so just type the first few letters and use TAB to complete the filename. just make sure it’s the one for 8192cu.

When you hit enter it will ask if you want to remove the current hostapd, and then confirm again. Choose yes for both.

5. When it’s done, we need to tell pacman (the pacage manager for arch) to never try to update this package for us, as it may break things someday. To do so, type:

nano /etc/pacman.conf

use your arrow keys to work your way to the bottom of the file and add the following line at the end:

IgnorePkg=hostapd

When you’re done, hit Ctl+O to write the file out, hit enter to confirm, then hit Ctl+X to exit nano

6. Next up, we just need to tell hostapd to use the proper driver for our adapter. so:

nano /opt/piratebox/conf/hostapd.conf

Edit it to look like the following:

interface=wlan0
driver=rtl871xdrv
ssid=PirateBox – Share Freely
hw_mode=g
channel=1
ieee80211n=1

The bolded portion is the main thing to change. I have ieee80211n enabled as well which should increase speed.
When done, Ctl+O and Ctl+X to save, and exit as before.

7. When you are done, you can go ahead and reboot with

shutdown -r now

And when its back up, ssh back in and continue the official Setup Tutorial as before, continuing from Installation section, step 6.


Once you have got to the point (in the Raspberry Pi guide) of running “systemctl start/enable piratebox”, you ought to see an access point from any device you have that supports WiFi. If not, try a reboot and try again, if still nothing, reply in the piratebox for raspberry pi forums and I and others will try to help you. Double check your hostapd conf files. And if you get an error on boot about wlan link not being ready you can try the solutions in this topic. Id recommend most of those changes even if everything is working.

NOTES:
I had a bit of trouble due to a stupid mistake, make sure when you edit the hostapd.conf that you type the driver name right. there is a L and a 1 in that name. in all caps it’d be RTL871XDRV but don’t type it in caps 😉

The only thing I haven’t tested thus far is bridged mode, though I would like to get that working eventually. If anyone can report back if/how they got it working I’d be very grateful!

Cheers all! and a big thanks to the devs who made it possible for me to have a piratebox!

 

One thought on “My PirateBox experience

Leave a Reply