Unit 4 - 1st Half
Unit 4 - 1st Half
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
C++ is a compiled language. (complied once Python is a interpreted language. (program complied
before execution) each time program runs)
Raspberry Pi:
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
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
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.
Specifications of ESP8266:
Introduction 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:
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
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.
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.