Raspberry Pi is a mini computer that has many ports which can be used to connect different peripheral devices. When you buy a Raspberry Pi, you just buy a printed circuit board which doesn’t even come with a power supply or operating system. You can connect a separate monitor through the HDMI port and a keyboard and mouse through the USB plugs. It also has an Ethernet port so you can use the internet on your Raspberry Pi.
In this tutorial, you will go through series of steps which will let you connect your Raspberry Pi to your laptop or desktop PC, which eliminates the need to use separate devices to operate your Raspberry Pi.
Hardware and Software
1 x Raspberry Pi
1 x Ethernet Cable
1 x Laptop or Desktop PC
1 x SD card (minimum size 4GB)
1 x Micro USB cable (to power the Raspberry Pi)
Before we move on, there is some programs that you'll need to download. Here are some places where you can download them for free
Raspbian OS: When you buy Raspberry Pi, you have option (on some stores) to buy pre-installed OS on your SD card otherwise just download the zip-file from https://www.raspberrypi.org/downloads/ which includes the image of Raspbian OS that you are going to write on your SD card.
SDFormatter: SD card association has a very nice software that can be used to format your SD Card. Go to https://www.sdcard.org/downloads/formatter_4/index.html and download the SDFormatter for your OS.
Win32DiskImager: In order to write Raspbian on your SD card you are going to need Win32DiskImager utility. You can download it here http://sourceforge.net/projects/win32diskimager/
Advanced IP Scanner: You will need this to find the IP address of your Raspberry Pi when you’ll connect it to your PC. Simply download it from http://www.advanced-ip-scanner.com/
PuTTy: PuTTy is the SSH client that will be used to connect to Raspberry Pi. You can download it here http://www.putty.org/
VNC: Last is VNC server. You can download it from https://www.realvnc.com/download/
Once you download all these programs, unzip and install them.
Installing the OS
- Insert the SD card into your SD card reader and check which drive letter is assigned.
- Open Win32DiskImager, you may need to run as an administrator.
- Select the image of Raspbian you extracted.
- Select the device letter for your SD card in the device box. Make sure you select the correct drive letter, otherwise you will ruin your hard drive.
- Click Write and wait for the write to complete.
- Exit the imager and eject the SD card, then plug it into your Raspberry Pi.
Note: After writing the OS you’ll notice that there is only few MBs left in your SD card, this is because of the partition, and rest of the free space is hidden. You’ll be able to fix this once we connect to our Raspberry Pi.
Sharing the Internet Over Your Ethernet Port
Now that you are ready with your SD Card, insert it into your Raspberry Pi. Attach the Micro USB Power Cable with it. Also, attach your Raspberry Pi to your computer via Ethernet Cable.
This step explains how you can share your PC (connected to Wi-Fi) internet with your Raspberry Pi. You can do this easily by Connection Bridge.
1. In your PC go to Network and Sharing Center then go to Change adapter settings in the left column. You will see multiple connections in this window.
2. What you are going to do here is making a bridge between your Wi-Fi and Ethernet connection. Select your Wi-Fi then hold Ctrl and select your Ethernet
3. Right click on any of them (while both selected as mention in previous step) and select Bridge Connections.
4. Wait until Windows bridge connections.
5. Upon success you will notice another connection, Network Bridge in your adapter settings.
Checking IP Assigned to your Raspberry Pi
This is simple, make sure your Raspberry Pi is connected to your PC and Ethernet cable is also plugged in. If everything is working fine you’ll see leds blinking on your board.
1. Run Advanced IP Scanner and click Run
2. It will take some time and you’ll see a list of devices connected to your network.
Connecting to Raspberry Pi through PuTTy
Alright! Before moving forward just a quick summary what you’ve done so far:
- Installed OS.
- Internet shared over Ethernet.
- Know IP address of your Raspberry Pi.
Next you are going to connect to your Raspberry Pi and some final settings after that you are good to go.
1. Run PuTTy
2. Enter the IP address of your Raspberry Pi, (you found that using Advanced IP scanner in previous section).
3. On the left side expand Connection category and then expand SSH go to X11 and check Enable X11 Forwarding.
4. Open the connection now.
5. You’ll see a terminal window. Connecting to Raspberry Pi requires login: pi and password: raspberry.
6. Once you enter login details you’ll connect to your Raspberry Pi terminal window. Enter sudo raspi-config and hit enter. This is the Raspberry Pi software configuration tool.
7. Go to Expand Filesystem and after few blinks you’ll see that your partitions are resized and you’ve fixed the partition issue we discussed while installing the OS.
8. Reboot Raspberry Pi (you might have to restart your PC as well) and re-connect like you just did.
9. Now run sudo apt-get update && sudo apt-get upgrade commands in the Raspberry Pi terminal. This will upgrade all the software installed in the system and will finalize OS installation.
Connecting to Raspberry Pi through VNC
You’ve already installed VNC on your PC now it’s time to install VNC on your Raspberry Pi.
1. Connect to Raspberry Pi through PuTTy.
2. In Raspberry Pi terminal window write sudo apt-get install tightvncserver
3. Once the VNC is installed run this command vncserver :1. This will start the VNC server. You’ll be prompted to enter the password, enter any 8 digit password. This password will be used to connect to this VNC server on your PC.
4. Now on your laptop run VNC viewer.
5. Enter the VNC server IP address. This is the IP address of your Raspberry Pi apped :1 at the end of IP address as this shows the port number. Click Connect. You’ll get a warning message, click Continue.
6. Enter the 8 digit password and hit enter.
Now you can use your Raspbian like a normal OS and start coding.
Give this project a try for yourself! Get the BOM.