Exploring The Raspberry Pi (USIU)

From Raspberry Pi Min-Grant project
Revision as of 20:45, 28 July 2015 by Snamuye (talk | contribs)
Jump to: navigation, search
Pre-Lab Exercise 1:  Installing OS on Raspberry PI

The RPI will not boot up without an SD Card that is properly formatted to contain a suitable boot loader and operating system.

The distribution we have chosen to run in this lab and subsequent labs is called Raspbian.

We will use NOOBS operating system installer to install Raspbian

  1. Using a computer with an SD card reader, visit the raspberry pi official downloads page.
    RTENOTITLE

http://raspberry.kenet.or.ke/images/5/59/Noobs1.png

https://www.raspberrypi.org/downloads/

  1. Click on the download ZIP button under ‘NOOBS (offline and network install)’, and select a folder to save it to.
  2. Extract the files from the zip.
  3. Click on the download ZIP button under ‘NOOBS (offline and network install)’, and select a folder to save it to.
  4. Extract the files from the zip.
Preparing SD card on Linux/Windows Platforms
  1. Preparing SD card on Linux/Windows Platforms

On windows format your SD card before copying the NOOBS files onto it.

  1. You will need a 4GB or larger card. You will need a 4GB or larger card. NOOBS holds the various distros and support files for the “recovery” process. Basically, the installer lives on the card
  2. Go to the SD Association’s website and download SD Formatter 4.0 for Windows
    (https://www.sdcard.org/downloads/formatter_4/)
  3. Follow the instructions to install the software.
  4. Insert your SD card into the computer or SD card reader and make a note of the drive letter allocated to it.
  5. In SD Formatter software, select the drive letter for your SD card and format it.

Copy and Paste the NOOBS files

  1. Once your SD card has been formatted, copy all the files in the extracted NOOBS folder and paste them onto the SD card drive.
  2. When this process has finished, safely remove the SD card and insert it into your Raspberry Pi.

 

  1.  Format the SD card on the Linux Platform

On linux the following assumes you have root/administrator privileges

  1. First we need to download the ISO from the downloads page
    (https://www.raspberrypi.org/downloads/)
    Select an OS either Raspbian, UBUNTU mate or Snappy UBUNTU core
  2. Find the device, assuming your system is different to mine. The easiest way is to run the following:

#fdisk -l

(This command lists all the mounted and unmounted devices on your computer.)

  1. Once you have identified your device and the partition enter the following command that will format the SDcard

#dd if=/downloads/raspbian.img of/=sdb bs=512 conv=noerror,sync

  1. When this process has finished, safely remove the SD card and insert it into your Raspberry Pi and boot it.
Installing OS

Noobs installer First boot

  1. Plug in your keyboard, mouse and monitor cables.
  2. Now plug in the USB power cable to your Pi.
  3. Your Raspberry Pi will boot, and a window will appear with a list of different operating systems that you can install. We recommend that you use Raspbian – tick the box next to Raspbian and click on Install.
    RTENOTITLE

http://raspberry.kenet.or.ke/images/0/05/Noobsinstall2.png

  1. Raspbian will then run through its installation process. Note this can take a while.
  2. When the install process has completed, the Raspberry Pi configuration menu (raspi-config) will load. Here you are able to set the time and date for your region and enable a Raspberry Pi camera board, or even create users. You can exit this menu by using Tab on your keyboard to move to Finish.

Logging in with Default username and password

The OS will boot to command line where you will need to enter the default username and password

  • The default login for Raspbian OS
    Username: pi with the
    Password: raspberry

Loading the graphical user interface

To load the graphical user interface type
#startx

Pre-Lab Exercise 2:Connecting Pi to the Internet
  1. WiFi Configuration
  • After loading the graphical user interface
  • Select the start menu then select preferences then select WiFi configuration
    RTENOTITLE

Step 1. Selecting the WiFi configurator
RTENOTITLE

Step 2.Selecting the network

Click on the Scan button and a second window will open. Find your Wireless access point in the list and double click on it. This will open another window.

RTENOTITLE

Step 3.Joining the network

Double-click on the SSID of the access point to connect to, and then type in access password (if required)

RTENOTITLE


Using the command line

  • Step 1 Getting WiFi network details
  1. check the label on your wifi card using the command

#iwconfig

  1. To scan for WiFi networks, use the command

#sudo iwlist wlan0 scan

  • This will list all available WiFi networks

 

  • Step 2 Adding the network details to the Raspberry Pi

Open the wpa-supplicant configuration file in nano text editor, use the following command

#sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

  1. Go to the bottom of the file and add the following:

network={

    ssid="The_ESSID "

    psk="Your_wifi_password"

}

In the case of the example network, we would enter:

network={

    ssid="CEH"

    psk="testingPassword"

}

Now save the file by pressing ctrl+x then y, then finally press enter.

At this point, wpa-supplicant will normally notice a change has occurred within a few seconds, and it will try and connect to the network. If it does not, either manually restart the interface with the commands

#sudo ifdown wlan0
#sudo ifup wlan0,

 or reboot your Raspberry Pi with
#sudo reboot.

  1. verify if it has successfully connected using  the command
    #ifconfig wlan0
  2. (If not, check your password and ESSID are correct. )

LAN Configuration

  • DHCP Configuration

The Raspbian network configuration file is located at /etc/network/interfaces.

Step 1 Open the network configuration file with the following command
#sudo nano /etc/network/interfaces

A default configuration looks like the following, where DHCP is used for wired Ethernet.

RTENOTITLE

  • Static configuration
    RTENOTITLE

Step 2 restart the network services to activate the change without reboot

#sudo service networking restart

Step 3 check whether an IP address is set or not, type the ifconfig command.

#ifconfig

Pre-Lab Exercise 3:  Setting up SSH (Secure Shell) to remote into the PI.
  • Step 1 Enter the raspberry config by entering the following command

        # sudo raspi-config

  • Step 2 then navigate toadvance options, then ssh, hit Enter and select Enable or disable ssh server.
    check the status of your interface use
      #ifconfig -a

  • Step 3 ssh into pi from another machine using the command
        #ssh pi@’ip-address’
Pre-Lab Exercise 4:  Installing Applications on PI
  1. – Updating System
    1. Installing the Python Package Manager(PIP)
    2. Installing GPIO Library
  2. In-Lab Exercises
    1. In-Lab Exercise 1: Realizing a AND gate
      1. Wire up the circuit
      2.   Edit the Program
    2. In-Lab Exercise 2: Realizing a OR gate
    3. In-Lab Exercise 3: Realizing a NOT gate