• Steve Pomroy

Setup a Credit Card Sized Computer in 8 Easy Steps

Updated: Jun 13, 2019

As I mentioned in an earlier post, there is a powerful little computer that just so happens to be inexpensive as well. The Raspberry Pi is a great starting point for many DIY projects requiring a "brain" to power them. This post steps you through the basic setup in 8 easy steps.

Tiny Computer, Big Potential

  1. Buy some fun stuff

  2. Put it together

  3. Download some software

  4. Install it

  5. Configure wi-fi access

  6. Configure remote access

  7. Install MicroSD Card and Power Up

  8. Test Remote Access


Step 1 - Buy some fun stuff

Here's a list of the fun stuff you need. In total it set me back about $100 USD:

  1. Raspberry Pi (Model 3 B) ($34.99) + protective case ($7.99) + small screwdriver

  2. Camera ($24.68) + protective case ($2.95)

  3. MicroSD (includes adapter) ($14.80)

  4. Power supply ($17.99)

  5. Laptop/desktop with a SD memory card slot

Optional (but useful for troubleshooting):

  1. USB Keyboard

  2. HDMI TV

  3. HDMI cable


Step 2 - Put it together

After all of those packages get delivered, the fun begins. The picture below shows where you'll connect the power, memory card and camera. This is just for reference. We'll take it step by step momentarily.

Figure 1: Raspberry Pi with memory, power & camera ports labelled

1. After you take the Pi and the protective case out of their protective packaging, take the bottom of the case and lay it flat, facing up as shown in Figure 2. You'll notice that the bottom of the case has a square hole on one end for the memory card.

Figure 2: Bottom of protective case next to Raspberry Pi

2. install the Pi onto the bottom of case by simply laying it in there with the four mounting holes in the Pi itself aligned with the four mounting pegs in the case. Secure the Pi to the case with the four small screws that shipped with the case.


Figure 3: Pi laid into bottom of protective case

3. Before you snap on the top of the protective case, let's install the camera. Otherwise, you'll have to remove the top of the case to connect the camera ribbon cable to the Pi.


4. Remove the camera and the protective case from the packaging.

Figure 4: Protective case and camera waiting to be assembled

5. Place the camera on the black (back) of the case with the lens facing up like this:

Figure 5: Camera placed on back of protecitve case

6. Snap on the clear top over the camera.

Figure 6: Camera in protective case

7. Next, let's connect the camera to the Pi. As shown in Figure 7, you'll connect the camera through the top of the case by feeding the camera’s ribbon cable through the slot in the top of the case before you connect the camera to the Pi. Otherwise you won’t be able to connect the camera after you put the top of the case on.

Figure 7: Feed camera cable through slot in top of case

8. Connect the camera’s ribbon cable to the Pi’s camera port. This can be a little tricky.

First you need to lift the black locking part of the camera (ribbon) connector on the Pi up out of its locked position. It's right next to the HDMI port. Refer back to Figure 1 if you're not sure where it is.


Insert the ribbon cable squarely into the port with the exposed silver connector ends of the ribbon cable facing the HDMI port (the blue side faces the black locking part of the connector).


Push the black locking part of the connector straight down so that it locks the ribbon connector squarely in place.

Figure 8: Camera attachde to Pi through top of case

9. Snap the top of Pi's protective case onto the bottom part. Connect the USB cable to your Pi but don't plug it in yet. We'll do that a little later after we've completed the initial software setup steps. Your setup should now look like this:

Figure 9: Camera attached to assembled Pi case

Step 3 - Download Software

Just like you need an operating system such as MacOS, Windows or Linux to run your laptop (or Android/iOS for your mobile phone) you need an operating system like Raspbian for your Pi.

  1. Download Raspberry Pi Operating System: Raspbian Stretch Lite. For a version that provides a desktop experience, download Raspbian Stretch with Desktop.

  2. Download Etcher. You’ll use this to copy Raspbian to the Pi’s microSSD memory card.


Step 4 - Install Software

To install the Raspbian software that runs your pi, you need to copy the file you downloaded in Step 4 onto the memory card (microSD) that we'll plug into the Pi shortly.


1. Insert the microSD card into the adapter that came with it. It's pretty easy - check out Figure 10.

Figure 10: Close-up of MicroSD card being inserted into adaptor

2. Insert the adapter containing the microSD card into your laptop/desktop. Push it in until it “clicks”. Sometimes there’s a protective “dummy” SD card inserted in the port that you need to eject first.


3. Install and launch Etcher.


4 .Within Etcher, click Select Image. Navigate to your download folder and select the Raspbian file you downloaded earlier.


5. Click Select Drive. This drive will be the memory card you inserted in Step 2 above. Note that Etcher may automatically select this for you.


6. Click “Flash” to copy Raspbian to the memory card.

Figure 11: Etcher main window

7. Etcher displays “Flash Complete!” to let you know when the copying process has finished.

Figure 12: Etcher flash complete


Step 5 - Configure Wi-Fi

Since your Pi won't normally be connected to a keyboard and monitor, we need to configure wi-fi for remote/internet access. To do that, we need to create a wi-fi configuration file on the microSD card we "flashed" in Step 4 above.


1. Start your favorite text editor (Notepad on Windows; TextEdit for MacOs; Vi, Emacs, Pico or Nano for Linux).


2. Copy/paste the following text into the empty file (Note that I'm located in North America, hence the country=US in the first line).


country=US

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

update_config=1

network={

ssid="your_real_wifi_ssid"

psk="your_real_password"

}


3. Replace "your_real_wifi_ssid" with the name of your wi-fi network.


4. Replace "your_real_password" with the password for your wi-fi network.


5, Save this file to the microSD card as wpa_supplicant.conf. Don't ask me why it's called that, it just is :) Be sure to save the file in the root of the SD card. Your Pi won't configure wi-fi access if you save it in a subfolder.



Step 6 - Configure Remote Access

In order to control your Pi from your laptop (or mobile device), you need to configure it to allow remote connections via secure shell (SSH). Remember, you won't normally have a keyboard or monitor attached so you won't be able to control it without remote access.


Simply create an empty file using your favorite text editor and save it to the microSD card as ssh (or ssh.txt). That's right, leave the file blank and save it directly to the card like you did for the wi-fi setup and not in a subfolder.


Simply placing this empty file on the microSD card tells your Pi to allow remote command-line connections via SSH. Without this file, Pi won’t automatically start SSH and so you won’t be able to connect to it remotely.



Step 7 - Install MicroSD Card and Power Up

The microSD slot is located underneath your Pi. Turn the Pi/case upside down to access the slot. Slide the SD card into the slot making sure the metal connections on the microSD are facing towards the Pi (away from you). Also be sure to push it all the way in.


Here's what my Pi looks like with the memory card installed. Ignore the grey Velcro squares. I put those there for another project - maybe the topic for a future post.


Figure 13: Bottom view of Pi with MicroSD card installed on right

Now plug in your Pi. The micro USB port in on the side just around the corner from the memory card - you can't miss it.


It may take a few minutes for your Pi to start up the first time. You’ll notice some green and red lights (LEDs) blinking while the Pi is doing its thing. After a few minutes try testing remote access.



Step 8 - Test Remote Access

Let's wrap this up by testing remote access to your Pi. We'll be connecting to it via SSH (Linux/Mac) or by using Putty (Windows) or Termius (mobile device). This can sometimes be a little confusing first time through but bear with me, there's really not much to it. I'll walk you through in detail in a moment but basically you'll need to tell your computer to connect to your Pi which will then ask you to login. Like this:


Linux:

1. Open a command/terminal window by pressing CTRL + T


2. Type the command: ssh pi@raspberrypi and press ENTER. This command runs ssh and uses the username pi to connect to a computer named raspberrypi.


If you can't connect using raspberrypi as the hostname, try raspberrypi.local instead.


Sometimes you need to provide the IP address for your Pi if you can't connect to it using a hostname. My Pi uses IP address 192.168.1.5 but yours is probably different. Go to your wi-fi router's homepage (point your browser to 192.168.1.1 which is usually the place your router hangs out) and find the IP address associated with raspberrypi to figure out which IP address you should use.


3. Since this is your first time logging in, you'll get a warning message about authenticity. Type yes and press ENTER.


4. Type raspberry and press ENTER. This is the default password for your pi. Your screen should look something like Figure 14.


5. I strongly suggest you change the default password by running the passwd command. Call me paranoid, but at least it will make your Pi a more difficult target for the bad guys. You'll be asked to provide the current password (raspberry) and then to enter the new password twice. Be sure to write down your new password - or else!

Figure 14: Initial login from Linux


Windows:

1. Download and launch the SSH utility Putty. It's a pretty light utility so it doesn't even require an install.


2. After Putty starts, you'll see a window similar to Figure 14 below. You need to tell Putty the name (hostname) for your Pi. Surprise, surprise, this is usually raspberrypi or raspberrypi.local


Sometimes you need to provide the IP address for your Pi if you can't connect to it using the hostname. My Pi uses IP address 192.168.1.5 but yours is probably different. Go to your wi-fi router's homepage (point your browser to 192.168.1.1 which is usually the place your router hangs out) and find the IP address associated with raspberrypi to figure out which IP address you should use.

Figure 15: Connecting to your Pi from Windows using Putty

You can also choose to save the connection settings for your Pi by providing a name (RaspberryPi3B in my example) and clicking the Save button. See Figure 16 for an example of that. It looks a lot like Figure 15, except that RaspberryPi3B is listed under Saved Sessions.

Figure 16: Saving the Putty connection details for our Pi

3. Click the Open button to start the login process. The first time you connect to your Pi, you’ll see a warning similar to Figure 17 which is Putty's friendly way of telling you that you've never logged into your Pi before.

Figure 17: Putty's friendly first time login warning

4. Click Yes to continue logging in. Your Pi will then ask you for a username. Type pi for the username and press ENTER. You'll then be asked for the password. Type raspberry and press ENTER. When you’ve successfully logged in, you should see something similar to this on your screen:

Figure 18: Succesful login from Windows using Putty

5. I strongly suggest you change the default password by running the passwd command. Call me paranoid, but at least it will make your Pi a more difficult target for the bad guys. You'll be asked to provide the current password (raspberry) and then to enter the new password twice. Be sure to write it down - or else!



Next Steps

Now that your shiny new Raspberry Pi is up and running, you'll probably want to make use of the shiny new camera as well. Check out my upcoming post for details on enabling and taking pictures with the camera. Fun, fun fun!


In the meantime, if you want to shut down your Pi, don't just unplug it. Like any computer you need to shut it down properly or you might lose data. While logged into your Pi type sudo shutdown now -h and press ENTER. I know. It's not a very intuitive shutdown command, is it? After a few seconds it'll be safe to unplug your Pi.


If you simply want to reboot then sudo shutdown now -r is the command you want. See what I did there? I swapped a -r for the -h of the shutdown command. Sneaky, huh?

© 2019 Steve Pomroy and Associates

  • LinkedIn - Black Circle
  • Facebook - Black Circle