Raspberry Pi Tutorial
Raspberry Pi Tutorial
SPRING, 2017
I N S T R U C T O R : D R . J I M M A RT I N
Wifi can be setup using either the command line or the graphical interface. Instructions on setting up wifi
are available in detail in this document : https://learn.adafruit.com/downloads/pdf/adafruits-raspberry-
pi-lesson-3-network-setup.pdf
Getting started with IDLE on RPi
Raspbian comes preloaded with Python, the official programming language of the Raspberry Pi
and IDLE 3 which is a Python Integrated Development Environment.
IDLE3 can be loaded up by double-clicking the icon on your LXDE desktop.
Click File > New Window, which will then bring up a new blank window which you can type in.
Type in your code and save.
Click Run > Run Module or press F5 to run your code.
Enable SSH on your RPi
If you want to access the command line (not the full desktop environment) of your RPi from
another computer, you can use ssh
SSH can be enabled using raspi-config.
Enter sudo raspi-config in the terminal, navigate to ssh, hit Enter, and select Enable
or disable ssh server
For access to the full desktop environment via remote control, you can use VNC. It transmits the
keyboard and mouse events from the controller, and receives updates to the screen over the
network from the remote host.
Instructions to enable VNC are here : https://www.raspberrypi.org/documentation/remote-
access/vnc/README.md
SSH into Rpi using Windows
Download PuTTY (available as putty.exe)
When you run it, you will see a configuration screen like this ->
Type the RPis IP address into the Host name field and Open.
(Find the IP address using hostname I )
When the connection starts, you will see a security warning
about the servers host key not cached in the registry. This can be safely
ignored. Click Yes.
You will now get the usual RPi login prompt. Log in with pi as
username and the password you set earlier.
Type exit to close the putty window.
You can use Saved sessions on the configuration screen to
connect the second time. You can change the Seconds between
keepalives value in the left hand pane to 30 to allow PuTTY to
leave the remote connection open for long periods without any
activity on your RPi.
SSH into RPi using Linux/ Mac OS
SSH from Linux or Mac OS doesnt require any software installations.
Get your devices IP address from the terminal using hostname I
Type the command ssh pi@<IP> where <IP> is the IP address of the RPi into the terminal window of the
Linux or Mac OS devices. If your RPi user name is not pi, replace pi in the command with your user name.
If you receive a connection timed out, check if you have the RPis correct IP address.
When you get a security authenticity warning, type yes.
You will now be prompted for the password for the pi (username: pi; password: as in the setup).
X-Forwarding can also be set up from Linux or Mac OS by using the Y flag as ssh -Y pi@<IP>
With X-forwarding, When you type in commands such as idle3 & you can now open up graphical windows
such as Python Editor IDLE remotely.
R-Pi Temperature/Humidity Sensing
Optional project : Setup an FTP server on
RPi
Install the vsftpd package sudo apt-get install vsftpd
By default vsftpd is configured for anonymous access with read-only permissions. It needs to be changed so that it requires you
to authenticate with a local user.
Open the configuration file sudo nano /etc/vsftpd.conf
Change or uncomment the following values
anonymous_enable=NO
local_enable=YES
write_enable=YES
Local_umask=022
chroot_local_user=YES
user_sub_token=$USER
local_root=/home/$USER/ftp
Restart the vsftpd service
Create a couple folders in your local users home folder. The ftp folder will be the root when you connect.
Vsftpd doesnt allow root to have write permissions so you need to reate a sub-folder inside the root called files which our local
user will be allowed to write to. This is where youd upload/download files from with an FTP client.
You can now connect to your RPi from any FTP client and start uploading/downloading files.
Resources for learning about RPi
Learning resources : https://www.raspberrypi.org/resources/learn/
Raspberry Pi projects : http://elinux.org/RPi_Projects
Raspberry Pi learning community https://www.element14.com/community/welcome
A project aiming at creating an enhanced router using Raspberry Pi https://ronnyvdbr.github.io/