Raspberry Pi Cheat sheet

Some rough notes while I'm playing around with a RaspberryPi.

BURN A NEW SD CARD:
Find the SD card: $ df -h
Save the name (remove the trailing number) and burn the image:
$ sudo dd bs=4M if=2012-09-18-wheezy-raspbian.img of=/dev/sdb;sudo sync

BASIC:
Start desktop: startx
Shutdown: sudo shutdown now

NETWORK
Find all raspberry pi's on a network:
sudo nmap -sP 192.168.1.0/24 | awk '/^Nmap/ { printf $5" " } /MAC/ { print }' - | grep Raspberry
sudo nmap -sP 192.168.1.0/24 | grep aspberry
Current MAC address: ip link show eth0 | grep link | awk -F' ' '{ print $2 }'

Setup wifi: sudo vim /etc/network/interfaces
auto lo
iface lo inet loopback
iface eth0 inet dhcp
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa.conf

Setup hotspot: sudo vim /etc/wpa.conf
network={
ssid="wifiHotspot"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="password"
}

The restart: sudo reboot

AUDIO:
Test audio output through #n channels: speaker-test -c 2
You can force the Pi to use a specific audio interface using :
Auto: amixer cset numid=3 0
Analog: amixer cset numid=3 1
HDMI: amixer cset numid=3 3
Nice info here:
http://www.raspberrypi-spy.co.uk/2013/06/raspberry-pi-command-line-audio...

SETUP VNC SO YOU DONT NEED A MONITOR:
Install tight VNC: “sudo apt-get install tightvncserver”
Run the program: “tightvncserver”
Start a VNC session: “vncserver :0 -geometry 1024x728 -depth 24”

CONNECT TO WIFI USING THE GUI
1. Log into the desktop environment: $ starts
2. Click the "WiFi Config" Application icon.
3. Click 'scan', then when the window appear click 'scan' again.
4. Select the WiFi network you wish to connect to.
5. Then use the following settings in the configuration window:
Authentification: Static WEP (no authentification)
WEP Keys (0): TYPE THE PASSWORD
6. Click 'save' and close the scan window.
7. Now reboot the raspberry pi.
8. Once you are logged in try: $ ping google.com
And you should receive an output like this:
PING google.com (173.194.34.135) 56(84) bytes of data.
64 bytes from lhr14s21-in-f7.1e100.net (173.194.34.135): icmp_req=1 ttl=58 time=20.4 ms

FOR ARCH LINUX ON THE PI
In stall these after a new install:
$ pacman -Syy
$ pacman -S sudo
$ pacman -S wireless_tools
$ pacman -S netcfg
$ pacman -S jack
$ pacman -S alsa-utils
$ modprobe snd_bcm2835
$ pacman -S alsa-plugins
$ sudo pacman -S pulseaudio
$ pacman -S libffado
$ EDITOR=vim visudo
Find "## User privilege specification"
And uncomment "%wheel ALL=(ALL) ALL"
$ vim /etc/pulse/client.conf
autospawn = no
daemon-binary = /bin/true
Then:
pulseaudio --start
pulseaudio --kill

SEE IF SOUND CRAD IS AVAILABLE
aplay -l

ADD TO: /etc/asound.conf
# convert alsa API over jack API
# use it with
# % aplay foo.wav

# use this as default
pcm.!default {
type plug
slave { pcm "jack" }
}

ctl.mixer0 {
type hw
card 1
}

# pcm type jack
pcm.jack {
type jack
playback_ports {
0 system:playback_1
1 system:playback_2
}
capture_ports {
0 system:capture_1
1 system:capture_2
}
}

Comments

Post new comment

  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <h3> <h2> <h4> <img> <div> <table> <tr> <td> <pre>
  • Lines and paragraphs break automatically.
  • Insert image: [img:node_id align=(left|right) size=(|fullLA|fullPreview|fullSQ|halfLA|halfPO|halfSQ|thirdSQ) action=(popup|link|frame) url=url style="margin:10px;" title=text description=text]

More information about formatting options

 
info@theanthillsocial.co.uk XHTML 1.0 Strict CSS2 WAI