Raspberry Pi

Downloads
RASPBIAN Debian Wheezy

http://www.raspberrypi.org/downloads/

Installation - Ubuntu 14.04 LTS
NOTE: The following is only applicable to the Raspberry Pi 2.


 * Download the Ubuntu image for Pi here
 * Extract the zip file

Used this as a guide.

Installation
https://www.youtube.com/watch?v=G2M1Ev_ShP0

Install an enhanced version of dd to show progress bars...

sudo aptitude install -y dcfldd

Insert the SD card, and check which disk Linux sees...

cat /proc/partitions

Extract the downloaded .zip file...

cd /path/to/download/ unzip 2014-06-20-wheezy-raspbian.zip

Now, as root user, run dcfldd instead of the normal dd...

sudo dcfldd bs=4M if=2014-06-20-wheezy-raspbian.img of=/dev/sdb

Customisation With Raspi-Config
Most settings and changes to the system can now be made easily with this new tool called raspi-config.

sudo raspi-config

http://www.raspberrypi.org/documentation/configuration/raspi-config.md

First Boot With Windows Generated SD-Card
The first screen on boot up gives you various options, one of which is to resize the OS to use all of the SD-Card. Do this, then set keyboard, locale etc continue through until you are at a point where you can reboot the system.

Command Line Aliases
Open a terminal and edit the .bashrc file:

Terminal:~$ nano ~/.bashrc

Edit or add the following lines:

nano alias egrep='egrep --color=auto' alias fgrep='fgrep --color=auto' alias get='get_iplayer/get_iplayer' alias grep='grep --color=auto' alias install='sudo apt-get install' alias l='ls -CF' alias la='ls -A' alias ll='ls -lah' alias ls='ls --color=auto' alias myip='curl ifconfig.me' alias ping='ping -c3 -n -i 0.2 -W1' alias pingg='ping www.google.co.uk' alias pingp='ping www.paully.co.uk' alias rav='rsync -a -v' alias remove='sudo apt-get autoremove' alias rm='rm -iv' alias search='sudo apt-cache search' alias update='sudo apt-get update' alias upgrade='sudo apt-get upgrade' alias uu='sudo apt-get update && sudo apt-get upgrade' alias uuf='sudo apt-get update && sudo apt-get dist-upgrade'

CTRL+O then CTRL+X to save and close the file.

Reload the file:

Linux Terminal:~$ source ~/.bashrc confirm the entries alias

Default Username & Password - Debian
Username: pi Password: raspberry

Default Username & Password - Ubuntu
Username: ubuntu Password: ubuntu

Default Username & Password - Other Distros
Other Distros

FAQ and other resources
http://www.raspbmc.com/wiki/user/frequently-asked-questions/

http://simonthepiman.com/beginners_guide_to_raspberry_pi_unix.php

http://www.raspberrypi-tutorials.co.uk/set-raspberry-pi-wireless-network/

MailX
This will install a very minimal (80Kb!) app for sending emails in conjunction with sSMTP, instead of the 8MB of 'mailutils' or 'mutt'.

sudo aptitude install bsd-mailx

You can then pipe a test message...

echo "message" |mail -s "test" you@email.com

SSH Server
Terminal:~$ sudo raspi-config

Navigate to:

Option 9 - Advanced Options | Option A4 - Enable/Disable remote command line access of your Pi using SSH

Thanks to RaspberyPi.org

Hardware Lister
Linux Terminal $: sudo apt-get install lshw

Hardware Lister | USB Connected Devices
Linux Terminal $: sudo apt-get install usbutils

Remote Desktop
Terminal > raspi-config > Advanced Options > VNC > Enable > Yes

Virtual Desktop
If your Raspberry Pi is headless (that is, not plugged into a monitor) or embedded in a robot, it’s unlikely to be running a graphical desktop.

VNC Server can run in Virtual Mode to create a resource-efficient virtual desktop on demand, giving you graphical remote access even when there is no actual desktop to remote. This virtual desktop exists only in your Raspberry Pi’s memory.

https://www.realvnc.com/en/connect/docs/raspberry-pi.html#raspberry-pi-virtual

Wake Up TV
https://raspberrypi.stackexchange.com/questions/7054/cec-wake-up-command

Kiosk Mode
pi@raspberrypi:~ $ nano .config/lxsession/LXDE-pi/autostart @lxpanel --profile LXDE-pi @pcmanfm --desktop --profile LXDE-pi @point-rpi @xset s off @xset -dpms @xset s noblank @/usr/bin/chromium-browser --noerrdialogs --kiosk www.google.co.uk

Thanks - https://www.danpurdy.co.uk/web-development/raspberry-pi-kiosk-screen-tutorial/

Close Chromium Browser When In Kiosk Mode
Keyboard

ALT+F4

Console

sudo pkill chromium-browser

Automatically Switch Between Browser Tabs Set Interval
sudo apt-get install xdotool unclutter

After the download is finished, open the autostart file (.config/lxsession/LXDE-pi/autostart) and add this line:

@lxterminal --command unclutter & watch -n10 "xdotool search --class --onlyvisible Chromium windowfocus && xdotool key ctrl+Tab F5"

This switches the tabs and refreshes the site every 60 seconds. Save the file and reboot. Now chromium should automatically switch tabs and refresh.

Thanks - https://www.danpurdy.co.uk/web-development/raspberry-pi-kiosk-screen-tutorial/

Autostart Apps On Login
pi@raspberrypi:~ $ nano .config/lxsession/LXDE-pi/autostart @lxpanel --profile LXDE-pi @pcmanfm --desktop --profile LXDE-pi @point-rpi @xset s off @xset -dpms @xset s noblank @/usr/bin/chromium-browser --noerrdialogs --kiosk www.google.co.uk

List of Chromium switches

Thanks - https://raspberrypi.stackexchange.com/questions/27572/how-to-auto-start-chromium-after-boot-on-the-raspberry-2-2015-01-31-debian-whee#27575

Looping Video Playlist With Omxplayer
omxplayer - http://elinux.org/Omxplayer

Python Script

The indentations below must be there, and yes that last line is indented twice (that's Python for you!).

You can change the extra output options for omxplayer to hdmi but this example is alsa (headphone jack)...

cd /home/pi nano omxloop.py

import sys import subprocess import os import glob path ='/home/pi/Videos/' while(1): for infile in glob.glob(os.path.join(path, '*.mp4')): a = subprocess.call( [ "omxplayer", "-o", "alsa", infile])
 * 1) !/usr/bin/python

chmod +x omxloop.py ./omxloop.py

Thanks - https://gist.github.com/simmogs/6668652

BASH Script

sudo nano ~/videoplayer.sh

setterm -cursor off VIDEOPATH="/mnt/storage/videos" SERVICE="omxplayer" while true; do       if ps ax | grep -v grep | grep $SERVICE > /dev/null then sleep 1; else for entry in $VIDEOPATH/* do               clear omxplayer --blank -o hdmi "$entry" > /dev/null done fi done
 * 1) !/bin/sh
 * 2) get rid of the cursor so we don't see it when videos are running
 * 1) set here the path to the directory containing your videos
 * 1) you can normally leave this alone
 * 1) now for our infinite loop!

chmod +x videoplayer.sh ./videoplayer.sh

Force HDMI Sound Output
sudo nano /boot/config.txt

Either add or uncomment the line hdmi_drive=2 then ctrl-o to write the changes and ctrl-x to exit the nano text editor.

Reboot and the HDMI sound will work.

Turn Off Screensaver Screen Blanking
OLD

sudo nano /etc/kbd/config BLANK_TIME=0 POWERDOWN_TIME=0

NEW

sudo nano /etc/xdg/lxsession/LXDE/autostart @xset s noblank @xset s off @xset -dpms

sudo reboot

Find Distribution Version
sudo apt-get install lsb-release

Usage:

lsb_release -a

Switching To Root
Linux Terminal %: sudo -i

Wireless Dongle
NEW

sudo wpa_passphrase "SSID" "Password" >> /etc/wpa_supplicant/wpa_supplicant.conf sudo reboot

OLD

Bus 001 Device 005: ID 148f:5370 Ralink Technology Corp. RT5370 Wireless Adaptor

sudo cp /etc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf.bak sudo nano /etc/wpa_supplicant/wpa_supplicant.conf network={ ssid="" psk="" } sudo wpa_action wlan0 stop sudo ifup wlan0 sudo wpa_cli status sudo ifconfig

https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md

https://www.modmypi.com/wireless-usb-1n-nano-adaptor-802.11N-wifi-dongle?filter_name=Wireless

https://www.modmypi.com/blog/how-to-set-up-the-ralink-rt5370-wifi-dongle-on-raspian

...

TP-Link TL-WN725N v.1 - Realtek 8188CUS chipset

SD Card Partition Size
http://elinux.org/RPi_Resize_Flash_Partitions

How To Find Out The Actual SD Card Size

dmesg |grep 'SD' cd /sys/class/mmc_host/mmc?/mmc?:* echo "man:$(cat manfid) oem:$(cat oemid) name:$(cat name) hwrev:$(cat hwrev) fwrev:$(cat fwrev)"

Thanks - http://elinux.org/RPi_SD_cards

Font Size In Terminal
sudo dpkg-reconfigure console-setup


 * Select text encoding | OK
 * Select "Guess optimal character set | OK
 * Select "Terminus" | OK
 * Select font size | OK

Missing Sound On HDMI
https://www.raspberrypi.org/documentation/configuration/audio-config.md

Check DOS VFAT Boot Partition
sudo aptitude install -y dosfstools sudo fsck.vfat -v -a -t -V -w /dev/mmcblk0p1 sudo reboot

Missing Characters On Either Side Of The Screen
Terminal:~$ sudo nano /boot/config.txt #disable_overscan=1 overscan_left=30 overscan_right=30

30 is an arbitrary figure, experiment for your own setup.

Hardware Addons
HiFiBerry.