- Use the internationalization options to set your locale (using the Space key, uncheck en_GB.UTF-8 UTF-8 first and then check en_US.UTF-8 UTF-8), timezone (choose US and then Central), keyboard layout (Generic 104-key PC and choose defaults) and Wi-fi country (US United States).
- Enable the Raspberry Pi camera board.
- Under Advanced Options:
- change the hostname/network name of your Pi. Please use your first inital + last name as the network name. For example John Smith would use set the network name to jsmith.
- Enable SSH.
- Enable SPI.
- Enable I2C.
- Enable Serial.
- I recommend you do not change the user password unless you are sure you are going to remember it.
$ sudo rebootat the command line (that appeared after entering "Finish") to reboot the operating system. Now browse through the recipes in Chapter 1 of the textbook.
1. You will edit the file with pathname /etc/wpa_supplicant/wpa_supplicant.conf using the nano editor. To open the file using nano, type:
$ sudo nano /etc/wpa_supplicant/wpa_supplicant.confYou will edit the file so it contains the following (use your campusconnect user ID and password where specified):
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdevNote that tabs are used in the lines below "network={" and above "}". When done, reboot your Pi by typing:
update_config=1
country=US
network={
ssid="depaulsecure"
proto=RSN
key_mgmt=WPA-EAP
pairwise=CCMP
auth_alg=OPEN
eap=PEAP
identity="your campusconnect user id"
password="your campusconnect password"
}
$ sudo rebootAfter rebooting, your Pi should be connected to the depaulsecure wifi network.
3. Now that you are connected to the Internet, you can update your OS. You will update the apt-get package manager using the following commands:
sudo apt-get update
sudo apt-get upgrade
This takes about 10 minutes or so.
1. First, at the command line prompt in LXTerminal, find your Pi's IP address using
hostname -Ior
ifconfig2. To connect to your Pi via SSH follow recipe 2.7. Windows user will need to install the Windows SSH client from http://www.cdm.depaul.edu/Current%20Students/Pages/Software.aspx; alternatively, you may choose Putty.
3. To connect to your Pi via VNC remote desktop, follow recipe 2.8 including the steps described in the discussion. I recommend you choose the same password for vncserver as for your pi (default: raspberry) and do not choose a view only password.
4. If you power up you Pi without a monitor/keayboard/mouse attached, you somehow need to learn the IP address assigned to it by depaulsecure. The following will set up your Pi so it emails you, to your gmail account email, the IP address every time it boots up. First you need to install additional sendmail utilities:
sudo apt-get install ssmtp
sudo apt-get install mailutils
Then open the configuration file /etc/ssmtp/ssmtp.conf using the nano editor:
sudo nano /etc/ssmtp/ssmtp.conf
and edit the file so that it contains
root=postmasterNOTE: You will need to modify the above so it has your Pi's hostname (which you have set up), your gmail address (get one if you do not already have one), and your gmail password. It is a good idea to create a new gmail account just for this class, by the way.
mailhub=smtp.gmail.com:587
hostname=yourPiHostname
FromLineOverride=YES
AuthUser=YouGmailUserName@gmail.com
AuthPass=YourGmailPassword
UseSTARTTLS=YES
All this enables you to send emails from your Pi. Try it:
echo "Body of email." | mail -s "Email subject" YourGmailUserName@gmail.comIn order for Gmail to be able to send the email, you will need to enable less secure Gmail sign in technology temporarily using
https://www.google.com/settings/security/lesssecureappsNow that you have sendmail set up, you need to write a script that emails you the IP address of your Pi when it boots up. Open file /etc/rc.local for editing:
sudo nano /etc/rc.localand comment out all the code; you do this by adding a # symbol at the beginning of every line that does not already start with the # symbol. Then add the following code at the end of the file (while making sure that you change the Gmail user name to yours)
_IP=$(hostname -I) || trueThis code will repeatedly query for the IP address until one is obtained or 10 failed queries were made.
COUNTER=0
while [ ! "$_IP" -a $COUNTER -lt 10 ]; do
sleep 10
COUNTER=`expr $COUNTER + 1`
_IP=$(hostname -I) || true
done
echo "" | mail -s "$_IP" YourGmailUserName@gmail.com
printf "My IP address is %s\n" "$_IP"
exit 0
5. Now reboot and verify that the ip address assigned to your pi by depaulsecure is emailed to your gmail account.
6. As mentioned above, you can set up your Pi to connect to your home network as well. To make it even easier to remotely login to your Pi on a local network such as a home network, you should do the following. In the command line shell, type the following to install the necessary system software that assigns the .local domain to your pi:
sudo apt-get install avahi-daemon
This step will make it possible to remotely access you pi using its network name (e.g., lperkovic.local) rather than a dynamically allocated IP address that may change every time you connect. More info at http://www.howtogeek.com/167190/how-and-why-to-assign-the-.local-domain-to-your-raspberry-pi/
For an introductory tutorial on the Linux operating system use http://www.ee.surrey.ac.uk/Teaching/Unix/index.html.
Tutorials 1-5 are relevant to this course and you should read
them.
We will use Python to program the Raspberry Pi. Python 2 and 3
are both already installed. To open a Python 3 IDLE session, click
on Menu, then Programming, and then just double click on the IDLE
3 icon. Depending on your level of experience with Python,
read carefully or browse through the recipes in Chapters 5, 6,
and 7.