Login

Raspberry Pi 3

Objectives

  • Setup and run Raspberry pi with the OS package installer NOOBS (New Out Of Box Software) through an SD card
  • Install the OS Raspbian
  • Raspberry pi pin structure overview
  • Understand the capabilities of Raspberry pi
  • Connect Raspberry pi to the network and update it with the latest files

Things

For this project, you will need

  1. Raspberry Pi 3 [RPi 3] board (quantity: 1 no.)
  2. VNC Viewer
  3. Micro SD card (quantity: 1 no.)
  4. 5V power adapter (quantity: 1 no.)
  5. Micro USB cable A to B (quantity: 1 no.)
  6. WiFi router / mobile hotspot (quantity: 1 no.)

Let’s begin!

Raspberry pi is a credit card sized single board computer which can be used to run multiple programs and tasks together. It has everything that a computer has like dedicated memory, processor, graphics card for output through HDMI display. This piece of hardware revolutionized the opensource world. Hobbyists and engineers started building things like home automation to servers, bitcoin mining rigs etc.

 

Raspberry Pi

 

So let’s explore and see what we can do with this!

Raspberry pi vs microcontrollers and microprocessors

You might have seen or heard people saying, my PC is very slow… I need to upgrade my RAM or, I want to play more powerful games… I need to buy a new graphics card etc. All this can be done with a microprocessor, not a microcontroller. Basically, the microcontroller will have limited memory, limited flash and limited processing power embedded into a single IC (Integrated Chip). Whereas in a microprocessor, memory, external storage, graphics card are separate and you can change them according to your requirements. Microprocessors are used for tasks that need more calculations, needs to take input from multiple devices and output results on to multiple devices. The microcontroller does repetitive and easy jobs whereas microprocessor can act differently based on varied inputs and conditions.

Compared to a microcontroller and microprocessor, a Raspberry Pi has a single chip called SoC i.e System on Chip which houses everything such as processor, memory, graphics card, WiFi, Bluetooth etc. Hence the name single board computer. But there’s no flash storage for the Raspberry Pi. That’s why we need to load the OS on to an SD card to run the Raspberry Pi.

Since the Raspberry Pi does more processing, it takes more power also. The typical power consumption of Raspberry Pi is around 10 watts, which is almost the same as the power consumed by an adult human brain. Whereas microcontrollers require milliwatts of power to operate which is 1000 times lesser. That’s why choosing the hardware is dependent upon the task needed to be done.

Running the OS on Raspberry Pi

Now that you have a basic idea about Raspberry Pi, let’s experience it by experimenting with it.

Step 1: Using your computer, download the latest OS package installer called NOOBS (New Out Of Box Software) from the Raspberry pi foundation website: Download

Step 2: Extract all the files from the downloaded zip file and copy the extracted files to a micro SD card.

  • It’s better to format your SD card before putting OS onto it. Download SD formatter software from SD association website here and install it in your computer. Open the application and connect your SD card and format the card.
  • The preferred SD card is 16GB SD with class 10 rating, so that the read and write will be faster. As an analogy, this is the same as using SSD (Solid state drive) and Magnetic Drive in a computer. SSD will have better speed.

Step 3: Install NOOBS and Raspbian

  • There are 4 USB ports, 1 micro USB port, 1 HDMI port, 1 ethernet port, 1 micro SD card slot and 1 audio jack output port in the Raspberry pi 3. Make the following connections
    • Connect the 5V power supply using the micro USB cable to the micro USB port of the Raspberry pi.
    • Connect the HDMI cable from the HDMI port of the Raspberry pi to HDMI monitor.
    • Connect the keyboard and mouse to the USB ports of the Raspberry pi.
  • Put the micro SD card into the SD card slot of the Raspberry pi.
  • Turn ON the power supply and Raspberry pi will boot up indicating a continuous red LED and a blinking yellow LED near the power port.
  • Chose the OS Raspbian. It will take a few minutes for the installation after which the login screen will appear. Enter following credentials: This is the default username and password. You can change it later.
    • Username: pi
    • Password: raspberry

Note:

  • You will not see any writing appear when you type the password. This is a security feature in Linux.

Step 4: In order to load the GUI (Graphical User Interface), type the following command in the terminal interface i.e in front of pi@raspberry

startx

Now your Raspberry pi desktop will appear.

Hardware capabilities of Raspberry Pi

Let’s go through the hardware capabilities of Raspberry pi by understanding its pinout possibilities which help in interfacing other hardware such as LEDs, sensors etc. For this project, we will use the Raspberry Pi 3 model.

Raspberry Pi 3 GPIO Pinout

 

Here’s a link for the interactive pinout of  https://pinout.xyz/

The Raspberry Pi 3 has a total of 40 pins categorized as follows.

  • 5V (2 pins)
  • 3.3V (2 pins)
  • GND (2 pins)
  • GPIO (34 pins)

GPIO (General Purpose Input Output) pins

The GPIO pins are used to interface external hardware. The voltage of these pins varies from 0 to 3.3V. Do ensure that the input voltage is not above 3.3V as it might cause permanent damage to the Raspberry pi board.

  • Output function of GPIO – A GPIO pin designated as an output pin can be set to high (3V3) or low (0V).
  • Input function of GPIO – A GPIO pin designated as an input pin can be read as high (3V3) or low (0V). This is made easier with the use of internal pull-up or pull-down resistors. Pins GPIO2 and GPIO3 have fixed pull-up resistors, but for other pins, this can be configured in the software.
  • Other functions of GPIO – Other than simple input and output devices, the GPIO pins can be used with a variety of alternative functions, some are available on all pins, others on specific pins.
    • PWM (Pulse Width Modulation)
      • Software PWM available on all pins
      • Hardware PWM available on GPIO12, GPIO13, GPIO18, GPIO19
    • SPI (Serial Peripheral Interface)
      • SPI0: MOSI (GPIO10); MISO (GPIO9); SCLK (GPIO11); CE0 (GPIO8), CE1 (GPIO7)
      • SPI1: MOSI (GPIO20); MISO (GPIO19); SCLK (GPIO21); CE0 (GPIO18); CE1 (GPIO17); CE2 (GPIO16)
    • I2C (Inter-Integrated Circuit)
      • Data: (GPIO2); Clock (GPIO3)
      • EEPROM Data: (GPIO0); EEPROM Clock (GPIO1)
    • Serial
      • TX (GPIO14); RX (GPIO15)

The same pinout can be obtained just by typing the below command in the terminal window (the shortcut for the terminal is Ctrl+Alt+T). Keep in mind that If I don’t mention where to enter the command it will be usually in the terminal window. You can also access this from the menu.

pinout

Note: 

  • The terminal is the place where you can enter some predefined commands and get output or reply for the same from the computer.

Connecting Raspberry Pi to a network

In order to connect the Raspberry pi to the internet, you can plug an ethernet cable directly to the Raspberry pi or you can use WiFi. WiFi icon is visible at the top right corner of Raspberry pi. You can select your network and enter the password. You are now good to go.

The first thing you have to do after connecting to the internet is to update all the files. Open the terminal and type the following command and hit enter. (Terminal can be opened by pressing Ctrl+Alt+T)

sudo apt-get update

Here sudo corresponds to ‘super user do’. This is like admin rights in Windows OS. Hence it will ask for the password. The default password is “raspberry” (unless you have changed it). This will update all the files of the OS.

You can also change the default/ configuration settings including the password by entering the following command.

sudo raspi-config

Applications of Raspberry Pi

Now that we know about Raspberry Pi and its basic hardware features, ever wondered where people have used these minicomputers… Here are a few examples.

  • IoT weather station- for sending the weather data over the internet
  • Pi satellite – Raspberry pi based satellite
  • Server- Raspberry pi based servers
  • Supercomputer – Cluster of raspberry pi doing complex tasks
  • Mining Rigs – Raspberry Pi based cryptocurrency mining rigs
  • Media Servers – for storing media content and provide them over the network
  • Robots – Raspberry Pi running ROS (Robot OS) in robots
SEE ALL Add a note
YOU
Add your Comment

We would love to see what you build out of these learnings!

Click here to submit your projects, share it with the world and stand a chance to be rewarded.

top

Knowledge and Content by Li2 Technologies | © 2021 NASSCOM Foundation | All rights reserved

X