Raspberry Pi

From XennisWiki
Jump to: navigation, search

The Raspberry Pi is a series of credit card–sized single-board computers developed in the United Kingdom by the Raspberry Pi Foundation with the intention of promoting the teaching of basic computer science in schools and developing countries. (Wikipedia)

Raspberry Pi

Installation of the operating system


NOOOBs is recommended for beginners. Download it and follow the instructions.

Raspbian (general)

Download Raspbian, for instance Raspbian Stretch Lite for a minimal version. Next install it.

Upgrade Raspbian

apt-get update
apt-get dist-upgrade

Raspbian from Linux for headless Pi

Download the Raspbian Stretch Lite image. Use dd to copy the image to the SD card (use lsblk to find the right label of the SD card and replace dev/sdX with that):

unzip -p raspbian-stretch-lite.zip | sudo dd bs=4M of=/dev/sdX status=progress conv=fsync

Enable SSH

Further information: Pi - Remote Access SSH (see section Enable SSH on a headless Raspberry Pi)

Mount the partition named boot of the SD card. Just create a empty file with the name ssh. Raspbian will enable SSH on the start and delete the file.

touch <path>/boot/ssh

Configure WIFI

Mount the partition named boot of the SD card. Create a file named wpa_supplicant.conf with the content

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

Connect via SSH

  • Insert the SD card into the Pi
  • Connect the USB power supply
  • Wait a little bit
  • Connect to it with SSH: ssh pi@<ip>
  • (Optional) Copy your SSH key: ssh-copy-id pi@<ip>

Disable password login

In the file /etc/ssh/sshd_config set

PasswordAuthentication no


The default login is pi as user name and raspberry as password.

Enable WIFI

Further information: Setting WiFi up via the command line

Start the config tool and select network

sudo raspi-config

Figure out operating system version

cat /etc/os-release

Hardware information

hwinfo provides detailed information about the hardware. Install and run it

apt-get install hwinfo

Enable IPv6

modprobe ipv6
echo ipv6 | tee -a /etc/modules

Bluetooth (BlueDevil)

Further information: BlueDevil

atp-get install bluedevil
atp-get update
atp-get install bluedevil --fix-missing


Read pin

Further information: Reading and writing from GPIO ports from Python


Install Python development developer package and Pip

apt-get install python-dev python-pip
pip install --upgrade distribute

Install IPython and upgrade the GPIO library

pip install ipython
pip install --upgrade RPi.GPIO
Read pins

Configure GPIO pin 4 as inputs

import RPi.GPIO as GPIO
GPIO.setup(4, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

Finally read GPIO pin 4

print GPIO.input(4)

Radio station (FM transmitter)

Download and install Pi-FM-RDS

git clone https://github.com/ChristopheJacquet/PiFmRds.git
cd PiFmRds/src
make clean

In den src folder run the program with the provided audio file

sudo ./pi_fm_rds -audio sound.wav

This creates a FM transmission on 107.9 MHz. The signal is emitted on GPIO 4. Connect a cable as antenna to this pin to receive a better signal.

Spotify Connect

Further information: Github - Raspotify

  • Connect the PI to the WIFI
  • On the Pi run
curl -sL https://dtcooper.github.io/raspotify/install.sh | sh
  • Select on a phone or computer (in the same WIFI network) the device raspotify.

Problems and errors

Cannot change resolution

In the boot/config.txt file uncomment the line disable_overscan=1.

See also

External links