This is an old revision of the document!


Pi-Radio

Image: 2016-09-23-raspbian-jessie-lite.img

IP Address: 192.168.0.121
PW:st0lenm0ments


Upgrade

$ sudo raspi-config
$ sudo apt-get update
$ sudo apt-get upgrade

$ sudo apt-get install htop python-pip

Mount USB Stick

$ sudo mkdir /home/pi/stolenmoments
$ sudo blkid
/dev/sda1: LABEL="USB-STICK" UUID="3DE8-04D4" TYPE="vfat" PARTUUID="4ca531d6-01"
$ sudo nano /etc/fstab

edit:

#USB Stick on /dev/sda1

UUID=3DE8-04D4 /home/pi/stolenmoments/data vfat utf8,umask=022,uid=pi,gid=pi 0 0 or:

#USB Stick on /dev/sda1
/des/sda1       /home/pi/stolenmoments/data    vfat    utf8,umask=022,uid=pi,gid=pi  0       0

$ sudo mount -a


IP and Network configuration

Enable the SSH Server

In Raspian Jessie it should be activated allready. If not enable the SSH server by opening the raspi-config:

$ sudo raspi-config

In 8. Advanced Options you can activate SSH.

Static IP Address

Look up your gateway:

$ netstat -r -n

Find you IP address:

$ ip addr

Give the Raspberry Pi a static IP address. Open the interfaces file:

$ sudo nano /etc/network/interfaces

Add these lines after “face eth0 inet dhcp”:

Or:

  # Ethernet
  auto eth0
  allow-hotplug eth0
  iface eth0 inet static
    address 192.168.0.121
    netmask 255.255.255.0
    gateway 192.168.0.1
    dns-nameservers 8.8.8.8 8.8.4.4
    

Save and quit, ctl+o, Return, ctl+x.

Disable the DHCP-Client:

 $ sudo service dhcpcd stop
 $ sudo systemctl disable dhcpcd       

Restart ethernet:

 $ sudo ifdown eth0
 $ sudo ifup eth0

Or/and reboot:

 $ sudo reboot

Login over SSH

One can login from your computer with:

$ ssh pi@192.168.0.099

or with XWindows support:

$ ssh -XY pi@192.168.0.099

PW: raspberry

Miscellaneous

If the host key verification failed, one can remove the old key with:

$ ssh-keygen -R 192.168.0.099

And with

~.

one can terminate a broken ssh session.


Setting up the radio

Pi-FM-RDS
https://github.com/Ginkgo23/PiFmRPi2

$ mkdir /home/pi/Pi-FM-RDS
$ cd /home/pi/Pi-FM-RDS
$ sudo apt-get install libsndfile1-dev
$ wget https://github.com/Ginkgo23/PiFmRPi2/archive/master.zip
$ unzip master.zip
$ cd PiFmRPi2-master/src
$ make clean
$ make

$ sudo ./pi_fm_rds -freq 99.9 -audio sound.wav

PiFM
https://github.com/rm-hull/pifm
http://www.icrobotics.co.uk/wiki/index.php/Turning_the_Raspberry_Pi_Into_an_FM_Transmitter

$ mkdir /home/pi/radio
$ cd /home/pi/radio

download pifm:

$ wget http://omattos.com/pifm.tar.gz

or:

$ wget http://dernulleffekt.de/download/pifm.tar.gz

and unpack:

$ tar -xzvf pifm.tar.gz

connect a wire to GPIO 4.

$ sudo ./pifm left_right.wav freq 22050 stereo

for Pi 2,3

make a folder:

$ mkdir /home/pi/PiRadio
$ cd /home/pi/PiRadio

install:

$ sudo apt-get install unzip make gcc g++

download:

$ wget https://github.com/markondej/fm_transmitter/archive/master.zip

unzip:

$ unzip master.zip
$ cd fm_transmitter-master/

make:

$ make

transmit:

$ sudo ./fm_transmitter -f 99.9 star_wars.wav 

—-

Read-Only SD Card

Fstab

in:

$ sudo nano /etc/fstab

change:

/dev/mmcblk0p2  /               ext4    defaults,noatime,ro  0       1
tmpfs           /tmp            tmpfs   defaults,size=30M    0       0

Disable some Programms

disable rsyslog and dphys-swapfile:

$ sudo systemctl disable rsyslog
$ sudo systemctl disable dphys-swapfile

Remount

To remount the partition writabe:

$ sudo mount / -o remount,rw

GPIO Connections

 GPIO 04   Antenna
 GPIO 17   Button EN
 GPIO 18   Button DE
 GPIO 22   LED EN
 GPIO 23   LED DE
 GPIO 27   Shutdown/Reset
 

http://elinux.org/RPi_Low-level_peripherals