This quick-start guide will get you ready to connect and run all sorts of Adafruit projects on your Raspberry Pi computer
You will need:
First we need to perform the basic set up the Raspberry Pi. These are the first steps:
- download the latest Raspbian desktop operating system
- burn the OS to an SD card
- enable SSH
- add WiFi settings and credentials
For details on doing these things, follow the first four pages of this guide to get your Pi setup with Raspbian Lite (for 'headless' or remote operation) or NooBs (for graphical / desktop use), WiFi, and ssh enabled.
Once the SD card is prepared, come back here so we can continue.
Safely eject the SD card from your main computer. Then, with the Pi unplugged from power, insert the SD card into the Pi's SD card slot.
Then, plug in the power to the Pi. You should see some LEDs light up.
From here forward, we'll be connecting to the Pi remotely from our main computer. Make sure your computer is on the same WiFi network as the Pi.
After a minute or two, you can try and ping the Pi to see if it has connected to your network. Open a terminal on your computer, such as Terminal.app on a mac (Windows users will require some additional setup. Read here), and type this and press return:
ping -c 3 raspberrypi.local
You should see an output similar to this:
[email protected] ~ % ping -c 3 raspberrypi.local PING raspberrypi.local (192.168.1.68): 56 data bytes 64 bytes from 192.168.1.68: icmp_seq=0 ttl=64 time=14.993 ms 64 bytes from 192.168.1.68: icmp_seq=1 ttl=64 time=20.565 ms 64 bytes from 192.168.1.68: icmp_seq=2 ttl=64 time=50.571 ms --- raspberrypi.local ping statistics --- 3 packets transmitted, 3 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 14.993/28.710/50.571/15.625 ms
je[email protected] ~ % ping -c 3 raspberrypi.local PING raspberrypi.local (192.168.1.68): 56 data bytes 64 bytes from 192.168.1.68: icmp_seq=0 ttl=64 time=14.993 ms 64 bytes from 192.168.1.68: icmp_seq=1 ttl=64 time=20.565 ms 64 bytes from 192.168.1.68: icmp_seq=2 ttl=64 time=50.571 ms --- raspberrypi.local ping statistics --- 3 packets transmitted, 3 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 14.993/28.710/50.571/15.625 ms
This tells us that the Pi is on the network, and has an address of 192.168.1.68.
We can now connect to it through the secure shell (SSH) so we can control it remotely.
Here's some great info on SSH from the Raspberry Pi Foundation.
Type the following in your terminal:
ssh [email protected] (or whatever address you saw returned earlier when you pinged it.)
You may see a message warning you that the authenticity of the host can't be established, Are you sure you want to continue connecting (yes/no)?
To this question you can reply by typing
yes and pressing return. This will add the Pi to your list of known hosts and should not pop up again with this question.
You will now see the password prompt for the Pi:
[email protected]'s password:
Go ahead and type in the default password, which is:
You will now be logged into the Pi over ssh! There will be a warning about changing your password from the default and instructions on how to do so. Do it now! Type
passwd, hit return and follow the instructions to create a new, secure, non-default password!
You may end up with multiple Pi computers on your network, which can get confusing if they are all named raspberrypi. To rename this one for this project, type in
sudo raspi-config and press return.
Use the arrows and enter key on your keyboard to navigate. Pick 2 Network Options and press return on your keyboard.
Then, pick N1 Hostname.
Enter a new hostname -- I typed
Use the Tab key to get to the <Ok> button and press return.
Press tab twice to get to the <Finish> button and press return.
Now, we'll restart the Pi to make the changed host name show up on the network by typing
sudo reboot and pressing return.
Note, this will close the SSH session. After the Pi restarts, wait about a minute, and then reconnect over SSH. This time, you'll use the new name:
ssh [email protected]
Once logged into the Pi, we'll do some software updates to make sure we have the latest of everything.
sudo apt-get update
And then press return. This will run for a little bit as it reads the available package lists, and then finish, reporting that it is done.
You can now apply any of these changes by typing:
sudo apt-get upgrade
Y and press enter to continue.
Now that the Pi is updated and renamed on the network, we'll make sure we have Python 3 setup, as Python 2 is no longer used or supported.
pip3, is the software package installer we'll use. Let's upgrade it to the latest version with this command:
sudo pip3 install --upgrade setuptools
If above doesn't work try
sudo apt-get install python3-pip
Once that has finished you'll be returned to the prompt.
The default Python on your computer may not be Python 3. Python 2 is officially discontinued and all our libraries are Python 3 only.
We'll be using
pip3 in our commands, use those versions of Python and pip to make sure you're using 3 and not 2.
Blinka is the software that allows us to run CircuitPython and its libraries on Linux. You can read more about it here.
To install blinka, type:
sudo pip3 install adafruit-blinka
That's it! You can reboot again if you like.