Raspberry Pi 2 Starter Kit Hookup Guide
This Tutorial is Retired!
This tutorial covers concepts or technologies that are no longer current. It's still here for you to read and enjoy, but may not be as useful as our newest tutorials.
View the updated tutorial: Raspberry Pi 3 Starter Kit Hookup Guide
Introduction
There's a lot of Raspberry Pi information going around lately. Whether it's Pi A, A+, B, B+, or Pi 2 B, any forum will have thousands of people giving all the answers possible to a problem. Though most methods work for any version, it can be tough to decide which information to choose. This is a reference of what is known to work for the Pi 2 and specifically, the Raspberry Pi 2 Starter Kit bundle.
Covered in This Tutorial
- Kit Assembly
- What to expect on the first boot
- Methods of working with the pi
- Configuring the Pi
- Resources for working with the GPIO
- Troubleshooting
- Serial
- Monitor
- Starting with a blank microSD card
- Performing a full system upgrade
Materials Required
There are a few methods to getting the RPi 2 running. You can operate the pi from its own peripherals, or you can use another computer with a serial link. Once any link is established, you can connect it to any network with DHCP hosting and use Telnet/SSH to operate the Pi.
Using the Pi 2 as a desktop:
- Pi 2 Starter kit -or- Pi 2 Accessory Kit and your own Pi
- USB Mouse
- USB Keyboard
- HDMI monitor/TV/adapted VGA
Configuring through the serial port / using Telnet/SSH:
- Pi 2 Starter kit -or- Pi 2 Accessory Kit and your own Pi
- 2nd computer with available USB port
- Terminal software such as HyperTerm or Tera Term
You'll also need an internet connection to get resources! This link can be wired or wifi and must be available for the Pi.
Suggested Reading and Viewing
- Serial Terminal Basics
- Raspberry gPIo -- Also linked-in later
- Pi Wedge Hookup Guide
- Getting Started With The Raspberry Pi -- video series
Assembly
The Pi is pretty straight-forward and easy to put together, but, in the event that something doesn't look right, this section will give you an idea of what it is supposed to look like.
Snap the pi into the base of the 'tin', snap on the top part
Fit the Pi into the base of the tin
Make sure the Pi is fully seated. Check that the PCB is evenly recessed about the perimeter.
Click the two halves together<//center>
Add the SD card
Installing an SD card -- make sure the "cliky pen" action of the card is in the depressed position prior to adding power
The microSD card should be flush with the side of the case when inserted properly.
Connect the ribbon cable to the Pi -- notice that the pin 1 marking is very subtle. Orient the red stripe on the cable towards the SD card. Alternately, pin 1 can be identified by finding the missing/beveled corner of the header's silkscreen, on the pi.
The pin 1 location and silkscreen is the same between the Pi B+ ad Pi B. This image shows a partially inserted ribbon cable without the case in the way.
*The ribbon cable is orinted with the red "pin 1" marking towards the SD card slot *
Attach the ribbon cable to the wedge. Pin 1 is towards the FTDI adapter
Socket the end of the ribbon cable into the Wedge. It is keyed, but each end of the cable is different. Make sure the ribbon extends away from the breadboard connection.
Socket the wedge into your breadboard
Wedge inserted in breadboard.
Attach the FTDI connector matching "GRN" to "GRN" between the boards
The FTDI serial adapter is connected matching GRN and BLK connections
Add the Edimax WiFi dongle, any USB
Inserting the Edimax wireless dongle. In this picture, the Edimax is fully seated.
Attach desired consumer computer equipment
The fully assembled kit. Additional to the kit, user supplied monitor, mouse, and keyboard are shown. This Pi is now a desktop computer.
First Boot
Before you apply power for the first time, run through this pre-flight checklist.
- Is the micro SDcard installed and depressed?
- If using a monitor (stand-alone PC usage),
- Is the HDMI attached and the monitor powered on?
- Are the mouse and keyboard plugged in?
- Are the mouse and keyboard standard USB, not wireless?
- If using serial
- Is the wedge and ribbon cable connected and secure?
- Is the FTDI "BLK to BLK" and "GRN to GRN"?
- Is the FTDI connected to your computer with a USB cable?
- Is your terminal software configured to 115200 baud?
- Lastly, is the whole setup secure on your desk and not liable to jump onto the floor at the first touch?
Ok, you're ready to apply the power to the Pi.
What to expect on first boot with a monitor
First you should see a color chart that indicates the Pi has power and is doing something, but doesn't have software loaded yet. Next, the Pi "Hold shift to enter setup" screen appears briefly. Holding shift lets you get in and do Noobs level maintenance which is not covered by this guide.
Next, linux starts booting and the log rolls down the screen. After it's gotten the system loaded, the raspi-config text window pops up and asks you questions. The card comes pre-expanded to fill the space so no actions need to be taken to get straight to a prompt, just select "Finish".
After that, you will be auto-logged in as user "pi", password "raspberry".
If the screen remained dark, check out the troubleshooting section of this hookup guide -- it shows a method of manually invoking the raspiConfig. With some monitors this can happen, but, usually after it's fixed, it's no problem until SDcards, power, or monitor changes.
What to expect on first boot with only serial
Without a monitor, the first boot should happen with a serial connection to monitor what is going on.
First boot instructions for serial:
- Open up a serial terminal and configure to 115200 buad.
- Send a few characters out the port and watch the FTDI. One of the LEDs should flash with each character.
- Plug in the micro usb power to the Pi.
Now, the boot log should start scrolling as the system boots.
This time, no raspi-config tool pops up, and you are not auto-logged in. Log in with "pi" and "raspberry" to get to a prompt.
Methods of Working with the Pi
Once the Pi is configured, there are a few methods of using it depending on if you want to use it like a desktop or manage it remotely.
This section covers using the Pi in the following ways
- Using HDMI-out -- Operate your Pi like a desktop computer.
- Using the serial terminal -- Operate through a serial link to another computer.
- Using SSH -- Operate through a network linked to another computer.
Using HDMI-out
This is the easiest method and is great if you have a HDMI monitor lying around. After the system boots, log in with "pi" as the user name and "raspberry" as the password. Then, enter startx
to enter a graphical environment where you are presented with a desktop-type menu driven operating system.
If you need to get back to text land, you can either
- log off through the Task Bar Menu -- drops back to the shell, closing down the X window system
- open xterm from the Task Bar -- opens a shell in a graphical window
- Use CTRL-ALT-1 through CTRL-ALT-8 -- gives you a number of shells, with 7 being the graphic environment (if loaded).
Remember, shutdown with the menu item or enter sudo shutdown -h now
from a shell, and wait for the system to halt, before removing power.
Using the serial terminal without a monitor
Connect the FTDI to the mini-usb cable and plug into a usb port on your computer.
Set the serial settings to 115200 baud, 8 bit, no parity, 1 stop and no flow control.
Power on the pi -- wait 45 seconds for boot (30 second boot time plus margin).
From here, you can't use startx
because there is no graphic driver through the serial terminal. However, you can configure your wireless/lan, use apt-get to get programs, do all your coding and operate the Pi's hardware.
If you don't see a login, start troubleshooting.
Using SSH
A good way to operate a Pi is to attach it to the local network somewhere, then manage it from another computer connected to that network.
To do this, download PuTTY or a similar SSH terminal for your system and connect to the Internet port used by the pi. The TTY interface gives you a serial interface but with colors that make it a little nicer to use.
To obtain your IP, get to a terminal, and use the command ifconfig
.
With Ethernet and wireless attached, ifconfig
returns something like the following. If it looks similar but the IP addresses aren't present, that link hasn't been established.
pi@raspberrypi:~$ ifconfig
eth0 Link encap:Ethernet HWaddr b8:a8:3b:56:1a:f7
inet addr:14.7.3.188 Bcast:14.7.3.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3026 errors:0 dropped:0 overruns:0 frame:0
TX packets:462 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:229516 (224.1 KiB) TX bytes:60888 (59.4 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1104 (1.0 KiB) TX bytes:1104 (1.0 KiB)
wlan0 Link encap:Ethernet HWaddr 74:df:21:5b:a3:9c
inet addr:32.8.0.142 Bcast:32.8.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:120 errors:0 dropped:40 overruns:0 frame:0
TX packets:12 errors:0 dropped:4 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:20955 (20.4 KiB) TX bytes:9956 (9.7 KiB)
Now that I know that my Ethernet is on IP 14.7.3.188 and my wireless on 32.8.0.142, I can enter it into the PuTTY configuration window to begin the session. From here, it just works like the serial link!
Configuring the Pi
This section goes over configuring the keyboard, ethernet, and wireless (Edimax) modules.
Configuring the keyboard layout
The raspbian distribution comes defaulted to European hardware. For us Yanks, we find the " (quotation mark) symbol is replaced by @ (commercial at) and our number sign # is replaced by the european pound sign £. This can made it aggravating when trying to #define things. Invoke the config tool with "sudo raspi-config" and take the following actions.
Set the default locale for the system
- Select "Internationalisation Options"
- Select "Change Locale"
- Deselect en_GB.UTF-8 UTF-8
- Select en_US.UTF-8 UTF-8, (Ok)
- Set default to en_US.UTF-8, (Ok)
Change the keyboard layout -- from the Internationalisation Options menu,
- Change Keyboard Layout
- Leave set as: Generic 105-key (Intl) PC (Ok)
- Select Other (Ok)
- Select English (US) (Ok)
- Select English (US) (Ok)
- Select default (Ok)
- Select No compose key (Ok)
- Set Ctrl+Alt+Bksp function (Ok)
Finish with the dialog and get back to the shell
Try the " and # keys at the prompt. It may be necessary to restart the pi at this point.
Configuring the Internet interfaces
A single configuration file, interfaces
, configures both wired and wireless devices. Settings that work for the EdiMax 7811Un card were found in a blog post by Jason Theobald. His configuration also enables DHCP listening for the wired connection, which is what we want for most networks.
sudo nano /etc/network/interfaces
replace "nano" with "leafpad" if you are in x and prefer graphics
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
wpa-ssid "Your Network SSID"
wpa-psk "Your Password"
Applying the changes ( turning it off and then back on again )
The link should be cycled for the new configuration to take. Rather than shutting down the pi and restarting, use 'ifdown' and 'ifup' to bring the link down and back up.
For wireless connections, use
sudo ifdown wlan0
and
sudo ifup wlan0
For wired connections, use
sudo ifdown eth0
and
sudo ifup eth0
Reading Inputs and Toggling the LEDs
This section contains instructions for getting the software necessary to compile programs that use the GPIO, then redirects to our Raspberry gPIo tutorial.
Getting WiringPi for Using C++
The wiringPi library is required to operate the GPIO with C++. There are two methods to get it. Either way, it will have to be built before use.
Get From the WiringPi
git://git.drogon.net/wiringPi
" is not available.
Wiring Pi is previously not included with early versions of Raspbian. This required users to download and install it. Luckily, Wiring Pi is included in standard Raspbian systems. If you are looking to update using a mirrored Wiring Pi with small updates to support newer hardware, we recommend checking out this GitHub repository.
You'll need git (may be installed by default). If git is not installed, enter the following into the command line.
pi@raspberrypi ~/code $ sudo apt-get install git-core
We highly recommend using Git to download the latest version. To check what version you have, enter the following command.
pi@raspberrypi ~/code $ gpio -v
If you receive an output similar to to the following with the Unknown17
, you'll want to update WiringPi on a Raspberry Pi 4 or above.
language:bash
gpio version: 2.50
Copyright (c) 2012-2018 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty
Raspberry Pi Details:
Type: Unknown17, Revision: 02, Memory: 0MB, Maker: Sony
* Device tree is enabled.
* --> Raspberry Pi 4 Model B Rev 1.2
* This Raspberry Pi supports user-level GPIO access.
Enter the following to remove the wiringPi and configuration files. Then use the hash command for the Pi to remove all locations that remember wiringPi.
pi@raspberrypi ~/code $ sudo apt-get purge wiringpi
pi@raspberrypi ~/code $ hash -r
As long as you have Git installed, these commands should be all you need to download and install Wiring Pi:
pi@raspberrypi ~/code $ git clone https://github.com/WiringPi/WiringPi.git
pi@raspberrypi ~/code $ cd WiringPi
pi@raspberrypi ~/code/WiringPi $ git pull origin
pi@raspberrypi ~/code/WiringPi $ ./build
This will make a folder in your current directory called WiringPi, change the directory to Wiring Pi, and pull the latest changes from the origin. The final command is a script to build Wiring Pi from the source files. This builds the helper files, modifies some paths in Linux and gets WiringPi ready to rock.
At this point, the library should work. Try it out by entering the following command. An Ascii table of pins and states should appear.
pi@raspberrypi ~/code/WiringPi $ gpio readall
Getting Python
Raspian comes with Python pre-installed. Continue to the gPIo tutorial to find out how to use it.
Using the GPIO.
This excellent tutorial on the INs, OUTs, and PWMs of GPIO with the Pi platform. It includes operation of the Pi 2 Model B!
Raspberry gPIo
October 29, 2015
Troubleshooting
Uh oh! Something must have gone wrong. Here's the common problems I ran into.
The serial is garbage!
One thing that can happen while trying to find out the serial settings is that, after trying a few, even the correct settings show garbage. What happens is that with the wrong settings, some of the transmitted characters get time-scaled and resemble terminal control characters. These characters end up telling the server side to change its behavior! If the screen formatting looks OK but the characters are all garbage, this is probably what is up. Either close and re-open the serial terminal program or send terminal reset (Reset terminal and reset remote title for Tera Term) if available.
Monitor remains blank after inserting a card
I've found that when working with SD cards and another computer, sometimes I plug the card into the pi but it the monitor never comes up. In the few cases I've seen the activity lights by pin 1 of the ribbon connector are active but no display appears.
If this is the case,
- First try resetting the pi.
If that doesn't work,
- Log in through another computer with the serial interface.
- Invoke the raspi-config dialog with "sudo raspi-config"
- Expand the partition -- even if has been done before!
- Finish the dialog and reboot.
This has solved the problem every time.
Starting from a blank microSD card
With any development, things can go pear-shaped. Sometimes it can be good to just start from a known state and try again. The process isn't covered by this guide, but the raspberrypi folks have done an excellent job at documenting it. These two steps can get you back to the beginning.
- Download the NOOBS image. As of this writing, it's at version 1.4.2.
- Follow the official installation instructions.
Performing a full system upgrade
Once connected to the internet, it can be a good idea update all the packages that are currently installed. Usually, new packages replace old ones that are faulty, but sometimes new packages have bugs on their own. If your current system is stable and all the funtions are good, maybe don't upgrade. If you're starting a frest project though, get everthing up-to-date before you start putting in the work.
Enter the following commands in the shell (process takes about 10 minutes)
sudo apt-get update
-- go fetch the latest package information.sudo apt-get upgrade
-- And answer Y. Upgrades all the packages. This stage will take a while.sudo shutdown -r now
-- Reboot the machine.
Resources and Going Further
You've completed boot-camp for the Pi 2. Hopefully your Pi is screaming along, toggling outputs and is chomping through all your available bandwidth. The kit has been designed to give you everything you need to start a project...
Now get out there and make us proud!
Here are some links to our other Pi resources.
Need some inspiration?
- Raspberry Pi Twitter Monitor
- Hackers in Residence: Sound visualizer
- Raspberry Pi Time-lapse Part 1
- Raspberry Pi Time-lapse Part 2