ECE-370: Robot Design

From Lofaro Lab Wiki
Revision as of 23:09, 27 January 2019 by Dlofaro (Talk | contribs)

Jump to: navigation, search

[Install Raspbian]

Install Raspbian

Prerequisite

  • 1x Raspberry Pi Zero W
  • 1x MicroCenter brand 32gb Series 10 micro SD card (or larder if using another brand)

Install OS

You need to install Raspbian-Full 2018-11-13 version (see link below):

Once the image is downloaded follow the directions below to install the base image:

Setup Wifi

This section describes how to setup the wifi on your raspberry pi zero w without the need for a keyboard or monitor attached to the device.

  1. Download the wpa_supplican.conf example file here
  2. Rename wpa_supplicant.conf.example to wpa_supplicant.conf
  3. Setup your wifi name and password (note: you will be using "eduroam")
    1. Change your GMU password, this will ensure it will not expire during the course of the class
    2. Modify "identity" to match your GMU email address
    3. Modify "password" to match your GMU email password
  4. Insert the SD card into your computer
  5. Go to the SD card drive named "boot"
  6. Place the wpa_supplicant.conf created above inside of "boot". This will automatically copy wpa_supplicant.conf to its required place (i.e. /etc/wpa_supplicant/)

Setup Hostname

First you have to mount the 2nd partition (type ext4) on your system

  • Linux: native support
  • Windows: use Ext2Fsd
  • Mac: use the trial of Paragon

Now you have to edit two files within the above mounted files system:

  1. Edit /etc/hostname - Replace "raspberrypi" with the desired name (no spaces) of your computer, please make it unique)
  2. Edit /etc/hosts - Replace "raspberrypi" with the same hostname as listed above

Enable SSH

In the root of the "boot" partition make an empty file named "ssh" (please note there is NOT file extension. To do this, within a terminal/console change directories to the "boot" partition. Then write the following in the terminal/console (depending on your OS.

  • Linux: $ touch ssh
  • Mac: $ touch ssh
  • Windows: $ type NUL > ssh

This puts an empty files named "ssh" in the boot folder which tells the system to enable ssh on boot.

Boot the PI and connect via SSH

This part will tell you how to boot the pi and ssh to it. Please make sure your computer is connected to "eduroam"

  1. Insert the micro SD card into the raspberry pi
  2. plug the raspberry pi into a USB port (USB 3.0 or a charger is preferable)
  3. Wait about 5 minutes (first boot up only). This is because the image is resizing its self to fit the SD card.
  4. Check to see if your device is connected - this is done by pining the device within a terminal: $ ping <your host name from above>.eduroam.gmu.edu Note: if you get a non-zero time response then it is connected.
  5. Open your ssh client (Mac/Linux use terminal, for Windows use PuTTY) and connect to the PI with the following info:
    • Host: <your host name from above>.eduroam.gmu.edu>
    • User: pi
    • Password: raspberry
  6. Accept the "ECDSA key fingerprint" if asked
  7. Once logged in change your password via:
    • $ passwd

You raspberry pi zero w is now set up and you can connect to it via the "eduroam" network.

Update to the latest libraries

Run the following to ensure you are running the latest libraries for the distribution

 $ sudo apt-get update
 $ sudo apt-get upgrade

This may take a while, do NOT disconnect for the network or unplug the raspberry pi. Once done reboot the pi.

 $ sudo reboot

Adding a "home" network to your wifi

You may want to connect to your pi while you are on your home network, in this case you need to add a second network (with less priority) to you wpa_supplicant.conf. To do this edit yoru wpa_supplicant.conf located in /etc/wpa_supplicant/wpa_supplicant.conf. Add another "network" to the bottom of the page with a priory having a greater number than the "eduroam" network. The example below has a priority of 10. This will let the system connect to eduroam first and if not available then the home network.

 network={
     ssid="your network SSID"
     psk="your network password"
     id_str="home"
     priority=10
 }

Other items to install

  • VIM
 $ sudo apt-get install vim
  • Screen
 $ sudo apt-get install screen
  • GIT
 $ sudo apt-get install git