Skip to content

Instantly share code, notes, and snippets.

@caseyanderson
Last active September 5, 2018 00:30
Show Gist options
  • Save caseyanderson/7871deb02ca6dd418844db04d3c146fc to your computer and use it in GitHub Desktop.
Save caseyanderson/7871deb02ca6dd418844db04d3c146fc to your computer and use it in GitHub Desktop.
Connectivity: Laptop to RPi

Connectivity: Laptop to RPi

Materials

Without WIFI Access

FTDI Breakout

Note: if you are on macOS 10.13 (High Sierra) the following procedure should work out of the box. Previous macOS versions required the installation of an additional driver.

  1. With with your RPi off, connect the PiWedge to the RPi and then the FTDI Basic Breakout to its spot on the wedge (with the microchip facing up, plug the breakout in to the male header pins on the corner of the PiWedge): PHOTO HERE
  2. Plug the RPi power adapter into its port and connect the other end to an outlet

Connecting via screen

  1. On your laptop, open a new terminal window and type the following command: screen /dev/tty.usbserial and then press the key. You should see the terminal autocomplete with a string of letters and numbers identifying the FTDI Device. For example, the command should look something like this (at this point): screen /dev/tty.usbserial-AH02LSSH
  2. Add the BAUD rate (115200) to the command above (the command should now look something like this: screen /dev/tty.usbserial-AH02LSSH 115200). Press to issue the command
  3. Once a connection is made the terminal label will update to screen. Press enter to bring up the login screen (sometimes I have to power cycle the RPi to get the login stuff to show up)
  4. Enter login credentials

Disconnecting via screen

  1. Type exit and then hit enter to return to the login prompt
  2. Open a new terminal tab
  3. We need to get the number of the screen session so we can quit it. Enter screen -ls in the terminal and copy the number before .tty001 for use in the next step
  4. Issue the following command in the terminal (replace with the number form the previous step): screen -X -S <SESSION NUMBER> quit

Setup Wifi Access

There is one file that needs to be configured to setup WiFI on the Raspberry Pi: /etc/wpa_supplicant/wpa_supplicant.conf.

  1. Connect to the RPi via screen
  2. Navigate to /etc/wpa_supplicant/wpa_supplicant.conf: cd /etc/wpa_supplicant/
  3. Open wpa_supplicant.conf with nano: sudo nano wpa_supplicant.conf and move on to the next sequence (Configuring wpa_supplicant)

Configuring wpa_supplicant

Here is what wpa_supplicant should look like with only one network (with nonsense credentials):

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
   ssid="WIFINETWORKNAME"
   psk="WIFINETWORKPASSWORD"
}

To configure for your WIFI network insert the network name in ssid and the password in psk. Note that you have to use quotes for both of these fields. Save changes, exit, and reboot to confirm that you can connect to the network after logging back in. You should see the IP Address show up before the login prompt if all was successful. Write it down and move on to the next section.

With WIFI Access

Connect over WIFI via IP Address

  1. Use ssh (Secure Shell) to connect to your RPi via Wifi: ssh pi@IP_address
  2. Enter login credentials

Note that this method requires us to already know what the IP Address for the RPi is

Change Hostname

  1. While connected to your RPi, run sudo raspi-config
  2. Select Network Options, hit
  3. Select Hostname, hit
  4. The next screen describes what is legal in Hostnames (no symbols!), hit
  5. Type a new Hostname. It needs to be easy to remember and unique, hit
  6. Hit the right arrow key twice to select Finish, then hit

Connect over WIFI via Hostname

  1. ssh pi@<HOSTNAME>.local, for example: ssh pi@deploy.local
  2. Enter login credentials
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment