∏ NODE

∏-box v2

What is the PiBox ?

The PiBox is a modular system of radio/streaming broadcast, composed of multiplers inputs and outputs. The box aims to provide a multi-functional and easy-to-use micro-fm streaming station. The PiBox has been developed within the collective ∏-node.org. The system is open source, and based on open source software / open hardware.

V-2 = Version expérimentale de la ∏-BOX / Experimental version of the ∏-BOX

Features

Usage

A PiBox allow different possibilities and configurations :

What the PiBox do not do

Hardware prerequisites

REQUIRED HARDWARE

RECOMMENDED HARDWARE''

OPTIONAL HARDWARE

Also required :

icecast server needed for upstream !

REQUITED FOR THE INSTALLATION PHASE

Setup

Installation

  1. Télécharger l'image ici / Download image here
  2. copier l'image sur une carte SD
  3. une fois le système installé (mot de passe par défaut pour la connexion : pipinode) / once jessie is installed (default password for ssh : pipinode)
    $ ssh pi@<IP_of_the_pibox>
    $ cd pibox_V2
    $ git pull

    Vous avec maintenant la version mise à jour de la pibox / now you have the last update for your pibox

optionnel : changez votre ssid / optional: change your ssid

  $ sudo nano /etc/hostapd/hostapd.conf

et modifiez la valeur du ssid / and modify the value for ssid

7 fichiers sont fournis dans le package / package contains 7 crucial files :

Usage

La configuration de la PiBox V-2 se fait par l'intermédiaire d'une page html à l'adresse 192.168.100.1 (configurable) sur une connexion wifi ad-hoc dont l'ESSID est 'pibox' (configurable) ou via l'adresse de la pibox sur le réseau ethernet. La requête de cette page html nécessite un login et un mot de passe : "pibox" (configurable) et "pnodeaccesspass" (configurable).

the PiBox V-2 administration is done through an html page, that you can access to the adress 192.168.100.1 (can be changed) once connected to the wifi "pibox" (can be changed also) or through ethernet (all this can be set up and changed in the config file).

La requête de cette page html nécessite un login et un mot de passe : "pibox" (configurable) et "pnodeaccesspass" (configurable). / The page will ask for a login and password : "pibox" and "pnodeaccesspass" (can be edited)

Sur la page html de configuration, il y a trois parties / the administration html interface has 3 main panels

Upload

La partie "Send a sound file to RPi" permet d'envoyer un fichier à la RPi / the panel "Send a sound file to RPi" allows the user to upload a file to the V-2

Online Mode

La partie 'With Internet Access' permet de choisir une source en entrée / the "Without Internet Access" panel allows the user to select the input (one only)

et de choisir de une à trois sorties simultanées / choose between one and three simultaneous outputs

Offline mode

La partie "Without Internet Access" permet de choisir une seule source en entrée parmi : / the part "Without Internet Access" own to choose one input option

et de choisir de une à deux sorties simultanées : /and choose several output modes

Un changement de configuration ou un changement d'état de la connexion à internet entraîne une reconfiguration à chaud du routage du son seulement si cela est nécessaire => plus de redémarrage nécessaire // V-1 / by saving parameters, a reconfiguration isautomated, you dont need to restart; idem if internet connexion changes. Not like V-1

Options

AirTime

Airtime is a simple, open source platform that lets you broadcast streaming radio on the web. https://www.sourcefabric.org/en/airtime/

To install it, install dependencies :

sudo apt-get install postgresql-9.4 python-virtualenv apache2 coreutils curl ecasound flac gzip libapache2-mod-php5 libcamomile-ocaml-data liquidsoap locales lsof monit mp3gain multitail patch php5-cli php5-curl php5-gd php5-json php5-pgsql php5-fpm php-apc php-pear pwgen python rabbitmq-server silan sudo sysv-rc tar unzip vorbisgain vorbis-tools zendframework icecast2

/!\ for debian jessie, you must install postgresql-9.4 and not postgresql without -9.4 else the calendar does'nt show up /!\

Clone the repository and launch the installer :

git clone https://github.com/sourcefabric/Airtime
cd Airtime
sudo ./install

Follow the configuration process, at the end, you'll see the IP adress of the pibox on wich you can connect with a browser to finish the configuration threw the proposed interface

Réf : http://sourcefabric.booktype.pro/airtime-25-for-broadcasters/manual-installation/

STEP BY STEP INSTALLATION

PRELIMINARIES

Download Raspbian image

If you have a raspberry pi 3B then download Raspbian stretch lite : https://downloads.raspberrypi.org/raspbian_lite_latest

For older models raspberry pi 2B or lower, prefer jesse : http://downloads.raspberrypi.org/raspbian/images/raspbian-2017-07-05/

Writing Raspian image to an SD card

Install image disc (.img) by following carefully https://www.raspberrypi.org/documentation/installation/installing-images/README.md

You will need to use an image writing tool to burn the image you have downloaded on your SD card.

burn on Linux / Windows / Mac

Use etcher : Etcher is a graphical SD card writing tool that works on Mac OS, Linux and Windows, and is the easiest option for most users. Etcher also supports writing images directly from the zip file, without any unzipping required. To write your image with Etcher:

an other way to burn on Linux / Mac

following https://www.raspberrypi.org/documentation/installation/installing-images/linux.md

get the name of the partition of the sd card

$ df -h

eject the sd card and redo the command

$ df -h

For example: sdd, sdb, mmcblk0

then we're ready to use dd. Be careful to indicate the exact address of the SD card, or you will lose all the data on the hard drive if you provide the wrong device name. Make sure the device name is the name of the whole SD card not just a partition.

export the image to the SD card with a terminal

$ sudo dd if=2018-04-18-raspbian-stretch.img of=/dev/sdb status=progress bs=1M

(mac users, use a small m for the bs instruction bs=1m or bs=4m)

when done

$ sudo sync

then eject the SD card and plug it into a raspberry pi, with a keyboard and hdmi monitor

'''Configuration of Raspbian'''

Connect a monitor and a keyboard to the Raspberry Pi. Connect the Raspberry Pi to internet with an ethernet cable.

Switch on the raspberry pi

Default login and password : pi / raspberry

enter the command

$ sudo raspi-config

go to 1. Change User Password

=> remember your password !

go to 5. interfacing and enable ssh

=> by selecting "Yes"

you can also change the timezone and the language settings if necessary

=> then exit by selecting "Finish"

INSTALLATION AND CONFIGURATION

Once Raspbian Lite (Jessie or Stretch) is installed and configured.

$ sudo apt-get update
$ sudo apt-get upgrade

download git, sox et libav-tools oggfwd

$ sudo apt-get install git sox libav-tools oggfwd python3-pip

install pip3 w/ beautifullsoup 4

$ sudo pip3 install bs4

download sources with git

$ cd
$ git clone http://git.rybn.org/rybn/pibox_V2.git

extra libraries to install to control the pibox through wifi : hostapd & dnsmasq

$ sudo apt-get install hostapd dnsmasq

stop services hostapd and dnsmasq

$ sudo systemctl stop dnsmasq
$ sudo systemctl stop hostapd

then create the file /etc/hostapd/hostapd.conf

$ sudo nano /etc/hostapd/hostapd.conf

add the following in the file (you can customize the ssid with youn own value, for example change "myssid" with "myPibox"). To save the file with nano, use 'CTRL-x' to exit and validate with 'y' to save the modified file. See https://www.howtoforge.com/linux-nano-command/ for a complete guide about nano.

interface=wlan0
driver=nl80211
ssid=myssid
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0

configure the file /etc/default/hostapd

$ sudo nano /etc/default/hostapd

then modify the following line

#DAEMON_CONF=""

for

DAEMON_CONF="/etc/hostapd/hostapd.conf"

then, configure the file /etc/dnsmasq.conf

$ sudo cp /etc/dnsmasq.conf /etc/dnsmasq.conf_back
$ echo "" | sudo tee /etc/dnsmasq.conf
$ sudo nano /etc/dnsmasq.conf

put

interface=wlan0      
# Use the require wireless interface - usually wlan0
dhcp-range=192.168.100.2,192.168.100.10,255.255.255.0,24h

then change wlan0 parameters in : /etc/dhcpcd.conf

$ sudo nano /etc/dhcpcd.conf

add to the end of the file

interface wlan0
static ip_address=192.168.100.1/24
nohook wpa_supplicant

continue with

$ sudo systemctl restart dhcpcd
$ sudo systemctl unmask hostapd (new !)
$ sudo systemctl start hostapd
$ sudo systemctl enable hostapd (new !)
$ sudo systemctl start dnsmasq

open the rc.local

$ sudo nano /etc/rc.local

and add just before the line "exit 0" :

/usr/bin/python3 /home/pi/pibox_V2/go.py 2> /home/pi/pibox_V2/error_log.txt >/dev/null &

you should get :

#!/bin/sh -e
#
# rc.local 
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address 
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

/usr/bin/python3 /home/pi/pibox_V2/go.py 2> /home/pi/pibox_V2/error_log.txt >/dev/null &

exit 0

HIGHLY RECOMMENDED : ADD A USB WIFI KEY TO GET INTERNET ACCESS (WITH OR WITHOUT WIRED ACCESS)

To be sure your wifi dongle will work as expected whatever the brand and the driver used (some wifi dongle won't let builtin wifi named wlan0 with the latest Raspbian Stretch like the TP-LINK TL-WN725N that use the driver r8188eu), to avoid any problem do this :

create rules

$ sudo nano /etc/udev/rules.d/70-persistent-net.rules

type

ACTION=="add", SUBSYSTEM=="net", DRIVERS=="r8188eu", NAME="wlan1"

save and shutdown the Raspberry Pi

$ sudo halt

ASSEMBLAGE

hardware assemblage

Now before to restart, put all elements together.

Plug the additional USB WiFi dongle and the USB sound card. And plug the antenna.

Dipole antenna building

To make the dipole : [[∏-Box antenna]] http://p-node.org/doc/index.php/%E2%88%8F-Box_antenna

Connect the dipole antenna to the pin 4 (modulation) and 5 (ground)

Power

Now, just plug the power, or the battery, to run the PiBox.

Optional and experimental

[[∏-Case]]

[[DIY_power_DIY_Solar_Power]]

ADMINISTRATION

TO BROADCAST IN FM, PUT AN ANTENNA

On the GPIO 4 as described on the image below : the forth on the left starting from the top
[[File:Rasppische-fm-transmitter.jpg]]

PLUG THE EXTERNAL SOUNDCARD

To be able to broadcast an external sound source, plug the external sound card in a USB port and plug a minijack into the input (Mic symbol) of the external soundcard

CONNECT TO THE ADMINISTRATION INTERFACE'''

Check the WiFi around and connect to the WiFi called "pibox" (or myssid depending on how you set it up)

then, open a browser and open the address 192.168.100.1

the page will ask you to enter a login and a password : it should be by default : '''pibox / pnodeaccesspass'''

then, you're in to change the settings ! here what looks like the interface

[[File:Interface_pibox.png|1000px]]

INTERFACE

The upper side of the interface shows the ip adress of the device, and which device provides internet (if connected).

The lower side is divided in two modes : Online mode (with internet access) or Offline mode (without internet access).

UPPER PART

WIFI CONNECTION FIELD:
you can enter a SSID and a password to connect to your favorite WiFi network. Ideal for connecting outside on a telephone that shares its connection.

In case the info is wrong, the PiBox will search to create a connection on Ethernet (eth0), and in the case none of those options works, will enter the offline mode

UPLOAD FILE FIELD:
allows you to select a file on your hardware and put it on the storage spot of the PiBox.

The files are stored in the following folder : /home/pi/Pibox_V-2/sounds/

Removal or renaming of files can be done either through ssh, by connecting to the pi with a keyboard and a monitor, or by inserting the SD card in your computer, and from your desktop.

ONLINE MODE:

'''INPUTS''': choose an input from the following

'''OUTPUTS''': select the output of your transmissions

All outputs can be associated simultaneously, and freely !

OFFLINE MODE

The PiBox in offline mode is fully functional, except for the sources that comes from internet and necessitate a connection, same for the broadcast.

INPUTS: choose an input from the following

'''OUTPUTS''': choose a output mode, all outputs can be associated freely

OPTION

'''Change SSID name'''

edit the file /etc/hostapd/hostapd.conf

$ sudo nano /etc/hostapd/hostapd.conf

change the SSID by entering youn own value

  interface=wlan0
  driver=nl80211
  ssid=myssid
  hw_mode=g
  channel=7
  wmm_enabled=0
  macaddr_acl=0
  auth_algs=1
  ignore_broadcast_ssid=0

then

$ sudo reboot

'''Change ssh password'''

by entering the following

$ sudo raspi-config

then

$ sudo reboot

UPDATE YOUR PIBOX

To update / upgrade the PiBox to the latest version, connect in ssh and git pull the last version from the repository.

$ cd pibox_V2/
$ sudo git pull

if you get an error, because of the file configuration.conf, do :

$ rm -rf configuration.conf

WISH LIST OF FUTURE OPTIONS:

KNOWN BUGS