Raspberry Pi in Headless Operation What is headless operation? The Raspberry Pi does not need to be connected to a keyboard, mouse, or monitor in order for you to run Python programs. It is possible to use ssh (Secure Shell) or VNC(Virtual Network Computing) to execute programs or preform remote administration. This presentation discusses the configuration of the Raspberry Pi for remote terminal access using ssh. Copyright (c) 2017 by Dr. E. Horvath
Change the default password on the Raspberry Pi You need to change your password for the pi account from the default password (raspberry) to a new password, otherwise unauthorized users can access your Raspberry Pi once you enable ssh. Menu -> Preferences -> Raspberry Pi Configuration Change Password Copyright (c) 2017 by Dr. E. Horvath
Enable ssh on the Raspberry Pi Menu -> Preferences -> Raspberry Pi Configuration Interfaces -> Enable SSH Reboot the Raspberry Pi Copyright (c) 2017 by Dr. E. Horvath
Determing the MAC Address Open the terminal and type the following: ifconfig You should see the configuration for wlan0. wlan0 Link encap:Ethernet HWaddr b8:27:eb:78:33:33 inet addr:192.168.10.150 Bcast:10.131.159.255 Mask:255.255.224.0 inet6 addr: fe80::ba27:ebff:fe67:f0eb/64 Write down the HWaddr, this is the hardware (MAC address) for your Raspberry Pi. b8:27:eb:78:33:33 is the address for the wireless NIC on this Raspberry Pi. Copyright (c) 2017 by Dr. E. Horvath
Configuring the IP Address Connect to your wireless access point. Click on the icon of two computers located in the upper right-hand corner of your computer monitor. You should also create a DHCP reservation on your wireless access point for your Raspberry Pi HWAddr (MAC address) so that you are always assigned the same IP address. You must review the documentation for your wireless access point to determine how you create a DHCP reservation. If your wireless access point does not have a web-based interface then note the IP address, which is discussed on the following slide. Copyright (c) 2017 by Dr. E. Horvath
Determing the IP Address Open the terminal and type the following: ifconfig You should see the configuration for wlan0. wlan0 Link encap:Ethernet HWaddr b8:27:eb:78:33:33 inet addr:192.168.10.150 Bcast:10.131.159.255 Mask:255.255.224.0 inet6 addr: fe80::ba27:ebff:fe67:f0eb/64 Write down the inet addr (IP address), this is the address assigned by DHCP to your Raspberry Pi. 192.168.10.150 is the address for the wireless NIC on this Raspberry Pi. Copyright (c) 2017 by Dr. E. Horvath
Specifying the default WiFi network Create a backup copy of the wpa_supplicant.conf file sudo cp /etc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf.backup Copyright (c) 2017 by Dr. E. Horvath
Specifying the default WiFi network Edit the /etc/wpa_supplicant/wpa_supplicant.conf file. sudo nano /etc/wpa_supplicant/wpa_supplicant.conf #Initial file ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="MYHOMENETWORK" key_mgmt=NONE } ssid="PAW" Copyright (c) 2017 by Dr. E. Horvath
Copyright (c) 2017 by Dr. E. Horvath Delete all of the networks except the one you with which you need to connect #Updated file ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="MYHOMENETWORK" key_mgmt=NONE } Copyright (c) 2017 by Dr. E. Horvath
Save the updated wpa_supplicant.conf file. Press Ctrl+O (This saves the file) Hit the Enter key (Accept the filename) Press Ctrl+X (This exits the nano editor) Copyright (c) 2017 by Dr. E. Horvath
Copyright (c) 2017 by Dr. E. Horvath Headless Operation Shutdown your Raspberry Pi. Disconnect your Raspberry Pi from the keyboard, mouse, and monitor. Plug in your Raspberry Pi to your Power Pack. SSH (Secure Shell to the Raspberry Pi) Connecting from Windows - Download and install Putty from http://www.putty.org/. Input your inet addr (IP address) to connect. Connecting from Linux - Go to the Terminal and type ssh pi@192.168.10.150. You would input your IP address. Copyright (c) 2017 by Dr. E. Horvath
Copyright (c) 2017 by Dr. E. Horvath Running python files python3 SenseHatOne.py You may need to navigate to the correct subdirectory. Use cd directoryname to change the current directory Copyright (c) 2017 by Dr. E. Horvath
Safely Shutdown the Raspberry Pi Go to the Terminal sudo shutdown -h now Copyright (c) 2017 by Dr. E. Horvath