Raspberry Pi

From Indie IT Wiki
Jump to: navigation, search

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.

HOWTO: MODIFY:

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

INFO

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/

HOWTO: INSTALL

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

HOWTO: INFO

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
#!/usr/bin/python
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])
chmod +x omxloop.py
./omxloop.py

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

BASH Script

sudo nano ~/videoplayer.sh
#!/bin/sh
# get rid of the cursor so we don't see it when videos are running
setterm -cursor off
# set here the path to the directory containing your videos
VIDEOPATH="/mnt/storage/videos" 
# you can normally leave this alone
SERVICE="omxplayer"
# now for our infinite loop!
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
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

sudo nano /etc/kbd/config
BLANK_TIME=0
POWERDOWN_TIME=0
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

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="<SSID of your wifi network>"
       psk="<the password for this network>"
}
sudo wpa_action wlan0 stop
sudo ifup wlan0
sudo wpa_cli status
sudo ifconfig 

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

HOWTO: ALTER:

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

HOWTO: FIX:

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.