Skip to content
An anonymous and completely open offline local wireless network for filesharing, chat and radio.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


An anonymous and completely open offline local wireless network for filesharing and chat. All uploaded soundfiles are put in a loop and broadcasted locally on an FM frequency of choice. A tool of convenience for every co-working space and studio. Based on PirateBox and PiFM.

Hardware requirements

Not strictly needed, but makes installing easier: a screen with HDMI cable, and a USB keyboard and mouse.

Preparing the Pi

Installing Raspberry Pi(rate)Box

The instructions below are copied from PirateBox wiki. The material on the wiki is available under a CC license and is reproduced here for clarity.

First we turn the Raspberry Pi into a wireless access point:

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
sudo rm /bin/sh
sudo ln /bin/bash /bin/sh
sudo chmod a+rw /bin/sh

Replace the contents of /etc/network/interfaces on the Pi with:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

iface wlan0 inet manual
### disalbed for PirateBox
#allow-hotplug wlan0
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhc

Install the Piratebox sofware on the Pi:

tar xzf piratebox-ws_current.tar.gz
cd piratebox
sudo mkdir -p  /opt
sudo cp -rv  piratebox /opt
cd /opt/piratebox
sudo sed 's:DROOPY_USE_USER="no":DROOPY_USE_USER="yes":' -i  /opt/piratebox/conf/piratebox.conf
sudo ln -s /opt/piratebox/init.d/piratebox /etc/init.d/piratebox
sudo update-rc.d piratebox  defaults
sudo /etc/init.d/piratebox start

If everything went ok you should see a wifi network now: 'PirateBox - Share Freely'. If you connect to it, any webpage should redirect you to the PirateBox interface. From there you can chat and upload files.

Alternative: Installing Raspberry Pi(rate)Box from GitHub

git clone cd /home/pi/PirateBoxScripts_Webserver/piratebox sudo ./ sudo update-rc.d piratebox defaults

Using the TP LINK TL-WN821N v4 wifi stick

See also:

Check if this the model you have


Stick should show up as:

ID 0bda:8178 Realtek Semiconductor Corp. RTL8192CU 802.11n WLAN Adapter

Needs custom version of hostapd

sudo mv /usr/sbin/hostapd /usr/sbin/hostapd_orig
sudo mv hostapd /usr/sbin/
sudo chmod +x /usr/sbin/hostapd

Optional: test with

sudo hostapd -d /opt/piratebox/conf/hostapd.conf

Installing PiFM

Now let's set up the radio part. This will broadcast all uploaded audio files on FM. Range is between 50 and 100 meters.

Download the PiFM software.

cd ~
tar xvzf pifm.tar.gz

We will use a script to automate the radio (convert format and add to playlist). There are a couple of examples floating around on the internet. We used (Author unknown, if you read this let us know so we can give credit.) First install the required software:

sudo apt-get install libav-tools sox libsox-fmt-all



Copy/pase this script into, and then save the file with Control-X, Y, and enter. Change the settings for the broadcast frequency and shuffling as needed.


SHUFFLE="true" # true | false


mkdir -p "$LOG_ROOT"


    echo; echo -n "script $0 starting at"; date

    while [ 1 ] # run forever...
        iteration=$(( $iteration + 1 ))
        echo -n "start with iteration $iteration of playing all files in $MUSIC_ROOT at "; date
        rm -vf "/tmp/$TEMP_FILES_PREFIX."*

        # Collecting the songs in the specified dir

        songListFile="$( mktemp "$TEMP_FILES_PATTERN" )"

        find "$MUSIC_ROOT" -type f -follow \
        | grep -iE ".*\.($WHITELIST)$" \
        | sort \
        > "$songListFile"

        songCount="$( wc -l "$songListFile" | grep -Eo '^[0-9]*' )"

        if [ "x" = "x$songCount" ]; then echo "FATAL: no songs could be found in $MUSIC_ROOT"; exit 2; fi
        if [ $songCount -lt 1 ];    then echo "FATAL: no songs could be found in $MUSIC_ROOT"; exit 2; fi

        # Generate a playlist from the results

        playlist="$( mktemp "$TEMP_FILES_PATTERN" )"
        if [ $SHUFFLE = "true" ]; then
            # prefix each line with random number, sort numerically and cut of leading number ;-)
            cat "$songListFile" \
            | while read song; do echo "${RANDOM} $song"; done \
            | sort -n \
            | cut -d " " -f 2- \
            | while read song; do echo "${RANDOM} $song"; done \
            | sort -n \
            | cut -d " " -f 2- \
            > "$playlist"
            cp "$songListFile" "$playlist"

        # Play each song from the playlist

        echo "will now air $songCount songs of $playlist on frequency $PIFM_FREQUENCY, enjoy!"
        cat "$playlist" \
        | while read song
            # simple version: take 1st audio channel:
            # command="avconv -v fatal -i '$song' -ac 1 -ar 22050 -b 352k -f wav - | '$PIFM_BINARY' - $PIFM_FREQUENCY"

            # extended version: merge audio channels:
            # merge the channesl of the song to one mono channel, write to stdout:
            #     sox '$song' -t wav - channels 1
            # read mono audio from stdin, convert into pifm format and write to stdout:
            #     avconv -v fatal -i pipe:0 -ac 1 -ar 22050 -b 352k -f wav -
            # read compatible audio data from stdin and play with pifm at specified frequency:
            #     '$PIFM_BINARY' - $PIFM_FREQUENCY
            command="sox '$song' -t mp3 - channels 1 | avconv -v fatal -i pipe:0 -ac 1 -ar 22050 -b 352k -f wav - | '$PIFM_BINARY' - $PIFM_FREQUENCY"

            echo "$command # $( date )"
            bash -c "$command"

        done # with playlist
        echo -n "done with iteration $iteration at "; date

    done # with endless loop :-)

} 2>&1 | tee -a "$LOG"

Make the script executable:

sudo chmod +x

Upload some files to the PirateBox and start the script with:

sudo ./


Start the radio script automatically on boot

sudo crontab -e

Add this line:

@reboot     /home/pi/

Logging in to the Pi via SSH

  • Connect to the Pi's wifi network.
  • ssh pi@

Changing the wifi network name (SSID)

  • sudo nano /opt/piratebox/conf/hostapd.conf
  • sudo reboot

Deleting files

  • sudo rm /opt/piratebox/share/Shared/example.mp3

Making the shutdown button work

On Pi:

sudo visudo


nobody ALL=NOPASSWD:/sbin/halt

Optional: updating website design

Preparation on Pi

Make sure the git repository is on the Pi. You should have this folder:


If not, run

cd ~
git clone

Make the update script executable. Only needed once:

chmod +x /home/pi/PirateBoxScripts_Webserver/

Making changes to the design on your computer

Clone the repo on your computer:

git clone

Files for design can be found in:


We use Foundation 5. Changes to CSS should made in


Changes to the HTML of the home page should be made in


Changes to the HTML of the file listing should be made in


To link to file listing: use /cgi-bin/, not /Shared as on default PirateBox installation.

Make sure not remove the chat (div id shoutbox) and file upload (div id upload). You also want to keep the scripts.js in there.

To get an idea of how the design will look like: open index.html in your browser. Chat and file upload won't work while your testing on your computer.

Updating Pi with changes

Make sure the Pi has an internet connection.

Each time you want to update the design on the Pi, do this:

cd /home/pi/PirateBoxScripts_Webserver
You can’t perform that action at this time.