Introduction - Raspberry Pi tutorial

Welcome to a series on the Raspberry Pi. One of the most common questions I see about the Raspberry Pi is "What do I do with this?"

Raspberry Pi tutorials

The Raspberry Pi is a fully-fledged mini computer, capable of doing whatever you might do with a computer. It comes with 4x USB, HDMI, LAN, built-in Bluetooth/WiFi support, 1GB RAM, 1.2GHz quad-core ARM CPU, 40 GPIO (General Purpose Input Output) pins, audio and composite video output, and more. Rather than not having many choices, instead, your options are staggeringly large!

For some examples, I have personally used Raspberry Pis to:

I have also used Raspberry Pis as home security cameras, server monitoring devices, cheap headless machines (basically running low-weight scripts 24/7 with a low cost-to-me)... others have used them for media centers and even for voice-enabled IoT devices. The possibilities are endless, but first we need to get acquainted!

If you do not already have a Raspberry Pi, you can buy one here, or in a variety of other locations.

Beyond the Raspberry Pi, it can be wise, but not required, to get a case. Make sure that, if you do get a case, it has openings for the GPIO pins to be connected, otherwise you're ruining all of the fun. You will also need a 1000mA+ mini usb power supply and at least an 8GB micro SD card, but I would suggest a 16 GB micro SD card or greater.

You will also want to have a spare monitor (HDMI), keyboard, and mouse handy to make things easier when first setting up. You wont will eventually be able to control your Pi remotely, so you wont always need a separate keyboard, mouse, and monitor. If you don't have a monitor with HDMI input, you can buy something like an HDMI to DVI converter.

This is all assuming you're going to be using a Raspberry Pi 3 Model B. If you're using an older version board, please see what you might need to change, for example, the older Rasbperry Pis take a full-sized SD card, but the latest model requires a micro SD card. Also, the Raspberry Pi 3 Model B has built-in wifi, where the older models will require a wifi dongle.

A typical Raspberry Pi shopping list, assuming you have a mouse, keyboard, and HDMI monitor that you can use temporarily while setting up is:

  1. Raspberry Pi - $37
  2. 1000mA+ mini usb power supply - $10
  3. 16 GB micro SD card - $10

For a total of $57 and free shipping, at least on Amazon. You can also find kits that come with everything you might need and maybe some more goodies for a similar price, like this Raspberry Pi 3 starter kit.

Finally, JUST in case you don't have an SD card reader on your computer, you can buy a USB SD card reader for under $10.

Additionally, if you plan to join us on the initial GPIO (General Purpose Input Output pins) tutorials, you will also want to pick up:

  1. 10 x Male-to-Female jumper wires (you should consider just buying a bunch of these so you have plenty in the future).
  2. 1 x Breadboard (You may also want multiples of these)
  3. 3 x LED light (...more wouldn't hurt)
  4. ~6 x Resistors (between 300 and 1K Ohm). You will need at least 1K and 2K ohms for the distance sensor, then ~300-1K resistance per LED bulb. You probably should just buy a kit, they're super cheap.
  5. 1 x HC-SR04 Ultrasonic Distance Sensor ( know what I'm going to say...think about maybe a few.)
  6. 1 x Raspberry Pi camera module. You only need one of these!

For the jumpers, breadboard, and leds, you could also just buy a kit, something like: this GPIO starter kit.

There will be more parts further on in the series as well, but we'll get to them later.

Assuming you've got your board, and an SD card, you're ready to carry on. Being a full computer, the Raspberry Pi uses an Operating System. While you can run headless (from a command line, no desktop), you can also have a GUI desktop if you like. There are quite a few choices for Raspberry Pi operating systems, but most people choose Raspbian, which is a Debian-based operating system that is optimized specifically for the Raspberry pi. This operating system is also most likely to support other packages that you may already be familiar with from other Linux distributions, so it makes for a good starting OS.

There are also a few ways to install and use an operating system on the Raspberry Pi. The most user-friendly method is to use the NOOBS (New Out of Box Software) installer. If you're comfortable enough, you can just simply download the operating system ISO, format the SD card, mount the ISO, and boot the Pi. If that sounds like gibberish to you, then follow along with the NOOBS installation option.

While we're working with the SD card, let's go ahead and Download NOOBS, which is just over 1GB.

First, we must format the SD card. If you are on Windows, you can use SD Formatter. Mac users can also use SD Formatter, but they have a built in formatter, and Linux users can use GParted. Whatever the case, you need to format the SD card, do not do a "quick format" and do make sure you have the "resize" option on. Using SDFormatter on Windows, and chosing options:

Raspberry Pi tutorials

This should go without saying, but do make sure you're formatting the right drive. This will format any flash drive, in alphabetical order. If you had something plugged in already, like your favorite USB drive, and forgot about it, that'd likely be the default choice to format, and then you'd spend all afternoon trying to recover your data rather than enjoying playing with your Raspberry Pi.

Once you're done, great. Now, assuming you've downloaded the NOOBS package, let's go ahead and extract that. Now, we want to copy all these NOOBS contents to our SD Card. Do not drag the directory, but rather the contents:

Raspberry Pi tutorials

While that's transferring, let's talk about a few things on the actual Raspberry Pi board:

Raspberry Pi tutorials

The GPIO (General Purpose Input/Output) pins are underlined in blue. We can use these to control peripheral devices like motors, servos, and more. Circled in red is the micro usb power input for the board. In orange, the HDMI output port. The yellow is where you can plug in the Raspberry Pi camera module. The grey circle has the USB ports. This is obviously not everything, but these are the main things to note.

Once everything is transferred to the micro SD card, you can put it in the Raspberry Pi. The slot is on the bottom side of the board, circled in yellow here:

Raspberry Pi tutorials

Once you've got the SD card plugged in, go ahead and plug in your keyboard, mouse, and HDMI cable to your monitor. Finally, plug in the power, and this will start up the Raspberry Pi. Once fully loaded, you should land on the following screen:

Raspberry Pi tutorials

Now you can choose the operating system. In my case, the only option is Raspbian, so I will check that box, then click "install."

Raspberry Pi tutorials

Let the process go, this will take a while, something like 20-30 minutes or so.

Raspberry Pi tutorials Raspberry Pi tutorials

Once that's done, hit okay and the device should reboot to desktop. While on the desktop, wait for a moment for wifi to start up and find available connections. Connect to your wifi network if possible. You can also plug directly in with an ethernet cable if you don't have wifi. You can also just continue interacting directly with the Raspberry Pi with the mouse and keyboard connected to it if you like, but I prefer to access it remotely.

Raspberry Pi tutorials

Can you guess which network is mine?!

Alright, once we've connected to our network, we'd like to actually interface with the Pi. First, we want to update. Open a terminal by either right clicking on the desktop and opening terminal that way, or by doing control+alt+t. Now, in the terminal, do:
$ sudo apt-get update
and then
$ sudo apt-get upgrade
You do not type the $ sign, it's there to denote when you're typing something in the command line. The upgrade might take a minute. While we wait, your Raspberry Pi's default credentials are: username: pi password: raspberry. For some reason, the apt-get upgrade for me was taking absurdly long. You need to be connected to your network, and have internet access, so make sure you have those things first before doing this, but I still was having trouble. I was able to solve this by doing:

$ sudo nano /etc/apt/sources.list

Then replace everything here with:

deb jessie main contrib non-free
deb-src jessie main contrib non-free

control+x, y, enter

$ sudo apt-get dist-upgrade

$ sudo apt-get update

$ sudo apt-get upgrade

To save some space you can also do: $ sudo apt-get purge wolfram-engine and then $ sudo apt-get autoremove. This alone freed up almost 700mb of space for me.

This is going to conclude the first part of this tutorial series. In the next tutorial, we're going to cover how we can remotely access our Raspberry Pi.

The next tutorial:

  • Introduction - Raspberry Pi tutorial
  • Remote Access with Raspberry Pi tutorial
  • Terminal Navigation - Raspberry Pi tutorial
  • Raspberry Pi Camera Module - Raspberry Pi tutorial
  • GPIO (General Purpose Input Output) Pins - Raspberry Pi tutorial
  • Input from a Sensor via GPIO - Raspberry Pi tutorial
  • Garage Stoplight GPIO Project - Raspberry Pi tutorial