power plug 5v 2.1A, (don't use USB phone chargers, as 1A is not powerfull enough)
https://www.kubii.fr/14-chargeurs-alimentations-raspberry/1631-alimentation-raspberry-pi-5v-25a-pour-raspberry-pi-3-couleur-noir-kubii-640522711000.html
USB sound card (built-in output sound is crapy and there is no input sound by default on Raspberry Pi)
a good compatible USB soundcard, recommanded : https://www.sonovente.com/behringer-uca-222-p26643.html
Hifiberry sound card https://www.hifiberry.com/shop/boards/hifiberry-dac-adc/
standard : https://www.kubii.fr/convertisseurs-adaptateurs-raspberry/2055-carte-son-externe-usb-vers-35mm-jack-adaptateur-audio-kubii-3272496009158.html?search_query=carte+son+usb&results=16
WiFi USB dongle (2 WiFi USB dongles if you have a version of Raspberry Pi < 3) to connect to internet without ethernet cable
a compatible WiFI USB dongle : https://www.kubii.fr/claviers-et-peripheriques-usb/64-module-wi-fi-usb-wi-pi-pour-raspberry-pi-kubii-3170111000385.html
If you have a version of Raspberry Pi < 3, you will need a second Wifi USB dongle to create the access point (AP):
Dont use any WiFi USB Dongle based on a chip that is not compatible with the AP mode - bug detected,
Check the model of your dongle's chip
then check on this list of existing chips, on the AP colomn, if your chip model is compatible with AP mode : https://wikidevi.com/wiki/Category:Linux_driver/802dot11 .For any chip model, you can get the list of WiFi dongles based on it : for example, these WiFi dongles are not compatible: https://wikidevi.com/wiki/Rtl8192cu
these are example of compatible chips : brcmfmac, or rt2800usb. Check here (compatible models) : https://wikidevi.com/wiki/Brcmfmac , https://wikidevi.com/wiki/Rt2800usb
icecast server needed for upstream !
If you have a raspberry pi 3B then download Raspbian stretch lite : https://downloads.raspberrypi.org/raspbian_lite_latest
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.
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:
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.
$ 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
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"
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
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
Now before to restart, put all elements together.
Plug the additional USB WiFi dongle and the USB sound card. And plug the antenna.
To make the dipole : π-box - How to build an antenna
Connect the dipole antenna to the pin 4 (modulation) and 5 (ground)
Now, just plug the power, or the battery, to run the PiBox.
[[∏-Case]]
[[DIY_power_DIY_Solar_Power]]
On the GPIO 4 as described on the image below : the forth on the left starting from the top
[[File:Rasppische-fm-transmitter.jpg]]
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
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]]
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).
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.
'''INPUTS''': choose an input from the following
input from '''FILES''', stored on the SD card, with a 'play in random order' option
input from '''STREAM''': can be your favorite webradio, a stream from another PiBox, etc ...
'''OUTPUTS''': select the output of your transmissions
All outputs can be associated simultaneously, and freely !
'''LINE OUT''': plug a mini-jack to the sound card, to connect the PiBox to a speaker,
'''STREAM''': enter the icecast server address to stream
server address : p-node one is : http://stream.p-node.org/
user : can be PIBOXnn (choose a number)
password : can be 107MHz replace the 2 stars by the name of the band on which you are broadcasting in capital (don't think too much, it's very simple, or see below :)
mountpoint : can be piboxnn.ogg
port : p-node one is 80
bitrate : 128 for example
metadata name, genre, ...
'''FM''': tune the frequency to broadcast on the FM band, from 88 MHz to 108MHz (actually pifmrds allows to broadcast from 76MHz, but you will need a rtl-sdr to listen, or adequate equipment).
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
input from '''FILES''', stored on the sd card, with a 'play in random order' option.
'''OUTPUTS''': choose a output mode, all outputs can be associated freely
'''LINE OUT''': plug a mini-jack to the sound card, to connect the PiBox to a speaker,
'''FM''': tune the frequency to broadcast on the FM band, from 88MHz to 108MHz
'''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
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~~
automatic switch to files when ping to google fail: there is a 5 seconds timeout to check if internet is ok, opening google.com web page, but on my pibox (b01), it keeps switching whereas internet is ok, I tried to put a 30 s timeout but it doesn't seem to have solve the pb
reboot: daily reboot seems blocked sometimes by pifm