Unit V
Unit V
The Raspberry Pi can run an OS (Linux Distribution) and also consumes more power. Since
Arduino is microcontroller device it has no operating system and can only run a single
program or sketch.
Raspberry Pi also becomes a good choice for building IOT (Internet of Things) .
Introduction to Raspberry Pi 3.
● Raspberry Pi 3 Model B comes with 64 bit quad core processor, on board WiFi and
Bluetooth and USB features.
● It has a processing speed ranging from 700 MHz to 1.4 GHz where RAM memory
ranges from 256 to 1GB.
● The CPU of this device is considered as the brain of the device which is responsible
for executing numbers of instructions based on mathematical and logical operation.
● The GPU is another advanced chip incorporated in the board that carries out function
of image calculation. The board is equipped with Broadcam video core cable that is
mainly used for playing video games through the device.
● The Pi 3 comes with GPIO (General Purpose Input Output) pins that are essential to
maintain connection with other electronic devices. These input output pins receive
commands and work based on the programming of the device.
● The Ethernet port is incorporated on this device that sets a pathway for
communicating with other devices. You can connect Ethernet port to the router to
maintain a connection for internet.
● The Board has four USB ports that are used for communication and SD card is added
for storing the operating system.
● Power source connector is a basic part of the board that is used to provide 5 V power
to the board. You can use any source to set up a power for the board, however, it is
preferred you connect power cable through laptop USB port for providing 5 V.
● The Pi 3 supports two connection options including HDMI and composite. The
HDMI connector is used to connect LCD or TV, that can support 1.3 and 1.4 version
cables. Composite video connection is used to connect the older version of TV with
the device that uses the 3.5mm jack socket for the audio production.
● The new device comes with a video core multimedia 3D graphics which is capable of
playing 1080 MP video. This feature puts this advice ahead of its predecessors where
video quality was not that much upgraded.
● The USB hard drive incorporated on the board is used to boot the device, similar to
PC hard drive where windows is used to boot the computer hard drive.
●
Operating System:
Processor:
• The Raspberry Pi 3 uses a Broadcom BCM2837 SoC with a 1.2 GHz 64-bit
quad-core ARM Cortex-A53 processor, with 512 KB shared L2 cache
Performance:
● The Raspberry Pi 3, with a quad-core Cortex-A53 processor, is described as 10 times
the performance of a Raspberry Pi
● Raspberry Pi 3 to be approximately 80% faster than the Raspberry Pi 2 in parallelized
tasks.
Networking:
The Raspberry Pi 3 and Pi Zero W (wireless) are equipped with 2.4 GHz WiFi
802.11n (150 Mbit/s) and Bluetooth 4.1 (24 Mbit/s) based on Broadcom BCM43438
FullMAC chip with no official support for Monitor mode but implemented through unofficial
firmware patching and the Pi 3 also has a 10/100 Ethernet port.
Installing OS:
When the Raspberry Pi was first launched, use special image writing software to set
up an SD card. However, NOOBS changed all that—it’s as easy to install as copying files
onto the SD card and no special formatting is required.
When Raspberry Pi boots up into NOOBS it will offer a choice of operating system
Make sure that select the recommended option Raspbian. After a lot of file copying and a
reboot, Raspberry Pi will be ready to use.
At this point, have a USB WiFi adapter, configure it and join r wireless network using
the WiFi Config utility that will find under the Preferences section of the desktop menu.
Setting Up SSH
. SSH gives you command-line access to your Raspberry Pi over r network from a
second computer. This means that, once finished setting it up, the only things that need to be
plugged into Raspberry Pi are a power lead and either a network cable or USB WiFi adapter.
In the LXTerminal window that opens, type the following command (don’t include
the $—that’s the command-line prompt):
$ sudo raspi-config
SSH on a Windows Computer
If using Microsoft Windows, download and install Putty. The installation looks a little odd,
but actually, just download putty.exe, which is the program itself. just save it somewhere
and run it by doubleclicking it. This will open the PuTTY Configuration window
If using a Mac or a Linux computer, the software need to connect to Raspberry Pi is already
on computer
Open a terminal session and type the following command, substituting the IP address of your
Raspberry Pi in place of the IP address of my Raspberry Pi (192.168.1.23):
$ ssh 192.168.1.23 -l pi
Loading Process
● Kernel
● Services
● Login
Storage Information
Memory Available
Used 183
Free 743
Processor Information
● We can check to make sure the connection is successful by using this command
● ifconfig wlan0
● If the inet addr field has an address beside it, the Pi has connected to the network.
● Pi Users User management in Raspbian is done on the command line. The default
user is pi with the password raspberry. You can add users and change each user's
password.
Use passwd – this command will change your password. CAUTION, once changed
you will need to store it somewhere.
Procedure:
--You'll be prompted to enter your current password to authenticate, and then asked
for a new password. Hit Enter on completion and you'll be asked to confirm it.
--Note that no characters will be displayed while entering your password. Once you've
correctly confirmed, you'll be shown a success message (passwd: password updated
successfully) and the new password will be in effect immediately.
The default pi user on Raspbian is a sudoer. This gives the ability to run commands as
root when preceded by sudo, and to switch to the root user with sudo su.
User Profiles
● .bashrc
● .bashlogout
● .profile
● pistore.desktop
cp ( copy )
mv ( move)
~]$ mv file1 file2 --If file2 does not exist, then file1 is renamed file2.
chown ( change ownership )-- Change the owner of a file by using the chown command.
mkdir ( make directory )-- The mkdir command is used to create directories.
The command will receive input from file1 and output will be written to file2
Common filters
sort: Sorts standard input then outputs the sorted result on standard output.
grep: Examines each line of data it receives from standard input and outputs every
line that contains a specified pattern of characters
Linux on Raspberry pi
• Raspbian
• Raspbian Linux is a Debian Wheezy port optimized for Raspberry Pi.
• Arch
• Arch is an Arch Linux port for AMD devices.
• Pidora
• Pidora Linux is a Fedora Linux optimized for Raspberry Pi.
• RaspBMC
• RaspBMC is an XBMC media-center distribution for Raspberry Pi.
• OpenELEC
• OpenELEC is a fast and user-friendly XBMC media-center distribution.
• RISC OS
• RISC OS is a very fast and compact operating system.
Execution Mode
There are two ways to run a program using the Python interpreter:
a) Interactive mode and b) Script mode
(A) Interactive Mode
In the interactive mode, we can type a Python statement on the >>> prompt directly. As soon
as we press enter, the interpreter executes the statement and displays the result(s)
Python IDLE :
A push button is an input component that you can add to the Raspberry Pi GPIO pins. It will
complete a circuit when the button is pressed
● Every object whose temperature is above absolute zero emits infrared (IR) radiation.
The sensor measures the IR signature of the room it’s in, and then watches for any
changes. Any object moving through the room will disturb the IR signature, and will
cause a change to be noticed by the PIR module.
● An air quality sensor is used to determine air quality by detecting polluting gases.
When air enters the sensor, it is energised by a small heater which allows its electrical
resistance to be measured.
The Sense HAT board for the Raspberry Pi has the ability to sense a wide variety of
conditions and provide output via the built-in LED matrix.
Explorer HAT
The main principle in controlling a DC Motor with Raspberry Pi lies with the Motor
Driver.
● A Motor Driver is a special circuit or IC that provides the necessary power (or
rather the current) to the motor for smooth and safe operation.
● Even a small 5V DC Motor draws a high initial current of around 300 – 400
mA. This current will then fall down 150 – 200 mA as the motor gains speed
to around.
● This is a huge current for devices like Microcontrollers, Arduino, Raspberry
Pi etc. Hence, we should never connect a motor directly to Raspberry Pi (or
any other microcontroller).
● Motor Driver play an important role in this situation. They take the control
signals from Raspberry Pi and provide the necessary drive current to the
motor from the power supply.
● , the motor driver (L293D) is given with two control signals from Raspberry
Pi through GPIO Pins. As per the Python Program, the motor will rotate in
either forward or reverse direction.