∏ NODE

π-box v2 - Step by step installation guide

Hardware prerequisites

REQUIRED HARDWARE

OPTIONAL HARDWARE

Also required :

icecast server needed for upstream !

REQUIRED FOR THE INSTALLATION PHASE

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

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

Configuration of Raspbian

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

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. Seehttps://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 uncomment and modify the following line

#DAEMON_CONF=""

for

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

dont forget to uncomment (erase #)

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
$ sudo systemctl start hostapd
$ sudo systemctl enable hostapd
$ sudo systemctl start dnsmasq

set hostname for the pibox. You can change "pibox" with your own name.

$ sudo hostnamectl set-hostname "pibox"

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 - How to build an 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 or pibox.local (if you set this hostname)

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

This is not needed anymore because it is done automatically with latest versions of the 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