0% found this document useful (0 votes)
12 views16 pages

Unit 4 - 1st Half

Uploaded by

sekarsekar59368
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views16 pages

Unit 4 - 1st Half

Uploaded by

sekarsekar59368
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Python:

Python is more than just an excellent programming language for beginners. It's one of
the most popular programming languages worldwide because it’s versatile and efficient. This
high-level language combines built-in data structures with dynamic binding and typing to
create a powerful language that can allow you to write code faster than you imagined possible.

Advantages

Python offers several key benefits that make it a viable option for anyone wanting to learn a
programming language. These advantages include the following characteristics:

 Easy to comprehend: Python reads like English, making it easy for new users to pick
up and write code.

 Simple to debug: Python executes code line by line as an interpreted language and
stops running as soon as an error appears. You will spend less time tracking down and
correcting errors in the code.

 Free and open-source: You can use and distribute your version of Python.

 Library support: The extensive Python library reduces your dependence on external
libraries. If you need to import a package from another library, you have more than
hundreds of thousands of third-party Python libraries to choose from as you write code.

 Portability: The code you write in Python will work on other machines or operating
systems.

Disadvantages

Python is popular, but it has its negatives, like other languages. It won't work for all
applications, and it has other drawbacks listed below:

 Execution speed: Python executes code line by line, which can slow the process. When
speed matters, Python may not be the best programming language.

 Memory usage: Python requires a considerable amount of memory, which can limit its
use for particular projects.

 Usability in mobile computing: Python can take too much memory to make it usable
for mobile devices.

 Database access: The Python database must be more developed than similar
technologies and can be cumbersome.

C++ :
Released in 1985, C++ has been around longer than Python. Despite its age, it remains one of
the most efficient programmming language.

Advantages:
 So many developers use C++ because of its portability and speed. More
advantages of this language include:
 Portability: C++ codes you write on one platform can quickly transfer to
other platforms without producing an error.
 Speed: As a compiler-based language, C++ is faster than Python. The
same code running in both programs simultaneously will generate in C++
first.
 Mid-level language characteristics: C++ is a mid-level language, which
allows the developer to use it as both a low-level and high-level language.
 Memory management: C++ does not support garbage collection, so the
developer controls the memory.
 Similarity to other programming languages: If you also know C, C#, or
Java, you may find it easier to learn C++.
 Extensive community of users: C++ is such a popular program that
you'll find a vast network of support to help you solve problems with your
code.

Disadvantages:

 Memory management: Since the user has complete control over the
memory, there's a risk of storing redundant data that increases the
memory used.
 Flexibility: C++ can feel less flexible because of its strict syntax. Minor
errors lead to a series of errors that take time to correct.
 Functions: C++ lacks first-class type functions like passing and
returning values without restrictions and creating functions without
restrictions.
 Complexity: As a multi-paradigm language, C++ is useless for platform-
dependent apps.

C++ Python

Python was created by Guido van Rossum, and released


C++ was developed by Bjarne Stroustrup in 1979.
in 1991.

C++ code is less complex than C but more comple


Easier to write code.
x in contrast to python.
Longer lines of code as compared to python. 3-5 times shorter than equivalent C/C++ programs.

Variables are declared in C++ Python has no declaration.

C++ is a compiled language. (complied once Python is a interpreted language. (program complied
before execution) each time program runs)

C++ contains 52 keywords. Python contains 33 keywords.

Raspberry Pi:

Raspberry Pi is a small-sized computer used Linux operating system. It is mini


size computer used mostly to run larger and smart programs to achieve output quickly.

Raspberry Pi 4 B+ (RP4) is the lasted model developed by the company, which


has all the required latest wired and wireless communications systems used in most of
the smart projects.
A single Raspberry Pi 4 comes to a Quad-Core processor but it has three
different versions which give three different sizes of RAM. Pi 4 uses mini HDMI and it
also has two ports for two 4K displays.
Features of Raspberry Pi:
The development of the Raspberry Pi comes in several variations and models,
such as the Raspberry Pi 1, Raspberry Pi 2, and Raspberry Pi 3. All these have different
features, and this article explains the features of the Raspberry Pi 3.
Wireless Radio
The Raspberry Pi contains a wireless radio that we can only see with a
microscope. It is actually a Broadcom BCM 43438 chip that provides 2.4 GHz 802.11 n
wireless LAN, low-energy Bluetooth, and 4.1 classic radio support. It is directly built
into the Raspberry Pi board, reducing its cost.
Antenna
It consists of an antenna; therefore, there is no need to connect the external
antenna to the Raspberry Pi 3. The radio directly connects to this chip antenna,
soldering it directly to reduce its size.
SOC (System on Chip)
This Raspberry Pi also has a Broadcom BCM 2837 system on-chip with high-
performance ARM Cortex-A53 processing cores. These run at 1.2 GHz with 32 KB of
level 1 and 512 KB of level 2 memory. It also consists of an IV graphic processor, which
has 1 GB of memory to read the board.
GPIO (General Purposes Input Output)
It consists of 40 general-purpose input and output header pins for controlling the
internal and external hardware processing systems.
USP CHIP
It also consists of a USB port for USB interfacing. This provides connections with
various other devices for reading data.

Raspberry Pi Pin Configuration:


The Raspberry Pi 4 can be used in the external embedded system to
communicate. It has a total of 40 pins from which 28 are GPIO pins and the rest of
them are power pins. GPIO pins don’t only perform the simple I/O functions. They
could give the UART, SPI, and I2C communications. These communications are specific
to every pin.

Power Supply Pins

Power In: In Raspberry pi, there is two power in method, one is from the USB-C power
port and the second one is from any 5V pin. The 5-volt pin is directly connected to the
USB-C adapter port. The input on the 5V pin should be stable and according to its
specifications. In the case of higher voltage, the device could get burned. 5V input pins
will bypass any fuse and regulator in case of power input, so the power supply from 5V
should according to its specification to avoid any kind of harm. The power input pin of
the Raspberry Pi 4 is given below:
 Pin2-6 —> +5V
 Pin6 —–> GND
Power Out: There are two types of power output pin in the Raspberry pi 4 3V3 and 5V.
5V is directly connected to the USB port but 3V3 is connected to through the regulator
which gives the stable 3 volts output. All power out pins are given below:
 3V3 – Pin1, Pin17
 5V – Pin2, Pin6

Ground: Raspberry Pi 4 has multiple ground pin which is connected internally and
any ground pin can be used by the power supply or external device to make the
common ground. The list of the ground pins is given below:
 Pin6
 Pin9
 Pin14
 Pin20
 Pin25
 Pin30
 Pin34
 Pin39

Digital Input/Output Pins


Almost every device needs to input and output pins to communicate. In this device
there are 28 GPIO pins are available these pins can be used for any digital input and
output operating. The GPIO pins in the controller have some default values. GPIO pins
from 0-9 will be at a HIGH state and from 10 to above the pins will be at a LOW state.
All those pins in the Raspberry Pi 4 are given below:
 GPIO0 – Pin27
 GPIO1 – Pin28
 GPIO2 – Pin3
 GPIO3 – Pin5
 GPIO4 – Pin7
 GPIO5 – Pin29
 GPIO6 – Pin31
 GPIO7 – Pin26
 GPIO8 – Pin24
 GPIO9 – Pin21
 GPIO10 – Pin19
 GPIO11 – Pin23
 GPIO12 – Pin32
 GPIO13 – Pin33
 GPIO14 – Pin8
 GPIO15 – Pin10
 GPIO16 – Pin36
 GPIO17 – Pin11
 GPIO18 – Pin12
 GPIO19 – Pin35
 GPIO20 – Pin38
 GPIO21 – Pin40
 GPIO22 – Pin15
 GPIO23 – Pin16
 GPIO24 – Pin18
 GPIO25 – Pin22
 GPIO26 – Pin37
 GPIO27 – Pin13
All GPIO pins in Raspberry Pi 4 are not only for input-output function. Each GPIO pin
can be used as other functions, which will be specified through programming.

Raspberry Pi Serial Communication Modules:


Raspberry Pi UART Pins
There are multiple kinds of serial communication and UART is one of them. It is quite
popular because of its simple communication system and dependence on most of the
software. There is multiple UART communication pin in the Raspberry pi 4 and all of
them are given below:
 TXD1 – GPIO14 – Pin8
 RXD1 – GPIO15 – Pin10
 TXD2 – GPIO0 – Pin27
 RXD2 – GPIO1 – Pin28
 TXD3 – GPIO5 – Pin29
 RXD3 – GPIO4 – Pin7
 TXD4 – GPIO8 – Pin24
 RXD4 – GPIO9 – Pin21
 TXD5 – GPIO12 – Pin32
 RXD5 – GPIO13 – Pin33
SPI Communication Pins
Some devices use SPI protocol and it could help the controlling device to control
multiple devices using single data transmissions wire. In Raspberry pi 4 there are
multiple SPI pins that can be used for SPI communication. The SPI pin of Raspberry Pi
4 is given below:
 SPI3 CEO N – GPIO0 – Pin27
 SPI3 MISO – GPIO1 – Pin28
 SPI3 MOSI – GPIO2 – Pin3
 SPI3 SCLK – GPIO3 – Pin5
 SPI4 CEO N – GPIO4 – Pin7
 SPI4 MISO – GPIO5 – Pin29
 SPI4 MOSI – GPIO6 – Pin31
 SPI4 SCLK – GPIO7 – Pin26
 SPI0 CE1 N – GPIO8 – Pin24
 SPI0 CE0 N – GPIO9 – Pin21
 SPI0 MISO – GPIO10 – Pin19
 SPI0 MOSI – GPIO11 – Pin23
 SPI5 CEO N/ SPI0 SCLK – GPIO12 – Pin32
 SPI5 MISO – GPIO13 – Pin33
 SPI5 MOSI – GPIO14 – Pin8
 SPI5 SCLK – GPIO15 – Pin10
 CTS0 – GPIO16 – Pin36
 RTS0 – GPIO17 – Pin11
 SPI6 CEO N – GPIO18 – Pin12
 SPI6 MISO – GPIO19 – Pin35
 SPI6 MOSI – GPIO20 – Pin38
 SPI6 SCLK – GPIO21 – Pin40
I C Communication Pins
2

Raspberry Pi 4 also supports the I2C protocol. It is a type of serial communication used
by some sensors and motors to communicate. In Pi GPIO pins also gives I2C support.
All these pins are given below:
 SDA0/SDA6 – GPIO0 – Pin27
 SCL0/SCL6 – GPIO1 – Pin28
 SDA1/SDA3 – GPIO2 – Pin3
 SCL1/SCL3 – GPIO3 – Pin5
 SDA3 – GPIO4 – Pin7
 SCL3 – GPIO5 – Pin29
 SDA4 – GPIO6 – Pin31
 SCL4 – GPIO7 – Pin26
 SDA4 – GPIO8 – Pin24
 SCL4 – GPIO9 – Pin21
 SDA5 – GPIO10 – Pin19
 SCL5 – GPIO11 – Pin23
 SDA5 – GPIO12 – Pin32
 SCL5 – GPIO13 – Pin33
 SDA6 – GPIO22 – Pin15
 SCL6 – GPIO23 – Pin16
RPi PWM GPIO Pins
To generate the desired pulse output signal Raspberry Pi 4 has some PWM pins. Those
pins can be used directly with any low voltage external device to get that signal. To
generate signal first the pins should get the instructions first. All PWM pins are given
below:
 PWM0 – GPIO12 – Pin32
 PWM1 – GPIO13 – Pin33
 PWM0 – GPIO18 – Pin12
 PWM1 – GPIO19 – Pin35
Raspberry Pi SDIO Pins
In Raspberry Pi 4 there is a slot for SD card but GPIO Pins also support the SD card
compatibility. SDIO pins on the device can be used for SD card in case of requirement:
 SD0CLK/SD1 CLK – GPIO22 – Pin15
 SD0 CMD/SD1 CMD – GPIO23 – Pin16
 SD0 DATA0/SD1 DAT0 – GPIO24 – Pin18
 SD0 DAT1/SD1 DAT1 – GPIO25 – Pin22
 SD1 DAT2/SD1 DAT2 – GPIO26 – Pin37
 SD0 DAT3/SD1 DAT3 – GPIO27 – Pin13

Raspberri Pi other Main Peripherals:

 USB: There are four USB ports in Raspberry Pi 4. Two ports have 2.0 support
only but the remaining two are 3.0. These 3.0 support givens users to transfer
data quickly.
 PoE Header: Due to increase the usage of Raspberry Pi in IoT and other smart
projects the PoE Header has also come within the Pi. The one board PoE allows
the users to pass the power to the device through Ethernet Wire. In the case of
PoE, an external PoE HAT will be required.
 Camera: The device has camera support. It has a two-lane MIPI CSI camera port
which can be used to connect the pi directly with the cameras and use them
without any third interface.
 Display: The Raspberry Pi 4 can be connected to an external LCD. It doesn’t use
the expansion header to communicate with LCDs like other devices. It has a
separate 2 lane MIPI DSI port which can be used to communicate with external
compatible LCD.
 Audio: The audio data can be travel from pi to the display device through HDMI
but it has a separate 4 pole audio port that can be used to send and receive an
audio signal. The signal from the device can be used by the internal program or
any other device at the expansion header.
 SD CARD: It is the most required part of the Raspberry Pi. The OS of the Pi will
be placed within the SD card and then the card will be used through the SD Card
slot.

Applications of Raspberry Pi:

1. Raspberry Pi is actually the heart of different projects. It is usually useful in


gadget shows for stratus projects.
2. Its uses include virtual desktops for providing graphical interfaces to desktops in
robotic projects.
3. The Raspberry Pi Zero is so small, and it can fit anywhere.
4. WhatsApp is the most popular open-source platform, with over 600 million users.
Through the Raspberry Pi, we can now send the message.
5. Currently, digital picture frames are becoming more common, but there are so
many ways to customize them. Through the Raspberry Pi, we can also customize
the digital picture.
ESP3266 WiFi Module:

Esp8266 is based around Tensilica’s L106 Diamond series which is 32-bit


processor and have on-chip SRAM. Also integrates power modules, RF balun, RF
receiver and transmitter, analog receiver and transmitter, digital baseband, amplifier,
filters, and some other minimal components.

Specifications of ESP8266:

Esp8266 specification divides into three parts:


 Hardware,
 Software, and
 Wi-Fi.
 In hardware specification, its package size is QFN 32pins with a dimension of 5mm
x 5mm.
 Operating voltages range from 2.5V to 3.6V. The chip consumes 80mA of current on
average.
 Its CPU is Tensilica L106 which is a 32bit processor with on-chip SRAM.
 The peripheral interface contains UART, SDIO, SPI, I2C, I2S, IR remote control,
GIPO’s, ADC, PWM, LED Light and button.
 Its firmware can be updated using OTA and UART. It uses IPv4, TCP, UDP, and
HTTP as network protocols. User can configure using AT commands set, Cloud
Server and using a mobile application.
 Wi-Fi frequency ranges from 2.4G to 2.5G. It uses standard Wi-Fi protocol IEEE
802.11 b/g/n. Esp6266 Wi-Fi capabilities are certified by Wi-Fi Alliance.
All GPIO’s can be used as Input and Output pin but they also have their specific
function. ESP8266 schematics include the following components:
 Power supply
 Power-on sequence and reset
 Flash
 Crystal oscillator
 RF
 External resistor
 UART

Introduction of Arduino:

Arduino is a microcontroller-based open-source development board with


applications in electronics projects.
Its use is very easy, as are its software and hardware concerns. The Arduino
boards can easily read the data inputs, sense the light on the sensor, and turn it into
an output for driving the motors, publishing something online, turning on the LED
lights, etc.
If we want to tell the board anything, we just send a set of instructions to the
microcontroller.
For processing, we use the Arduino programming language and Arduino software.
It consists of an Atmel 8, 16, or 32-bit AVR microcontroller with all the necessary
components that provide the facility to interact with other circuits.
History of Arduino:

Firstly, the Arduino was introduced in 2005 by the design institute in Ivrea, Italy.
Its main purpose or goal was to provide an easy and low-cost way for new people to
create devices that interact with their sensors and actuators.
Examples of such devices are thermostats, robots, and motion detectors for
beginners. At the beginning, this was the hardware thesis of a Colombian student
named Hernando Barragan, and the title of this thesis was “Arduino—La rivoluzione
dell”.
So, a team of five people worked on this thesis and created a new platform. Thus,
they made it lighter, less expensive, and open source for the learning community.

Features of Arduino:
Here are some key features of Arduino Uno.
1. Arduino is an open-source design, so a large community of people can easily find
and use it in their projects for troubleshooting and debugging purposes.
2. Arduino has a USB interface chip, and this USB chip can connect with our
computer’s USB port to make a virtual serial port. This will allow us to use it as a
serial device. Through this setup, serial communication has become extremely
easy.
3. Arduino has good power management and voltage regulation. If we provide it with
a 12 V supply from an external source, it can easily regulate the 12 V into 5 V
and 3.3 V. We can also power it through the USB port without any external
source.
4. Arduino has a cheap microcontroller that we can easily find. It has a countless
number of hardware features, such as a timer, PWM pins, multiple sleep modes,
external and internal interrupts, etc.
5. It has a 16 MHz clock, and this makes the microcontroller the fastest in so many
applications.
6. For storing our code, it has 32 KB of flash memory.
7. It has 6 analogs and 32 digital pins for connecting the external hardware with
our Arduino. These pins are key to increasing the computing capabilities of the
Arduino in the real world.
8. It has an ICSP connector for bypassing the USB port and interfacing the Arduino
directly as a serial device.
9. LEDs can connect at digital pin 13 for fast and easy debugging of the code.
10. It has a reset pin on the chip to reset the program.

Applications of Arduino:

1. Arduino is useful in so many standalone interactive projects, such as robotics, or


it can connect with the software on our computer.
2. Arduino has uses in the development of home automation systems such as
Bluetooth, through which we can remotely control and operate an Arduino using
our smart phone. With the smart phone, we remotely control switches that
directly connect to the home appliances via an Arduino board.
3. In street lights, high-intensity discharge lamps (HID) are used, and power saving
is not possible because the light density required on roads changes from time to
time. The light density of these lamps is controlled through an Arduino board by
changing the voltage of these LED lights throughout to save power.
4. Arduinos are useful for controlling the temperature by connecting the
temperature sensor to the Arduino board.
5. It can be used in a solar panel charge controller for maximum power point
tracking.
General-Purpose Operating Systems:

Operating systems in this class are not optimized for a particular purpose but are
rather created to serve the average computer user’s needs, which typically includes
internet browsing, basic productivity tasks, media consumption, and light gaming.
1. Raspberry Pi OS

 Based on Debian Linux, the Raspberry Pi OS (formerly Raspbian) is the official


operating system for the Raspberry Pi family. It is available for free download and
comes preloaded on a microSD card in most Raspberry Pi kits. According to
Raspberry Pi’s Imager stats website, Raspberry Pi OS is the most-used operating
system on the Raspberry Pi by far, followed by Ubuntu.
 It comes in both 32-bit and 64-bit versions. There are only subtle differences, but
the 64-bit Raspberry Pi OS offers certain key benefits.
 Raspberry Pi OS uses a modified version of the Lightweight X11 Desktop
Environment (LXDE), which is simple to navigate. It also comes with over 35,000
pre-compiled software packages for easy installation on your Raspberry Pi.

2. Ubuntu MATE

 Ubuntu MATE is an official derivative of Ubuntu Linux that uses the lightweight
MATE desktop environment as its default user interface, which means it’s less
taxing on the Raspberry Pi’s modest resources than vanilla Ubuntu.
 Ubuntu MATE is more suited for users who already have a Linux background and
are looking for something a bit closer to that experience on Raspberry Pi.
 It offers a complete desktop environment for desktop computing and hardware
tinkering.
 Alternatively, you can opt for the standard version of the Ubuntu Desktop OS. Our
guide walks you through the process of installing Ubuntu Desktop, Server, and
Core on a Raspberry Pi, along with Ubuntu MATE.
Media Center Operating systems:

Raspberry Pi computers are often used as media centers to serve videos, music, and
images to other devices. A media center operating system makes it much easier to
organize those files and share them to connected users.

3. LibreELEC
LibreELEC is a Linux JeOS (Just enough Operating System) for the Kodi media player.
It is a fork of the now-discontinued OpenELEC project and comes with a preconfigured
version of Kodi and several other optional third-party, personal video recorder (PVR)
back-end software applications.
The LibreELEC operating system is small, lightweight and optimized for flash-based
storage. If you want to run only Kodi on your Raspberry Pi, it is arguably the best
option for you.

4. OSMC

OSMC (Open Source Media Center) is a Debian-based media center which mainly ships
a Kodi front-end for Raspberry Pis and other devices. It is easy to use, quick to install
and offers more functionality than LibreELEC. If you want to use your Raspberry Pi for
a home theater PC primarily, but you also want to run other projects from time to time,
OSMC might be the best choice for you.
Internet of Things and Home Automation:
A Raspberry Pi can be used to control a network of internet-enabled devices with
the help of home automation platforms such as Home Assistant.

5. Home Assistant OS

The Home Assistant OS (HAOS) is free and open source software that is optimized to
run Home Assistant and its add-ons on SBCs and x86-64 systems. Home Assistant
puts you in charge of your smart home network by enabling local access to your devices.

6. OpenHABian
OpenHAB (Open Home Automation Bus) is an open-source platform for home
automation. It allows you to control your smart home devices, regardless of the
manufacturer. To use it on a Raspberry Pi, download the preconfigured image and flash
it onto an microSD card or a USB flash drive.

Retro Operating Systems


You can also run classic operating systems such as RISC OS, MS DOS, and Amiga on a
Raspberry Pi, which can be useful for emulation and education purposes.

7. RISC OS
RISC OS was first developed in the 1980s and harkens back to the days of Acorn's
Archimedes and A7000 personal computers. Named after the Reduced Instruction Set
Computer (RISC) architecture, RISC OS was the first operating system for ARM-based
computers.
It is now open source and is available for download on just about every Raspberry Pi
model. It is not the most advanced operating system out there, but it could be a way to
get into the nostalgia of retro computing and contribute to a growing community of
users.

Specialized Projects
Raspberry Pi computers can also be used for specialized projects such as retro gaming,
3D printing, or penetration testing.
8. RetroPie

RetroPie is an open-source collection of software that allows you to emulate retro games
on your Raspberry Pi. It is built on top of Raspberry Pi OS Lite and several emulators
such as EmulationStation and RetroArch. Be sure to take a look at our how-to guide on
building a retro gaming console using RetroPie.
9. OctoPi

OctoPrint is an application that allows you to remotely monitor and control your 3D
printer. An OctoPrint server can be run on an old smartphone or a Raspberry Pi, to
name a few. All you need to do is flash the Octopie image on your Raspberry Pi and
connect it to your 3D printer.

Server and Network Applications


If you are interested in building a file server or a network attached storage on your
Raspberry Pi. you should consider installing an operating system well-suited for that
purpose.
10. OpenMediaVault
OpenMediaVault is based on Debian Linux and includes certain key features such as
web-based administration, email statistic reports, user and group management, and a
plug-in system. It offers a simple and easy-to-use interface that allows you to create a
file server without hassle. Installing OpenMediaVault on a Raspberry Pi is quite
straightforward.
11. DietPi
DietPi is an extremely lightweight Debian-based Linux distribution, even smaller than
Raspberry Pi OS Lite and much more configurable. DietPi is optimized for minimal
resource usage and is well-suited for self-hosting projects.

You might also like