Raspberry Pi B+ Setup & Configuration

Environment

Setup Platform:
Windows 8.1

Raspberry Pi:
Board:
Wireless Adapter: EdiMax 150Mbps Wireless 802.11b/g/n nano USB Adapter, Model EW-7811Un
Software:Raspbian OS

Caveats

Without a properly configured & booting sd-card, no video will be put out at all!

Install OS

First Boot & Initial Configuration

Wireless Network Configuration

1. First, let’s make sure your wireless hardware is correctly working
Perform a wireless survey via commandline:

iwlist wlan0 scan

If the can fails, try it a few more times.
In my experience, I’ve had to scan more than once to get a good survey.

2. Edit the interfaces config file

sudo vi /etc/networ/interfaces
#Change as follows:
allow-hotplug wlan0 #Applies to plug-n-play hardware such as USB, specify the interface name (e.g. wlan0)
iface wlan0 inet dhcp #Specify dhcp for the interface
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf #Applies to Wi-Fi Protected Access client wpa_supplicant/
pre-up wpa_supplicant -B w -D wext -i wlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf #Specify preflight command for wpa initialization
powt-down killall -q wpa_supplicant #Specify post command for wpa stop

Important: Notice the lack of a space after the -c switch in the wpa_supplicant command. That is purposeful!

3. Next, we are going to be using the wpa_passphrase command to generate the encrypted passphrase that will be used int the wpa_supplicant.conf file referenced in the interface config

#Call the wp_passphrase command with the Wireless SSID and the Password Phrase (passphrase)
#usage: wpa_passphrase <ssid> [passphrase]
#If passphrase is left out, it will be read from stdin
#Change directory to the relevant path
cd /etc/wpa_supplicant 
#issue the wpa_passphrase command to generate the encrypted psk passphrase
wpa_passphrase {ESSID} {pass}
#where {ESSID} and {pass} are your Wireless SSID and Passwrd, respectively

4. Copy the encrypted key. You’ll need this for the next step

5. Modify the wpa supplicant configuration file according to your wireless network configuration
Here is my file:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
    ssid="MyNetworkName"
    proto=RSN
    key_mgmt=WPA-PSK
    pairwise=CCMP TKIP
    group=CCMP TKIP
    psk=134b516a855384ea15429da72033ec2725934ed3ff5e3bc2fff64b8ad78c2dfc
}

Important: The above psk passphrase was randomnly generated! You must change it to match your settings. Also, do not enclose the value in double quotes.

6. Restart your wireless network client

sudo wpa_action wlan0 stop
sudo ifup wlan0
#--or--#
sudo wpa_action wlan0 stop && sudo ifup wlan0

7. Verify your wireless connectivity

iwconfig
#-- or --#
sudo wpa_cli status
#-- or --#
ifconfig
#Optionally, you can query your dhcp lease records file
sudo cat /var/lib/dhcp/dhclient.leases

If problems, see the Troubleshooting section

[divider]

Appendix

[divider]

Command Cheatsheet

Handy Commands
Command Description iwconfig wlan0 essid NETWORK_ID key WIRELESS_KEY Call the iwconfig command to generate the wireless configuration sudo wpa_action wlan0 stop Stop the wireless network interface sudo ifup wlan0 Start the wireless network interface sudo wpa_action wlan0 stop && sudo ifup wlan0 Previous two commands, second command runs if first is successful sudo find /somepath -type f -name '*' -executable Search for executables under the specified folder

Customizations

1. Enable filesystem check (fsck) after reboot
Because we’re working with flash media (SD Cards, etc), I wanted a way to force the Raspberry Pi to check its filesystem after every reboot.
The Raspbian OS will perform a filesystem check if a special file semaphore is present in the root (/) path

/forcefsck
You can run a one-time fsck on the system simply by creating this file with the touch command, as in:
sudo touch /forcefsck
To ensure this happens after every reboot, you can add this command sequence to the Raspbian OS system startup file: /etc/rc.local
sudo vi /etc/rc.local

Add the below line:

/usr/bin/touch /forcefsck

Soldering Inputs & Interfaces

The purpose of the P6 header is to enable a reset of the Raspberry Pi’s CPU. The reset switch can restart the system, but it does not provide the safe shutdown

Troubleshooting

wpid249-media_1410657586290.png

1. Search the system log for any errors

grep -i handshake /var/log/syslog | tail -20

2. Sep 14 00:13:32 raspberrypi wpa_supplicant[4303]: wlan0: WPA: 4-Way Handshake failed - pre-shared key may be incorrect
Sep 14 00:13:36 raspberrypi wpa_supplicant[4303]: wlan0: WPA: 4-Way Handshake failed - pre-shared key may be incorrect
Sep 14 00:13:40 raspberrypi wpa_supplicant[4303]: wlan0: WPA: 4-Way Handshake failed - pre-shared key may be incorrect
Sep 14 00:13:45 raspberrypi wpa_supplicant[4303]: wlan0: WPA: 4-Way Handshake failed - pre-shared key may be incorrect
Correct the passphrase
sudo rm -f /var/run/wpa_supplicant/wlan0
sudo rm -f /var/run/wpa_supplicant/wlan0
4. Try to manually run the connection command: 
 sudo /sbin/wpa_supplicant -P /var/run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -c/etc/wpa_supplicant/wpa_supplicant.conf

Important Logs:

/var/log/syslog

Multimeter

wpid250-media_1411009676659.png

Sources

Description URL Notes Making a Reset Switch for your Rev 2 Raspberry Pi http://raspi.tv/2012/making-a-reset-switch-for-your-rev-2-raspberry-pi Google Search:
"raspberry pi" "reset switch" "Volume was not properly unmounted" wpa_supplicant(8) – Linux man page
http://linux.die.net/man/8/wpa_supplicant Howto Set Up Multiple Network Schemes on a Linux Laptop http://www.shallowsky.com/linux/networkSchemes.html Google Searches:
"raspberry pi" "Association request to the driver failed"
wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant.conf"
kwd:{"Side note wpa_cli is odd the flags are not followed by a space. for example you want to do Raspberry Pi GPIO Documentation and Tutorials
http://raspi.tv/rpi-gpio RPi.GPIO update and detecting BOTH rising and falling edges http://raspi.tv/2014/rpi-gpio-update-and-detecting-both-rising-and-falling-edges Raspberry Pi – Install a Momentary Reset Button http://www.savagehomeautomation.com/projects/raspberry-pi-install-a-momentary-reset-button.html Google Search:
raspberry pi momentary switch Triple function button to reboot/halt/reset/restart Pi
http://www.raspberrypi.org/forums/viewtopic.php?t=48455&p=379280 Google Searches:
"p6" "sudo reboot" Soldering Is Easy
http://mightyohm.com/files/soldercomic/FullSolderComic_EN.pdf Adding a (Safe) On/Off switch to your Raspberry Pi http://www.raspberry-pi-geek.com/Archive/2013/01/Adding-an-On-Off-switch-to-your-Raspberry-Pi Google Search:
"raspberry" "sudo reboot" "via gpio" Downloads: Raspberry Pi Scripts & Resources
ftp://ftp.linux-magazin.de/pub/listings/rasp-pi-geek.com/01 Get started with Raspberry Pi http://www.siongboon.com/projects/2013-07-08_raspberry_pi/index.html

Terminology

Term Notes dupont wires http://lmgtfy.com/?q=dupon
wires