0

members

Easy Raspberry basics: Project 12a Enable and Connect your Raspberry Pi with SSH

of Lex C. in Raspberry Pi 3

Raspberry basics: Project 12a

Project name: Enable and Connect your Raspberry Pi 3 model B board with SSH

Tags: Raspberry, Raspberry PI 3 model B board, SSH

In this project, you need these parts :

1.Raspberry PI 3 model B 1 pc

2. Micro SD card and SD card adapter 1 pc

3. Micro USB power supply (2.1 A, max 2.5 A) 1 pc

4. USB keyboard 1 pc

5. USB mouse 1 pc

6. TV or PC monitor 1 pc

General

We will learn how to download the latest version of the Raspbian Lite OS, upload it to a SD card and establish an SSH communication on Raspberry PI 3 model B board.

Understanding the Raspberry PI 3 model B

The Raspberry Pi 3 is the third-generation Raspberry Pi. It replaced the Raspberry Pi 2 Model B in February 2016.

Specification:

  • Quad Core 1.2GHz Broadcom BCM2837 64bit CPU
  • 1GB RAM
  • BCM43438 wireless LAN and Bluetooth Low Energy (BLE) on board
  • 40-pin extended GPIO
  • 4 USB 2 ports
  • 4 Pole stereo output and composite video port
  • Full size HDMI
  • CSI camera port for connecting a Raspberry Pi camera
  • DSI display port for connecting a Raspberry Pi touchscreen display
  • Micro SD port for loading your operating system and storing data
  • Upgraded switched Micro USB power source up to 2.5A

Signals and connections of the Raspberry PI 3 model B


Step by Step instruction

1. A little about equipment required

Before you plug anything into your Raspberry Pi, make sure that you have all the equipment you need:

  1. A Raspberry Pi 3 model B board
  2. A micro SD card with with a full-size SD adapter. We recommend an 8GB class 4 SD card, ideally preinstalled with NOOBS. To get started with Raspberry Pi, you also need an operating system. If you haven't purchased a pre-installed micro SD card with NOOBS - not a problem, we will explain how to install an operating system onto an SD card.
  3. A monitor with the correct cable and adapter (HDMI - HDMI or HDMI - DVI). Any HDMI/DVI monitor and any TV should work as a display for the Pi. Most modern television sets and monitors have an HDMI port, and are the easiest to get working with the Raspberry Pi. You can use an HDMI cable to connect the Raspberry Pi directly to the television or monitor. Some older monitors have a DVI port. These work well with the Raspberry Pi, although you'll need an HDMI-to-DVI adapter to attach to an HDMI cable, or a one-piece HDMI-to-DVI cable. Some old monitors have a VGA port. These can be trickier to use as you'll need an HDMI-to-VGA converter, which can change digital video to analogue video. A simple port adapter won't work. For best results, use one with HDMI input, but other connections are available for older devices.
  4. A wired keyboard and mouse, or a wireless keyboard and mouse with a Bluetooth adapter.Any standard USB keyboard and mouse will work with your Raspberry Pi. Wireless keyboards and mice will work if already paired. For keyboard layout configuration options see raspi-config.
  5. A micro USB power supply. The Pi is powered by a USB Micro power supply (like most standard mobile phone chargers). Many mobile devices are powered using a 5V micro USB charger. These can often be used to power the Raspberry Pi, although it's worth checking that they provide sufficient voltage and current (5V / 1.2 - 2.5A). There are many devices which are capable of providing power over USB. Some modern wall sockets have USB ports, for instance. You can also connect to USB hubs, computers, and battery packs. If you have a micro USB cable, then you could try to power your Raspberry Pi using any powered USB port. You'll need a good-quality power supply that can supply at least 2A at 5V for the Model 3B, or 700mA at 5V for the earlier, lower powered models. Low current (~700mA) power supplies will work for basic usage, but are likely to cause the Pi to reboot if it draws too much power.
  6. A T-Cobbler Breakout and GPIO Cable.  This is the perfect extension for Raspberry Pi GPIO to breadboard, with clear GPIO labeling. This is the assembled version of the Pi T-Cobbler.  It only works with the Raspberry Pi Model Zero, A+, B+, Pi 2,Pi 3! (Any Pi with 2x20 connector). The Raspberry Pi has landed on the Maker World like a 40-GPIO pinned, quad-USB ported, credit card sized bomb of DIY joy. And while you can use most of our great Model B accessories by hooking up our downgrade cable, its probably a good time to upgrade your set up and accessorize using all of the 40 pins. That's why we now carry the Assembled Pi T-Cobbler - Breakout + Cable for Raspberry Pi. This Cobbler is in a fancy T-shape, which is not as compact, but is a little easier to read the labels. The T-Cobbler is an add on prototyping board for the 2x20 connector-type Raspberry Pi, and can break out all those tasty power, GPIO, I2C and SPI pins from the 40-pin header onto a solderless breadboard. This set will make "cobbling together" prototypes with the Pi super easy. Each order comes with a 40 pin ribbon cable and assembled T-Cobbler. You can plug the 40-pin GPIO cable between the Pi computer and the T-Cobbler breakout. The T-Cobbler can plug into any solderless breadboard. The T-Cobbler PCB has all the pins labeled nicely so you can go forth and build circuits without keeping a pin-out printout at your desk. We think this will make it more fun to expand the Pi and build custom circuitry with it. Designed for use with any 2x20 connector Raspberry Pi.  No soldering required.
  7. An ethernet (network) cable. [Model B/B+/2/3 only]. An Ethernet cable is used to connect your Pi to a local network and the internet.
  8. A USB wireless dongle. Alternatively, you can connect to a wireless network using a USB wireless dongle, which will require configuration.
  9. An audio lead. Audio can be played through speakers or headphones using a standard 3.5mm jack. Without an HDMI cable, an audio lead is necessary to produce sound. No separate audio lead is necessary if you're using an HDMI cable to connect to a monitor with speakers, as audio can be played directly through the display; but it is possible to connect one if you prefer to have the audio played through other speakers - this requires configuration.

2. Raspberry Pi software setup. Install an operating system to Micro SD card

If you haven't purchased a pre-installed micro SD card  - not a problem, we will explain how to install an operating system onto an SD card now.

  1. Prepare a SD card. The Raspberry Pi works with any compatible SD card. For installation of NOOBS or the image installation of Raspbian, the minimum recommended card size is 8GB. For Raspbian Lite image installations we recommend a minimum of 4GB. Some distributions, specifically LibreELEC and Arch, can run on much smaller cards. If you're planning to use a card of 64GB or more with NOOBS, see this page first. The card class determines the sustained write speed for the card; a class 4 card will be able to write at 4MB/s, whereas a class 10 should be able to attain 10 MB/s. However, it should be noted that this does not mean a class 10 card will outperform a class 4 card for general usage, because often this write speed is achieved at the cost of read speed and increased seek times. The original Raspberry Pi Model A and Raspberry Pi Model B require full-size SD cards. The newer Raspberry Pi Model A+, Raspberry Pi Model B+, Raspberry Pi 2 Model B, Raspberry Pi Zero, and Raspberry Pi 3 Model B require micro SD cards.
  2. Format SD card. Before installing anything on SD card you need to have it formatted. You'll also need to make sure your computer has a built-in SD card reader, or you can use a USB SD card reader. Download SD Formatter 5.0 for either Windows or Mac and follow the instructions to install the software. Insert your SD card into the computer or laptop’s SD card reader and make a note of the drive letter allocated to it, e.g. F:/. In SD Formatter, select the drive letter for your SD card and format it.
  3. Note: If your SD card has 64GB or more, it will automatically be formatted as exFAT, which is not compatible. Follow these instructions to force your SD card to format as FAT32.
  4. Go to the Raspberry Pi website raspberrypi.org and you open the downloads section. You’ll find all the official operating systems that you can download. We are going to download and use Raspbian Lite.
  5. Raspbian Lite?
    Because it is a lightweight version of the Raspbian and it doesn’t have a graphical user interface installed. This means that it doesn’t have any unnecessary software installed that we don’t need for most projects, so this makes it the perfect solution for future home automation projects.
    Raspbian Lite is a lightweight version of the Raspbian and it doesn’t have a graphical user interface installed. This means that it doesn’t have any unnecessary software installed that we don’t need for most projects, so this makes it the perfect solution for future home automation projects. Press Download ZIP button to download the Raspbian Lite Operating System. It will be in Download folder on your PC.
  6. Extract the 2018-10-09-raspbian-stretch-lite.img file from the zip. 
  7. We will use a Etcher software to flash the image to your micro SD card. You can download it on etcher.io website and it is very easy to install in all operating systems or you can download a portable version.
  8. Open the Etcher software and insert your micro SD card with adapter to your PC SD card slot.
  9. Select your 2018-10-09-raspbian-stretch-lite.img file with the Raspbian Lite OS. 
  10. Select your micro SD card as the drive. This process erases and overwrites the selected device. Be certain that you’ve selected the SD card correctly and be sure that you have copies of any files that you need from the card. 
  11. Press Flash! button and then Yes button to start writing the image to the micro SD card. This process takes around 10 - 20 minutes, depending on your SD card class number and your micro SD card writer’s transfer speed.
  12. When this process has finished open your micro SD card and you should see something similar to the image below.
  13. You must enable SSH communication, so that you can establish a communication with your Pi. Download a blank file called ssh here. You should have the ssh file that has no extension in your Downloads folder.
  14. Move the ssh file to the micro SD card.
  15. Raspbian Lite was successfully flashed into your micro SD card. You can now remove your SD card and insert it into your Raspberry Pi 3 board.

3. Raspberry Pi hardware setup and finding Raspberry PI IP address

  1. Insert your micro SD card with Raspbian Lite OS to Raspberry Pi 3 board.
  2. Connect the TV or PC monitor Display port (HDMI Port) to your Raspberry PI 3 board HDMI Port (HDMI cable required).
  3. Make sure that your monitor or TV is turned on, and that you have selected the right input (e.g. HDMI 1,  etc).
  4. Plug in your USB mouse and USB keyboard to Raspberry PI 3 board USB ports.
  5. Get connected. Connect an Ethernet cable to 10/100 LAN port of Raspberry Pi 3 or plug in WiFi adapter (see the list of supported here) to USB port of Raspberry Pi 3.
  6. Connect Micro USB power supply to Raspberry PI 3 board micro USB input.
  7. After booting up your Raspberry Pi, you need to find its IP Address. In order to find your Rapberry Pi in your network, you need to install a software that scans your network for devices. We will use Angry IP Scanner software. It runs on Windows, Mac OS X or Linux. You can download it on angryip.org website. Make sure you have Java installed. Select the right installation file for your PC. In our case, we are using 64-bit Windows PC with Windows 10 installed.
  8. Run the Angry IP Scanner. When you launch the software, it should automatically pick the IP Range for you network, so all you need to do is press Start button and wait a few seconds. Angry IP Scanner will find your Raspberry Pi on the local network with its default Hostname of raspberrypi.local. Save your IP address (in our case it is 192.168.1.64) because you’ll need it later. Your Raspberry Pi may have a different IP address depending on whether it’s connected to your router through Wi-Fi or Ethernet, and that address might even change from time to time. If you ever find yourself unable to connect via SSH, you can always double-check the IP address using the Angry IP software.

4. Connecting via SSH to your Raspberry PI on Windows OS

SSH (secure shell) is a method of establishing a communication with another computer securely. All data sent via SSH is encrypted. SSH is based on a Unix shell, so it allows you to access your Raspberry Pi files from a remote machine by using terminal commands. It has grown to be one of the most popular methods for communication between different devices.

If you use Windows, you need a free application called PuTTY. 

  1. Go to putty.org website and download the latest version of Putty for Windows. You can download it here.
  2. Open downloaded file putty-64bit-0.70-installer.msi

  3. Press Next button.

  4. Select destination folder and press Next button.
  5. Press Install button and confirm Yes to start installation.
  6. Press Finish button.
  7. Run Putty, enter your Raspberry Pi 3 IP address in the PuTTY Configuration dialog box, select SSH as your connection type.The port needs to remain at the default number 22
  8. Press Open button.
  9. When you’re asked to log in, type pi and press Enter.
  10. When you’re asked to type a password, type raspberry. Please note that default settings for Raspbian Lite OS are: username = pi and password = raspberry
  11. When you connect your computer to your Raspberry Pi for the first time, you’re prompted by a message warning you that you’re attempting to establish a connection with an unknown host. Simply press OK button to proceed.
  12. You have an SSH communication established with your Raspberry Pi now. This will be useful to install software in your Raspberry Pi, run your programs, create folders or files and so on.
  13. To shut down your Raspberry Pi, simply type this command on the command line: sudo poweroff
5. Connecting via SSH to your Raspberry PI on Mac OS X and Linux
In Mac OS X and Linux, you can use the default Terminal window to establish an SSH communication, because SSH comes in all Unix-based OSes.
  1. Open a new Terminal window.
  2. Type the following command: sudo ssh pi@ip_address Replace the ip_address part with the real IP address of your Raspberry Pi that you found before. In our case, we run the following command: sudo ssh pi@192.168.1.64
  3. Enter your computer password (so you can run a sudo command), and type yes.
  4. When you’re asked to type a password for your Raspberry Pi type raspberry, press Enter. Please note that default settings for Raspbian Lite OS are: username = pi and password = raspberry
  5. When you connect your computer to your Raspberry Pi for the first time, you’re prompted by a message warning you that you’re attempting to establish a connection with an unknown host. Simply press OK button to proceed.
  6. You have an SSH communication established with your Raspberry Pi now. This will be useful to install software in your Raspberry Pi, run your programs, create folders or files and so on.
  7. To shut down your Raspberry Pi, simply type this command on the command line: sudo poweroff

Summary

We have learnt how to download the latest version of the Raspbian Lite OS, upload it to a SD card and establish an SSH communication on Raspberry PI 3 model B board.

Library

  • No libraries needed in this project

Sketch

  • No sketches needed in this project


Other projects of Lex C.

Published at 26-09-2018
Viewed: 1126 times