Venky Idr Final

Download as pdf or txt
Download as pdf or txt
You are on page 1of 77

STATE BOARD OF TECHNICAL EDUCATION AND

TRAINING
ANDHRA PRADESH

INDUSTRIAL TRAINING ON
CENTRAL INSTITUTE OF TOOL DESIGN MSME,TOOLROOM
VIJAYAWADA
SUBMITTED TO
State Board Of Technical Education And Training, AP
In Partial Fullfillment For The Award Of the Degree Of
DIPLOMA
In
ELECTRONICS AND COMMUNICATION ENGINEERING
SUBMITTED BY
JAVVADI SAI VENKATESH
(22351-EC-021)
Under esteemed Guidance of
Sri. T.NARENDRA KUMAR, M.Tech,M.I.S.T.E
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

ELECRTRONICS AND COMMUNICATION ENGINEERING


ELECTRONIC COMPONENTS

AND
INTERFACING MODULES

INDUSTRIAL TRAINING

Submitted by
JAVVADI SAI VENKATESH (22351-EC-021)
IN PARTIAL FULFILLMENT FOR THE AWARD OF DIPLOMA IN

ELECTRONICS AND COMMUNICATION ENGINEERING

DEPARTMENT

UNDER THE GUIDENCE OF

Mr. G. RATNA PRAKASH (B.Tech)


FACULTY OF ESDM

&
Miss. G. MARY EVANGELIN (B.Tech)
FACULTY OF ESDM

CENTRAL INSTITUTE OF TOOL DESIGN


(A Government of India Society – Ministry of MSME)
Sub Centre–AutoNagar–Vijayawada–520007.

NOVEMBER 2024

I
ELECRTRONICS AND COMMUNICATION ENGINEERING
DVR & DR.HS MIC COLLGE OF TECHNOLOGY, KANCHIKACHERLA

BONAFIDE CERTIFICATE

This is to Certified that the training report “CENTRAL INSTITUTE OF TOOL

DESIGN,MSME,TOOLROOM,VIJAYAWADA” Completed 6 months (20/05/2023-

20/11/2024) Industrial training is the Bonafide work of “JAVVADI SAI VENKATESH”

and Pin No: 22351-EC-021 submitted in partial fulfillment of the requirements for the

award of the Diploma in Electronics And Communication Engineering from SBTET, AP.

Signature of the Industrial Director Signature of Industrial Training Guide

S. VENKATA KRISHNA T. NARENDRA KUMAR,M.Tech,M.I.S.T.E


Deputy Director (Trg./APCU) Head Of The Section

Signature of the Principal


Dr.G.RAJESH,Mtech.,ph.D

II
ELECRTRONICS AND COMMUNICATION ENGINEERING
ACKNOWLEDGEMENTS

During the industrial training, we learnt a lot from different experts in the field
of Electrical & Electronic Components and Interfacing Modules. We have
referred to the current research papers in the subject of “Electrical and
electronics” and various other related papers. Also, we honor the suggestions
given by our faculty and friends.

We express our profound regards and extend our gratitude to our Sri.
S.VENKATA KRISHNA Deputy director (Trg./APCU) and giving their
valuable suggestions and guidance in completing this industrial training.

Finally, we also express our thanks to the management and faculty members of
VLSI and Embedded system, CENTRAL INSTITUTE OF TOOL DESIGN
and our family members for providing financial and moral support.

We wish to express our warm and sincere thanks to our Faculties Mr. G. RATNA
PRAKASH and Miss. G. MARY EVANGELIN for their valuable suggestions

and guidance completing this project.

We wish to express our warm and sincere thanks to Our Principal


Dr.G.RAJESH and Our HOD Sri. T. NARENDRA KUMAR for their valuable
suggestions and guidance in completing this project.

-JAVVADI SAI VENKATESH


22351-EC-021

III
ELECRTRONICS AND COMMUNICATION ENGINEERING
ABSTRACT

In this course contains so many novel technologies in real time world. Based on
electrical and electronic system which includes basics, implementation methods
and industrial management methods, it also includes requirements of the
domestic peoples, services, government schemes to implement in easiest way
with less economical aspect. It gives knowledge on electrical and electronic
system automation/digital/smart/virtual by the different methods of Analysis,
Design, Implementations, Coding and Testing Electrical and Electronic
Devices Handson Practice. In this course includes so many different methods
and usage of hardware like elements and components, digital ICs like 8086,
8051, Arm7, IOT, Arduino, Raspberry pi with different input and output
modules, processing modules, storage modules and communication protocols
used in real time applications. This learns all the above topics by using
computer-based software tools like Keil, C, Proteus 8 professional, Turbo C,
Arduino tool, Auto tinkering card and operating systems. By using the above
tools, we design different projects /experiments / modules based on hardware
components and usage of different software languages like assembly language,
embedded c language, C language and Arduino C language etc. We have done
many real time projects like traffic lights, digital clock, visitor counter, ATM
running machine, shopping complex display machine and SMS based energy
meter operation using simulation tools and hardware tools, based on hands on
practice. We concluded that Industrial training is merged a great knowledge in
academics with learning and earning to furnish the bright future during the
employ ability and to establish a new firm/entrepreneurship to create the jobs
based on new innovative real time projects in the subject of electrical and
electronics engineering.

IV
ELECRTRONICS AND COMMUNICATION ENGINEERING
CONTENTS
Chapter -1:
BASIC ELECTRICAL COMPONENTS
1.1 Resistor..........................................................................................................1
1.2 Inductor......................................................................................................... 2
1.3 Capacitor....................................................................................................... 2
1.4 Diode............................................................................................................. 2
1.5 Transistor.......................................................................................................3
1.6 Transformer................................................................................................... 5
1.7 LED............................................................................................................... 5
1.8 Protective Switch...........................................................................................5
1.9 Seven Segment Display.................................................................................6
1.10 Stepper Motor............................................................................................... 6
1.11 Keypad.......................................................................................................... 6
1.12 Buzzer........................................................................................................... 6
1.13 555 IC........................................................................................................... 7
1.14 Regulated Power Supply.............................................................................. 7

Chapter -2:
DC THEOREM’S
2.1 KVL (Kirchhoff's Voltage Law)..................................................................... 8
2.2 KCL (Kirchhoff's Current Law)....................................................................... 9
2.3 Thevenin’s Theorem......................................................................................9
2.4 Norton’s Theorem........................................................................................ 11
2.5 Reciprocity Theorem....................................................................................12
2.6 Super Position Theorem............................................................................... 13
2.7 Maximum Power Transfer Theorem............................................................ 14

Chapter -3:
DIGITAL IC’s
3.1 Introduction of MICROPROCESSER (8086)........................................... 15
3.1.1 Architecture Description............................................................................ 15
3.1.2 Features of 8086......................................................................................... 15
3.1.3 Description of 8086.................................................................................... 15
3.2 Introduction of MICROCONTROLLER (8051)....................................... 16
3.2.1 Features of 8051......................................................................................... 16
3.2.2 Pin Description of 8051..............................................................................17
3.2.3 Registers in 8051........................................................................................ 18
3.2.4 Operations of Modes.................................................................................. 20
3.2.5 Addressing Modes of 8051.........................................................................20
3.2.6 Instruction set of 8051................................................................................ 20

V
ELECRTRONICS AND COMMUNICATION ENGINEERING
3.3 Instruction to ARM Architecture................................................................21
3.4 Introduction of ARDUINO........................................................................ 22
3.5 Microcontroller Programs.......................................................................... 23

Chapter -4:
C-PROGRAM
4.1 Introduction....................................................................................................... 37
4.2 Why Should We Learn C?................................................................................ 37
4.3 Structure of the C program...............................................................................37
4.4 Components of a C Program............................................................................ 37
4.5 Keywords of C................................................................................................. 38
4.6 Preprocessor directives of C............................................................................. 38

Chapter-5:
ARDUINO
5.1 Introduction......................................................................................................43
5.2 Types of Arduino Boards.................................................................................43
5.3 Arduino Uno.................................................................................................... 43
5.4 Arduino Power Supply.....................................................................................44
5.5 Software........................................................................................................... 44
5.6 Programming................................................................................................... 46

Chapter-6:

PYTHON

6.1 Introduction......................................................................................................50
6.2 Control Flows And Loops................................................................................ 51
6.3 Functions And Arrays...................................................................................... 52
6.4 Lists,Tuples And Dictionaries......................................................................... 53
6.5 Files Exceptions , Modules And Packages....................................................... 55

Chapter-7:

INTERNET OF THINGS

7.1 Introduction........................................................................................................56
7.2 History Of IOT....................................................................................................57
7.3 Cloud..................................................................................................................58
7.4 Sensors..............................................................................................................59
7.5 Actuator..............................................................................................................59
. 7.6 Wireless Technology........................................................................................60

VI
ELECRTRONICS AND COMMUNICATION ENGINEERING
7.7 Data Managment And Analytics..................................................................... 60
7.8 IOT Platforms And Tools................................................................................ 61

Chapter-8:

RASPBERRY PI
8.1 Introduction.....................................................................................................62
8.2 Raspberry Pi Applications.............................................................................. 63
8.3 Types Of Raspberry Pi................................................................................... 64
8.4 Setting Up Your Raspberry Pi........................................................................ 65
8.5 Software...........................................................................................................65

CONCLUSION............................................................................................. 66

FUTURE SCOPE......................................................................................... 67

VII
ELECRTRONICS AND COMMUNICATION ENGINEERING
CHAPTER -1
BASIC ELECTRICAL COMPONENTS

1.0 INTRODUCTION:
A system is an arrangement of electronic components of both active and passive
in which all its units assemble and work together according to the plan or program in electronic
and electrical circuits. So, the passive components are like resistor, inductor, capacitor and
active components are like diode, transistor, Thyristor, small IC’s, large IC etc. with different
input and output loads.

1.1 RESISTOR:
The device which opposes the flow of current in ac and dc electrical
circuits. It is denoted as R. The symbol of resistor and its color band is

Fig 1.1(a) Resistor Color Band Fig 1.1(b) Resistor Symbol

1) The 4th band indicates tolerance. 2) The 3rd band indicates multiplier.

3) The 2nd band indicates the first digit. 4) The 1st band indicate second digit

Resistor Color Coding:


Color No Color No Color No Color No
Black 0 Orange 3 Blue 5 White 9
Brown 1 Yellow 4 Violet 6 Gold ±5%
Red 2 Green 5 Grey 7 Sliver ±10%
Table 1.1 Color Coding of Resistor

Types of Resistors:
A) Fixed Resistor B). Variable Resistors
1). Carbon Composition Resistors 1). Potentiometer
2). Carbon film Resistors 2). Wire wound Resistors.
3). Metal film Resistors. 3). Rheostat

1
ELECTRONICS& COMMUNICATION ENGINEERING
1.2 INDUCTOR:
An inductor is a device which can store magnetic energy based on faraday’s laws
of electromagnetic induction. It is denoted by letter L, and its units are Henrys.
• Inductor easily passes DC (constant) signals.
• Inductors blocks AC (changing) signals.
The symbol of Inductor is:

Fig 1.2 Inductor

Applications:
Tuning circuits, sensors, filters, chokes, transformers, relays....

1.3 CAPACITOR:
Capacitors are passive elements which can be able to store electric energy. It is denoted
by letter C, and its units are Faradays.
The symbol of Capacitor is:

Fig 1.3 Capacitor

• capacitor block DC (constant) signals and easily pass AC (changing) signals.


Applications:
Power conditioning, oscillators, Power factor correction.

1.4 DIODE:
A Diode is a semiconductor device that conducts electric current only in one direction. It
has two terminals, an anode and cathode. These are mostly used in converting AC to DC
circuits.
The symbol of Diode is:

Fig 1.4 Diode

2
ELECTRONICS& COMMUNICATION ENGINEERING
Based on applications diodes are divided into two types:
> PN Junction
> ZENER Diode
Applications of Diode:
 Rectifying a voltage, such as turning AC into DC.
 Isolating signals from a supply.
 Controlling the size of a signal.

PN JUNCTION DIODE:
A PN junction is formed when an N-type material is fused together with a P-type material
creating a semiconductor diode. PN junction diode is to allow an electric current in one
direction (called the forward direction) while blocking current in the opposite direction (the
reverse direction). The forward breakdown voltage of Germanium (Ge) is 0.3V and silicon (Si)
is 0.7V.

Fig 1.4.1 Symbol of PN Junction Diode

ZENER DIODE:
A Zener diode is a type of diode that permits current in the forward direction like a normal
diode, but also in the reverse direction if the voltage is larger than the breakdown voltage
known as "Zener knee voltage" or "Zener voltage". Normal diodes are not designed to operate
in the breakdown region, whereas Zener diodes operate reliably in this region.
Zener diodes are used to protect circuits from over voltage.

Fig 1.4.2 Symbol of Zener Diode

1.5 TRANSISTOR:
A transistor acts as an electrically controlled switch 0r an current amplifier. A transistor
is a semi-conductor device commonly used to amplify or switch electronic signals. A voltage
or current applied to one pair of the transistor's terminals changes the current flowing through
another pair of terminals. Because the controlled (output) power can be much more than the
controlling (input) power, the transistor provides amplification of a signal.

3
ELECTRONICS& COMMUNICATION ENGINEERING
Applications of Transistor:
 Transistors are used in digital and analog circuits as a switch.
 Uses in signal amplifier devices Cellular phones would be one of the most widely
used applications of transistors.
 Every cell phone uses a transistor amplifier.
 Uses in power regulator and controllers
TRANSISTOR TYPES:
• Bipolar Junction Transistor (BJT)
➢ NPN: A small input current and a positive voltage applied @ its base (with VB>VE) allows
a large current to flow from collector to emitter.
➢ PNP: A small output current and a negative voltage @ its base (with VB<VE) allows a
much larger current to flow from emitter to collector.

Fig 1.5.1.(a) BJT

• Junction Field Effect Transistor (JFET)


➢ Two types of JFETs: n-channel and p-channel.
➢ JFETs have very high input impedance and draw little or no input current.
➢ JFETs are used as electrically controlled switches, current amplifiers, and voltage-controlled
resistors.

Fig 1.5.1.(b) JFET

4
ELECTRONICS& COMMUNICATION ENGINEERING
1.6 TRANSFORMER:
A transformer is a power converter that transfers AC electrical energy through inductive
coupling between circuits of the transformer's windings. A varying current in the primary
winding creates a varying magnetic flux in the transformer's core and thus a varying magnetic
flux through the secondary winding. This varying magnetic flux induces a varying
electromotive force (EMF), or "voltage", in the secondary winding. This effect is called
inductive coupling.

Fig 1.6 Transformer

If a load is connected to the secondary winding, current will flow in this winding, and electrical
energy will be transferred from the primary circuit through the transformer to the load.
Transformers may be used for AC-to-AC conversion of a single power frequency.

1.7 LIGHT EMITTING DIODE (LED):


A light-emitting diode(LED) is a semiconductor light source. LEDsare used as indicator
lamps in many devices and are increasingly used for lighting.
The symbol of LED is:

Fig 1.7 LED

• The materials used in LED’s are the mixtures of Gallium (Ga), Arsenide (As),
Phosphorous (P). The materials include-GaAs, GaP, GaAsP
COLOUR VALUE VOLTAGE COLOUR VALUE VOLTAGE
White 100Ω 3.3V Red 200 Ω 2.1V
Yellow 200Ω 2.2V Green 100 Ω 3.7V
Blue 100Ω 3.1V Green 100 Ω 2.5V
Table 1.7 LED Specifications

1.8 PROTECTIVE SWITCH:


 RELAY: A relay is an electrically automatic operated switch. The relay that can
handle the high directly control an electric motor is called a contractor.
 SWITCH: Switch is manually on and manually off.
 CIRCUIT BREAKER: The operation of Circuit breaker is manually on and
Automatic off.

5
ELECTRONICS& COMMUNICATION ENGINEERING
1.9 SEVEN SEGMENT DISPLAY:
A seven-segment display less commonly known as a seven-segment indicator is a
form of display device that is an alternat electronics as a method of displaying decimal numeric
feedback on the internal operations of devices.

Fig 1.9.(a) Common Cathode Fig 1.9.(b) Common Anode Fig 1.9.(c) Display

Basically, there are two types of 7-Seg displays:


• Common Cathode where all the segments share the same Cathode.
• Common Anode where all Segments share the same Anode.

1.10 STEPPER MOTOR:


A stepper motor is a brushless AC synchronous electric motor that can divide a
full rotation into a large number of steps. The motor's position can be controlled precisely,
without any feedback mechanism (see open loop control). Stepper motors are like switched
reluctance motors, which are very large stepping motors with a reduced pole count, and
generally are closed loop commutated. It is a “digital” version of the electric motor. The rotor
moves in discrete steps as commanded, rather than rotating continuously like a conventional
motor. When stopped but energized, a stepper holds its load steady with a holding torque. When
we compare it with the servo motor, simple drive electronics, good accuracy, good torque,
moderate speed, and low cost are most advantages of stepper motor.
Types of Stepper Motor:
(1) Variable Reluctance Motors (2) Permanent Magnet (3) Hybrid Motors

1.11 KEYPAD:
Keypads are the mostly used input devices of the 8051/52.Keypad is organized in a
matrix of rows and columns. The MCU accesses both rows and columns through ports;
therefore, with two 8-ports, an 8X8 matrix of keys can be connected to a microcontroller.
 When a key is pressed, a row and a column make a contact; otherwise, there is no
connection between rows and columns.
It is the function of a program stored in the EPROM of the microcontroller to scan
the keyscontinuously, identify which one has been activated.

1.12 BUZZER:
 A buzzer or beeper is a signaling device, usually electronic, typically used in
automobiles,household appliances such as a microwave oven, or game shows.
 Typical uses of buzzers and beepers include alarm devices, times, train and
confirmation ofuser input such as a mouse click keystroke.

6
ELECTRONICS& COMMUNICATION ENGINEERING
1.13 555 IC:
This integrated circuit is used for timing. The 555 integrated circuit (IC) is a chip that is issued
in many school projects and commercially made items such as video recorders and timers.

Fig 1.13 555 IC

The 555 has eight pins (legs) but the function of two is very important. These are pin two and
three.
PIN 2. This pin is where the current /voltage enters the chip and starts the timing sequence or
starts to count.
PIN 3. This is where the current comes out after the timer has completed counting.

1.14 REGULATED POWER SUPPLY:

Fig 1.14 (a) Regulated Power Supply Design

Input: AC 230V/50hz Output: DC 5v/500mA

Fig 1.14.(b) Regulated Power Supply Circuit

7
ELECTRONICS& COMMUNICATION ENGINEERING
CHAPTER-2
DC THEOREMS
2.0 THEOREMS:
In mathematics, a theorem is a statement that has been proven on the basics of
previously established statements, such as other theorems and generally accepted statements,
such as axioms.
To obtain the verification of all theorems in proteus software
1) KVL 2) KCL 3) THEVINE'S
4) NORTON'S 5) RECIPROCITY 6) SUPER POSITION
7) MAXIMUM POWER TRANSFER
REQUIRED TOOLS:
• Resistors • Loads • Volt Meters & Current Meters

2.1 KVL (KICRHHOFF'S VOLTAGE LAW):


This theory deals with the voltages in a closed mesh or loop and states that
"The algebraic sum of all the voltages in a closed loop is equals to zero".
The Voltage drops are taken as -Ve and the voltage sources are treated as +Ve source.
Following
equations exist. v 1+v2+v3= [12] + [-4] + [-8] =0 (The KVL is proved).

Fig 2.1 KVL Circuit Loop

(a) Basic KVL LOOP () Basic KVL LOOP


-100I1-300(I1-I2) +9V= 0 -200I2-220I2+300(I1+I2) =0
-100I1-300I1+300I2=-9V -420I2+300I2-300I2=0
-400(I1) +300(I2) =-9V 300(I1)-720(I2) =0
I1=32.7mA I2=-13.6mA I3=19.1mA

8
ELECTRICAL AND ELECRTRONICS ENGINEERING
2.2 KCL (KIRCHHOFF'S CURRENT LAW):
This Theory states the current in aclosed junction or point and states as following.
"The algebraic sum of the currents at any point is equal to zero".
(or)
"The sum of the currents entering the junction is equal to the sum of the currents leaving the
junction".
If we consider incoming current is positive and outgoing current is negative.
I1+I2+I3=I4+I5
INCOMING CURRENT =OUTGOING CURRENT
As shown in the figure the currents meeting at the junction make their sum zero i.e.as derived
below.
the sum of the current meeting is I1+I2+I3= [-5] + [2] + [3] =0
Hence the KCL is verified

Fig 2.2 KVL Circuit

(a) Basic KVL LOOP 1 (b)Basic KVL LOOP


100I1+220(I1+I2) =9V 150I2+220I2-220(I1+I2) =0
100I2+220I2+220I2=9V 370I2-220I1-220I2=0
320I1+220I2=9V -220I1+150I2=0
I1=37.8mA I2=14.1mA I3=23.7mA

2.3 THEVINENS THEOREM:(It is derived from source transmission)


It states that any linear bilateral network can be replaced with can equivalent circuit
consisting of a voltage source (VTH)in series with resistance (RTH) across the load
resistances... (Where Vth open circuited voltage across the two terminal and RTH is the
equivalent resistance of the network viewing from the load terminals. [while calculating RTH
replace all other independent sources with their internal resistance by replacing voltage source
with short circuiting and current source with open circuit terminals].
Thevenin's theorem states that any liner circuit containing several voltages and resistance can
be replaced by just one single voltage in series with a single resistance connected across the
load".
9
ELECTRICAL AND ELECRTRONICS ENGINEERING
Step1: Determine of Vth:( Vth open circuited voltage across O/P)
Vab=Vbc=Vcd=Voc=Vth=9v
Vth=9v
Determination of Rth Determine of Vth

Fig 2.3.(a) Thevenin's Resistance Rth Fig 2.3.(b) Where Vth open circuited

Rth= 1×2
+3 Voltage Drop at AB=0.02×100=2.5V
1+ 2

= 100×300
+ 200 Voltage Across BC= V-Vab
100+300

=2 Ω = (0-2.5)
Vth= 7.5V
Step2: Determine the Rth: (Vs is replaced by SC and current source is replaced by OC).
Step3: Determine of Thevenin's: Equivalent circuit load current
An active network having two terminal A&B can be replaced by a constant voltage source
having an EMF and terminal resistance.
The value of e is the open circuit voltage between a & b and r is the equivalent resistance of
the circuit with load removed and the source of EMF.

Fig 2.3.(c) Thevenin's Theorem


7.5
Ith=
275+400
7.5
Ith=
675

Ith=0.0111

10
ELECTRICAL AND ELECRTRONICS ENGINEERING
2.4 NORTONS THEORM:(It is derived from source transmission).
It states that any linear bilateral network can be replaced with can equivalent circuit
consisting of a current source (ISC)in parallel with resistance (Rn) across the load resistances...
(Where ISC short, circuited voltage across the two terminal and Rn is the equivalent resistance
of the network viewing from the load terminals. [while calculating Rn replaces all other
independent sources with their internal resistance by replacing current source with short
circuiting and current source with open circuit terminals].
Thevenin's theorem states that any liner circuit containing several voltages and
resistance can be replaced by just one single Current in parallel with a single resistance
connected across the load".
Step1: Determine of ISC: (ISC open circuited voltage across O/P)
Iab=Ibc=Icd=Ioc=Ith
Determination of RN Determine of VN

Fig 2.4.(a) Rth short, circuited voltage across O/P Fig 2.4.(b) Isc open circuited voltage across O/P

Step2: Determine the Rth: (Vs is replaced by SC and current source is replaced by OC)
Step3: Determine of Thevenin's equivalent circuit load current:
An active network having two terminal A&B can be replaced by a constant voltage
source having an EMF and terminal resistance. The value of e is the open circuit current
between a & b and r is the equivalent resistance of the circuit with load removed and the source
of EMF.

Fig 1.4. (c) Northen Theorem

RN=220Ω RL=400Ω

IN=0.0327A VN=4.641v
IL=0.05A

11
ELECTRICAL AND ELECRTRONICS ENGINEERING
2.5 RECIPROCITY THEOREM:
The Reciprocity theorem states that any linear bilateral single source network. The ratio of
excitation to response is constant even when their positions are interchanged. (IT IS
AVERTICAL THEOREM).
The reciprocity theorem can't produce the accurate values for the AC because no of the
transient. The DC has no transient therefore the reciprocity theorem gives the accurate value
of the output. Hence the reciprocity theorem is verified.
When both I/p and o/p are interchanged the response are equal for give circuit is known as
reciprocity theorem.

Fig 2.5.(a) Reciprocity Theorem (Left)

LOOP 1: -I1R1-I3R3+10V
-I1(75) -(I1-I2) R3+10V=0
-I1(75+50) +I2(50) =-10
I1(125)-I2(50) =10
-I1(225) +I2(50) =0
I1=0.090A

Fig 2.5.(b) Reciprocity Theorem (Right)

LOOP 2: -I2R2-I2R2+(I1-I2)-R3
-I2R2-I2R2+I1R3-I2R3=0
I1(50)-I2(25+50)-I2(100) =0
I1150-I2(100+75) =0
I1(50)-I2(175) =0
I2=0.090A

12
ELECTRICAL AND ELECRTRONICS ENGINEERING
2.6 SUPER POSITION THEOREM:
In any linear bilateral network consisting of multiple sources, the response in any branch is
the algebraic sum of its responses due to the individual source acting alone).
While considering individual sources. All other independent sources are replaced with their
internal resistance.
If it is an ideal voltage source (internal resistance =0) therefore replaced with short circuit.
If it is an ideal current source (internal resistance= ∞) therefore replaced with open circuit.

Fig 2.6.(a) Super Position Theorem

The total voltage obtained is +44v. (Formula: IX=IX'+IX")


The total sum of the voltages of individuals is [-16] + [60] =44v.
Therefore, the voltage obtained by multi source is equal to the sum of the voltage obtained by
individual sources.

Fig 2.6.(b) Super Position Theorem Fig 2.6.(c) Super Position Theorem

Step 1: Theorems values (Current) Step2: Theorems values (Voltage)


1= 2 = ×1
1+ 2 2+ 3
= 20 = 5×5
5+3 5+3

= . = .
Total Current Passing Through 3Ω = I1+I2 = 5.625A

13
ELECTRICAL AND ELECRTRONICS ENGINEERING
2.7 MAXIMUM POWER TRANSFER THEROEM:
Maximum power transfer theorem states that "maximum power is transferred from the
source to the load when the load resistance is equal to the Thevenin's equivalent resistance. (if
we draw Thevenin's equivalent circuit for any given network then loads current (IL)can be
given as. (Rth=RL). We know PL=IL²R

Fig 2.7.(a) Maximum Power Transfer Theorem (Circuit) g2.7.(b) Maximum Power Transfer Theorem (Rth)
40×20
ℎ= + 60
20+40

Rth=73.33Ω
In many electrical and electronic application, we are interested in the amount of power
received by a particular load (speaker, electrical motor, antenna). Electrical system is a
source of power and a load connected to that source. source-amplifiers generators, power
supplies. All linearly constructed sources can be reduced to their Thevenin equivalent.
In DC circuits, the load can be represented by a resistance RL

Fig 2.7.(c) Maximum Power Transfer Theorem (Vth)

= =

20 − ℎ = 0
= ×= × =
( )
= =
× ×.

=
.

Pmax = 5.45W

14
ELECTRICAL AND ELECRTRONICS ENGINEERING
PROTEOUS 8 PROFESSIONAL:
Proteus Professional 8 is a widely used software suite primarily utilized for electronic
design automation (EDA), particularly in the development of printed circuit boards (PCBs)
and schematic capture. Here's an overview of its key features and functionalities:

Schematic Capture: Proteus allows users to create schematic diagrams of electronic


circuits using a comprehensive library of components. This feature enables designers
to visualize and plan their circuits before PCB layout.

PCB Design: Once the schematic is created, Proteus facilitates the design of the actual
PCBlayout. Users can place components, route traces, define board layers, and
perform design rule checks (DRC) to ensure the integrity of the PCB design.

Simulation: One of the standout features of Proteus is its powerful simulation capabilities.
Itprovides simulation tools for both analog and digital circuits

Microcontroller Simulation: Proteus includes support for simulating microcontroller


-baseddesigns. It offers a wide range of microcontroller models, allowing designer
s to program anddebug their embedded systems within the software environment.

Overall, Proteus Professional 8 is a versatile and feature-rich software suite that caters to
theneeds of electronics engineers, hobbyists, and professionals alike,
providing comprehensivetools for designing, simulating, and prototyping electronic
circuits and PCBs.

15
ELECTRICAL AND ELECRTRONICS ENGINEERING
CHAPTER-3
DIGITAL IC’s
3.1 INTRODUCTION OF 8086:
8086 Microprocessor is an enhanced version of 8085 microprocessor that was
designed by Intel in 1976. It is a 16-bit Microprocessor having 20 address lines and 16 data
lines that provides up to 1MB storage. It consists of a powerful instruction set, which provides
operations like multiplication and division easily. It supports two modes of operation, i.e.,
maximum mode and minimum mode. Maximum mode is suitable for a system having multiple
processors and minimum mode is suitable for a system having a single processor. The 8086
(also called iAPX86) is a 16-bit microprocessor. The 8086 gave rise to the x86 architecture,
which eventually became Intel's most successful line of processors. The 8086 gave rise to the
x86 architecture, which eventually became Intel's most successful line of processors. On June
5, 2018, Intel 8086, called the Intel core i7-8086k.

3.1.1 ARCHITECTURE DESCRIPTION:


The internal architecture of Intel 8086 is divided into units, viz., Bus Interface Units (BIU) and
Execution Unit (EU). The Bus Interface Unit (BIU) generates the 20-bit physical memory
address and provides the interface with external memory (ROM/RAM). As mentioned earlier,
8086 has a single memory interface.

3.1.2 FEATURES OF 8086:


➢ 16-bit processor
➢ 16-bit ALU
➢ 16-bit registers
➢ 16 bit internal & external data buses
➢ Based on frequency of operation-
1. 8086 - 5MHZ
2. 8086-2 - 8MHZ
3. 8086-1 - 10MHZ
➢ It has 256 vectored interrupts
➢ It consists of 29000 transistors
➢ Its uses of two stages of pipelining
a. Execute stage
Fig 3.1.(a) 8086 Microprocessor Fig 3.1.(b) 8086 Pin Diagram

b. Fetch stage

3.1.3 DESCRIPTION OF 8086:


Power Supply and Frequency Signals:
It uses 5V DC supply at VCC pin 40, and uses ground at VSS pin 1 and 20 for its operation
Clock Signal:
Clock signal is provided through Pin-19. It provides timing to the processor for operations.
Its frequency is different for different versions, i.e., 5MHZ, 8MHZ and 10MHZ.

16
ELECTRICAL AND ELECRTRONICS ENGINEERING
Address/data bus:
AD0-AD15. These are 16 address/data bus.AD0-AD7 carries low order byte data and
AD8- AD15 carries higher order byte data. During the first clock cycle, it carries 16-bit address
and after that it carries 16-bit data.
Address/status bus:
A16-A19/S3-S6. These are the 2 address/status buses. During the first clock cycle, it
carries 4- bit address and later it carries status signals.
RESET:
It is available at pin 21 and is used to restart the execution. It causes the processor to
immediately terminate its present activity. This signal is active high for the first 4 clock cycles
to RESET the microprocessor.

3.2 INTRODUCTION OF 8051 MICROCONTROLLER:


The 8051 Microcontroller is one of the most popular and most commonly used
microcontrollers in various fields like embedded systems, consumer electronics, automobiles,
etc.
Technically called Intel MCS-51 Architecture, the 8051-microcontroller series was
developed by Intel in the year 1980 and was very popular in the 80's (still is popular).
8051 Microcontroller has many features like serial communication, Timers, Interrupts, etc.
And hence many students and beginners start their work on the concept of Microcontrollers
with 8051 Microcontroller. Even though 8051 Microcontroller might seem a little bit out of
fashion, we feel that it is one of the best platforms to get started with Microcontrollers,
Embedded systems and Programming (both C and Assembly).
A Microcontroller is a VLSI IC that contains a CPU(Processor) along with some other
peripherals like Memory (RAM and ROM), I/O Ports, Timers/Counters, Communication
Interface, ADC, etc.
Applications of 8051 Microcontroller:
• Home Applications • Automobiles
• Communication Systems • Aeronautical and Space
• Office • Medical Equipment

3.2.1 FEATURES OF 8051:


➢ 128 bytes on chip data memory (RAM).
➢ Bit as well as byte addressable RAM area of 16 bytes
➢ 128 user defined software flags.
➢ 8-bit data bus
➢ 16-bit address bus
➢ 4 register banks.

17
ELECTRICAL AND ELECRTRONICS ENGINEERING
➢ 32 general purpose registers each of 8 bits.
➢ 16-bit timers (usually 2, but may have more, or less).
➢ 2 internal and 3 external interrupts.
➢ 16-bit program counter and data pointer.
➢ 1 Microsecond instruction cycle with 12 MHz Crystal.
➢ 4 KB on chip program memory. (ROM)

3.2.2 PIN DESCRIPTION OF 8051:

Fig 3.2 Architecture of 8051 Fig 3.2.2(a)Pin diagram of 8051

➢ The 8051 has an on-chip oscillator but requires an external clock to run it.
➢ A quartz crystal oscillator is connected to inputs XTAL1 and XTAL2.
➢ It also needs 2 capacitors of 30pF value.
➢ One side of each capacitor is connected to the ground as shown below:

Reset Circuit

Fig 3.2.2(b) Oscillator

➢ Pins 1&8: Port 1 Each of these pins can be configured as an input or an output.

18
ELECTRICAL AND ELECRTRONICS ENGINEERING
➢ Pin 9: RS A logic one on this pin disables the microcontroller and clears the contents of
most registers. In other words, the positive voltage on this pin resets the microcontroller. By
applying logic zero to this pin, the program starts execution from the beginning.
➢ Pins10-17: Port 3 Similar to port 1, each of these pins can serve as general input or output.
Besides, all of them have alternative functions:
➢ Pin 10: RXD Serial asynchronous communication input or Serial synchronous
communication output.
➢ Pin 11: TXD Serial asynchronous communication output or Serial synchronous
communication clock output.
➢ Pin 12: INT0 Interrupt 0 input.
➢ Pin 13: INT1 Interrupt 1 input.
➢ Pin 14: T0 Counter 0 clock input.
➢ Pin 15: T1 Counter 1 clock input.
➢ Pin 16: WR Write to external (additional) RAM.
➢ Pin 17: RD Read from external RAM
➢ Pin 21-28: Port 2
➢ Pin 29: PSEN If external ROM is used for storing program, then a logic zero (0) appears on
it every time the microcontroller reads a byte from memory.
➢ Pin 30: ALE
➢ Pin 31: EA
➢ Pin 32-39: Port 0
➢ Pin 40: VCC
3.2.3 REGISTERS IN 8051:
➢ In CPU, registers are used to store information temporarily. That information could be a
byte of data to be processed, or an address pointing to the data to be fetched. 8051have 8-bit
register
D7 D6 D5 D4 D3 D2 D1 D0
MSB Table 3.2.3(a) Register LSB

➢ The most widely used registers are A (accumulator), B, R0-R7, DPTR (Data Pointer), PC
(Program Counter). All the registers except DPTR and the program counter are 8bits. DPTR
and PC are 16 bits.
PSW REGISTER:
CY AC F0 RS1 RS0 OV P
Table 3.2.3(b) PSW Register

19
ELECTRICAL AND ELECRTRONICS ENGINEERING
➢ CY PSW.7 Carry Flag
➢ AC PSW.6 Auxiliary Carry Flag
➢ F0 PSW.5 Available to the user for general purpose
➢ RS1 PSW.4 Register Bank selector bit 1
➢ RS0 PSW.3 Register bank selector bit 0
➢ OV PSW.2 Overflow flag
➢ --- PSW.1 User-definable bit
➢P PSW.0 Parity flag. (odd/even know of 1 bit in the accumulator

RS1 RS0 REGISTER BANK ADDRESS


0 0 0 00H-07H
0 1 1 08H-0FH
1 0 2 10H-17H
1 1 3 18H-1FH

➢ It is an 8-bit register.
➢ Although it is an 8-bit register, only 6 bits of it are used. The two unused bits are user
definable flags.
➢ Four bits are called conditional flags; they indicate some conditions that result after an
instruction is executed.
➢ These 4 are CY (carry), AC (Auxiliary Carry), P (Parity) and OV (Overflow).
➢ The bits PSW.3 and PSW.4 are designated as RS0 and RS1, respectively are used to change
the bank registers.
➢ CY flag: - This flag is set when there is a carry out from the D7 bit. This flag bit is affected
after an 8-bit addition or subtraction.
➢ AC flag: - If there is a carry from D3 to D4 during ADD or SUB operation, this bit is set;
otherwise cleared.
➢ P flag: - It reflects the number of 1’s in the A (accumulator) register only. If A register
contains an odd number of 1’s, then P=1.If it's even, then P=0.
➢ OV Flag: - This is set whenever the result of a signed number operation is too large, causing
the high order bit to overflow into sign bit.

TMOD REGISTER:
G C\T M1 M0 G C\T M1 M0
TIMER\COUNTER 1 TIMER\COUNTER 0
Table 3.2.3(c) TMOD Register

20
ELECTRICAL AND ELECRTRONICS ENGINEERING
Gate signal. For normal operation clear this bit to 0.
GATE If you want to use the timers to capture external events' length, set it to 1, and the
timer 1/0 will stop counting when External Interrupt 1/0 pin is low (set to 0 V). Note
that this feature involves both a timer and an external interruption, it is your
responsibility to write the code to manage the operation of those two peripherals.
Set to 1 to use the timer/counter 1/0 as a Counter, counting external events on
C/T P3_4/P3_5, cleared to 0 to use it as timer, counting the main oscillator frequency
divided by 12.

M1 Timer MODE: Those two last bits combine as 2-bit word that defines M0 the mode
M0 of operation, defined as the table below.
3.2.4 OPERATION OF MODES:
M1 M0 MODES NO. OF BITS RANGE
0 0 0 13 0-8191
0 1 1 16 0-65535
1 0 2 8(AUTO RELOAD
TIMER) 0-255

1 1 3 8(SPLIT TIMER) 0-255

Table 3.2.3(d) Operations of Modes

TCON:
TF1 TR1 TF0 TR0 IE1 IT1 IE0 IT0

MSB Table 3.2.3(e) TCON Register LSB

3.2.5 ADDRESSING MODES OF 8051:


Addressing Mode:
The way in which the op code and operand is specified in an instruction
isknown as addressing mode. Mainly 5 types of addressing modes are used in the 8051.
They are:
✓ Immediate addressing mode e.g.: MOV A, #20H
✓ Register addressing mode e.g.: MOV A, B
✓ Direct addressing mode e.g.: MOV A,40H
✓ Register indirect addressing mode e.g.: MOV A, @R1
✓ Indexed addressing mode e.g.: MOVC A, @A+DPTR

3.2.6 INSTRUCTION SET OF 8051:


INSTRUCTION SET:
A group of commands required to full fill the specific task is called instruction set.

21
ELECTRICAL AND ELECRTRONICS ENGINEERING
INSTRUCTION SET OF 8051:
✓ Data Transfer Instruction e.g.: MOV A, B
✓ Arithmetic Instruction e.g.: ADD A, B
✓ Logical Instruction e.g.: ANL A, B
✓ Branch Instruction e.g.: CJNZ A, B, rel Address
✓ Boolean Instruction e.g.: CPL bit

3.3 Introduction to ARM Architecture:


The Advanced RISC Machine or Acorn RISC Machine is an architecture with different
computing architectures set to be used in different environments. 32-bit and 64-bit can be used
here in different computer processors. It was developed by Arm Holdings and the architecture
is updated in between. This architecture is specified to be used with CPU, different chips in the
system, and in different registers. Reduced Instruction Set Computing helps in creating
instructions for the system to be used for several purposes. Smart phones, microcomputers,
andembedded devices also use ARM architecture for the instruction set in the registers.
• What is ARM Architecture?

Fig 3.3 ARM Architecture

The architecture can be divided into A, R, and M profiles. A profile is mainly for applications,
R profile is for real-time and M profile is for Microcontroller M profile is used in IOT devices
and can be synchronized with small and high-power devices.
Components of ARM Architecture:
• With the help of these instructions, it is easy to manage the architecture and the
microprocessors.
• Priority encoders help to load the instruction and to store it in the specified register in order
to manage the files.

22
ELECTRICAL AND ELECRTRONICS ENGINEERING
• Multiplexers are used in the architecture to manage the operation of processor buses. The
components are instructed to work in behavioral mode and the components are implemented
as an entity. The architecture of the entity is optimized depending on the application of the
processor and helps to construct and maintain the design.
• 32-bit inputs are used in Arithmetic and Logic Unit which comes from register files and
shifter. The outputs are modified in register flags.
• Booth Multiplier Factor has 32-bit inputs to manage from the register file.
• The Control unit controls the entire process of the architecture and manages the system
operation. It can be made of circuits or can be the combination of functions and circuits in the
design. Timing is managed in the control unit and works with a combination of a state machine
in the processor.
• There is a register set in the architecture to help in managing the registers with the
corresponding time in the structure. It is important to check the number of registers and the
same size for the proper functioning of the system.
*Benefits Given below are the benefits of ARM Architecture:
• Energy consumed is very low in the architecture and their design is such that with high
processing power, low energy to be consumed. Hence devices with high performance prefer
this architecture in the device.
• Cost of the architecture is very less when compared with others. This makes ARM
architecture popular among devices. Portable devices prefer this architecture for the
performance and low-cost model in the system.
• The pipeline used is simple and at a low power envelope, normal loads are managed.
• This helps the system to manage the processes in the architecture easily in portable devices
and also in CPU-managed devices.
• It is used in aviation, automobile, industrial, mechanical, and many other industries with less
complexity.

3.4 INTRODUCTION OF ARDUINO:


Arduino is an open-source platform used for building electronics projects. Arduino
consists of both a physical programmable circuit board (often referred to as a microcontroller)
and a piece of software, or IDE (Integrated Development Environment) that runs on your
computer, used to write and upload computer code to the physical board. Additionally, the
Arduino IDE uses a simplified version of C++, making it easier to learn to program
FAMILYS OF ARDUINO:
• Arduino- Uno, Mega, Umini, Nano.
• Fuduino- Uno, Mega, Umini, Nano.
• Seeduino- Uno, Mega, Umini, Nano.
• Freeduino- Uno, Mega, Umini, Nano.
• Lily pad- Uno, Mega, Umini, Nano.

23
ELECTRICAL AND ELECRTRONICS ENGINEERING
Fig 3.4.1 Arduino

The Arduino UNO can be powered from a USB cable coming from your computer
or a wall power supply (like this) that is terminated in a barrel jack. The USB connection is
also how you will load code onto your Arduino board. More on how to program with Arduino
can be found in our Installing and Programming Arduino tutorial.

Pins (5V, 3.3V, GND, Analog, Digital, PWM, AREF)


• GND (3): Short for ‘Ground’. There are several GND pins on the Arduino, any of which can
be used to ground your circuit.
• 5V (4) & 3.3V (5): As you might guess, the 5V pin supplies 5 volts of power, and the 3.3V
pin supplies 3.3 volts of power.
• Analog (6): The area of pins under the ‘Analog In’ label (A0 through A5 on the UNO) are
Analog In pins.
• Digital (7): Across from the analog pins are the digital pins (0 through 13 on the UNO).
Thesepins can be used for both digital input and output.
• PWM (8): This pin acts as normal digital pins but can also be used for something called
Pulse-Width Modulation (PWM).
• AREF (9): Stands for Analog Reference.
• Reset Button: Arduino has a reset button (10).
• TX & RX LEDs: TX is short for transmit; RX is short for receive. These markings appear
quite a bit in electronics to indicate the pins responsible for serial communication.

24
ELECTRICAL AND ELECRTRONICS ENGINEERING
KEIL C µVISION 5:

Keil C µVision 5 serves as a cornerstone tool for engineers, developers, and hobbyists
engaged in the development of embedded systems. With its intuitive interface and robust
feature set, this IDE simplifies the process of writing, compiling, and debugging code for
microcontroller-based projects.

Integrated Development Environment (IDE): Keil C provides a user-friendly IDE that


integrates all the necessary tools for embedded software development. It includes a code
editor with features like syntax highlighting, code completion, and automatic indentation
toenhance productivity and code readability.

Compiler and Debugger: Keil C comes with a highly optimized C and C++ compiler
specifically designed for embedded systems development. The compiler generates
efficientcode tailored to the target microcontroller's architecture, optimizing performance
and memory usage. Additionally, Keil C includes a powerful debugger with features such
as real-time code execution analysis, register and memory inspection, and breakpoint
debugging capabilities to facilitate code debugging and troubleshooting.

Simulation and Emulation: Keil C includes simulation and emulation capabilities that
enable developers to test their code in a virtual environment before deploying it to the
targethardware. This feature helps identify and fix issues early in the development cycle,
reducing time-to-market and development costs.

Overall, Keil C provides a comprehensive development environment with features


tailored to the unique requirements of embedded systems development, making it a
preferred
choicefor developers working on embedded projects across various industries.

25
ELECTRICAL AND ELECRTRONICS ENGINEERING
3.5 MICROCONTROLLER PROGRAMS
Blinking LED:

Fig 3.5.1 Blinking LED

Assembly Language: C Language:

venkatesh: #include <regx52.h>


mov p1, #0ffh #define venkatesh
acall delay P1
mov p1, #00h void delay (unsigned int);
acall delay
sjmp void main(void)
venkatesh {
while (1)
{ venkatesh =0xff;
delay: delay (150);
mov tmod, #01h venkatesh =0x00;
mov tl0, #00h delay (150);
mov th0, #00h }
setb tr0 }
here: jnb tf0, here
clr tf0
clr tr0 void delay (unsigned int t)
ret {
unsigned int i,j;
for (i=0; i<t;i++)

for (j=0; j<1275; j++);

26
ELECTRICAL AND ELECRTRONICS ENGINEERING
Even or Odd LED:

Fig 3.5.2 Even or Odd LED

Assembly Language: C Language:

venkatesh: #include <regx52.h>


mov p1, #0aah #define venkatesh
acall delay P1
mov p1, #55h void delay (unsigned int);
acall delay
sjmp void main(void)
venkatesh {
while (1)
{ venkatesh =0xaa;
delay: delay (150);
mov tmod, #20h venkatesh =0x55;
mov tl1, #00h delay (150);
setb tr1 }
here:jnb tf1,here }
clr tf1
clr tr1
ret void delay (unsigned int t)
{
unsigned int i,j;
for (i=0; i<t;i++)

for (j=0; j<1275; j++);

27
ELECTRICAL AND ELECRTRONICS ENGINEERING
One after One LED:

Fig 3.5.3 One after One LED

Assembly Language: C Language:

venkatesh: #include <regx52.h>


mov p1, #80h #define venkatesh
acall delay P1
mov p1, #40h void delay (unsigned int);
acall delay
mov p1, #20h void main(void)
acall delay {
mov p1, #01h unsigned int led [8]
acall delay ={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
mov p1, #08h unsigned loop=0;
acall delay while (1)
mov p1, #04h {
acall delay for (loop=0; loop<8; loop++)
mov p1, #02h { venkatesh = led[loop];
acall delay delay (150);
mov p1, #01h }
acall delay }
sjmp }
venkatesh
void delay (unsigned int t)
{
delay: unsigned int i,j;
mov tmod,02h for (i=0; i<t;i++)
mov tl0, #00h for (j=0; j<1275; j++);
setb tr0 }
here:jnb tf0, here
clr tf0
clr tr0
ret

28
ELECTRICAL AND ELECRTRONICS ENGINEERING
One by One LED:

Fig 3.5.1 One by One LED

Assembly Language: C Language:

venkatesh: #include <regx52.h>


mov p1, #80H #define venkatesh
acall delay P1
mov p1, #0c0H void delay (unsigned int);
acall delay void main ()
mov p1, #0e0H {
acall delay unsigned int led [[8]
mov p1, #0f0H ={0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff};
acall delay unsigned int loop=0;
mov p1, #0f8H while (1)
acall delay {
mov p1, #0fcH for (loop=0; loop<8; loop++)
acall delay {
mov p1, #0feH venkatesh=led[loop];
acall delay delay (200);
mov p1, #0ffH }
acall delay }
sjmp }
venkatesh

delay: void delay (unsigned int t)


mov tmod, #02H {
mov tl0, #00H unsigned int i,j;
setb tr0 for (i=0; i<t;i++)
here:jnb tf0, here for (j=0; j<1275; j++);
clr tf0 }
clr tr0
ret

29
ELECTRICAL AND ELECRTRONICS ENGINEERING
2-way Traffic Light:

Fig 3.5.5 2-Way Traffic Light

Assembly Language: C Language:

venkatesh: #include <regx52.h>


mov p1, #80h sbit R1=P1^7;
mov p2, #20h sbit Y1=P1^5;
acall delay1 sbit G1=P1^3;
mov p1, #80h sbit R2=P2^7;
mov p2, #08h sbit Y2=P2^5;
acall delay2 sbit G2=P2^3;
mov p1, #20h void delay (unsigned int);
mov p2, #80h void main ()
acall delay1 { R1=0;
mov p1, #08h Y1=0;
mov p2, #80h G1=0;
acall delay2 R2=0;
sjmp Y2=0;
venkatesh G2=0;
delay1: while (1)
mov r0, #71 {Y=0;
mov tmod, #01h R1=1;
here1: mov tl0, #00h G2=1;
mov th0, #0fh delay (6000);
setb tr0 R1=0; G2=0;
here:jnb tf0, here Y1=1; R2=1;
djnz r0, here1 delay (750);
clr tf0 Y1=0; R2=1;
clr tr0 G1=1;
ret delay (6000);
delay2: R2=0; G1=0;
mov r1, #192 R1=1; Y2=1;
mov r2, #3 delay (750);}}
mov tmod, #01h void delay (unsigned int t)
here2:mov tl0,00h {unsigned int i,j;
here3:mov th0, #00h for (i=0; i<t;i++)
setb tr0 for (j=0; j<1275; j++);
here4: jnb tf0, here4 }
djnz r1, here2
djnz r2, here3
clr tf0
clr tr0
ret

30
ELECTRICAL AND ELECRTRONICS ENGINEERING
4- way Traffic Light:

Fig 3.5.6 4-Way Traffic Light

Assembly Language: C Language:

venkatesh: #include <regx52.h>


mov p1, #88h sbit R1=P1^7;
mov p2, #81h sbit Y1=P1^6;
acall delay1 sbit G1=P1^4;
mov p1, #48h sbit R2=P1^3;
mov p2, #88h sbit Y2=P1^2;
acall delay2 sbit G2=P1^0;
mov p1, #18h sbit R3=P2^7;
mov p2, #88h sbit Y3=P2^6;
acall delay1 sbit G3=P2^4;
mov p1, #84h sbit R4=P2^3;
mov p2, #88h sbit Y4=P2^2;
acall delay2 sbit G4=P2^0;
mov p1, #81h void delay (unsigned int);
mov p2, #88h void main ()
acall delay1 { R1=0;
mov p1, #88h Y1=0;
mov p2, #48h G1=0;
acall delay2 R2=0;
mov p1, #88h Y2=0;
mov p2, #18h G2=0;
acall delay1 R3=0;
mov p1, #88h Y3=0;
mov p2, #84h G3=0;
acall delay2 R4=0;
sjmp Y4=0;
venkatesh G4=0;
delay1: while (1)
mov r1, #192 {Y1=0; G1=1; R2=1;
mov r2, #3 R3=1; R4=1;
mov tmod, #01h delay (6000);
here2:mov tl0,00h G1=0; R2=0; Y2=1; R1=1;
here3:mov th0, #00h delay (750);
setb tr0 Y2=0; G2=1;
here4: jnb tf0, here4 delay (6000);
djnz r1, here2 G2=0; R3=0; R2=1; Y3=1;
djnz r2, here3
31
ELECTRICAL AND ELECRTRONICS ENGINEERING
clr tf0 delay (750);
clr tr0 Y3=0; G3=1;
ret delay (6000);
G3=0; R3=1; R4=0; Y4=1;
delay2: delay (750);
mov r0, #71 Y4=0; G4=1;
mov tmod, #01h delay (6000);
here1: mov tl0, #00h G4=0; R1=0; R4=1; Y1=1;
mov th0, #0fh delay (750);
setb tr0 }}
here:jnb tf0, her void delay (unsigned int t)
djnz r0, here1 {unsigned int i,j;
clr tf0 for (i=0; i<t;i++)
clr tr0 for (j=0; j<1275; j++);
ret }
0-9 Display:

Fig 3.5.7 0-9 Display

Assembly Language: C Language:

venkatesh: #include <regx52.h>


mov p2, #3fh #define venkatesh
acall delay P2
mov p2, #06h void delay (unsigned int);
acall delay void main ()
mov p2, #5bh {unsigned int num [10]
acall delay ={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,
mov p2, #4fh 0x67};
acall delay unsigned int i=0;
mov p2, #66h while (1)
acall delay {for (i=0; i<10; i++)
mov p2, #6dh {
acall delay venkatesh=num[i]
mov p2, #7Dh ;delay (150);
acall delay }
mov p2, #07h }
acall delay }
mov p2, #7fh
acall delay void delay (unsigned int t)
mov p2, #67h {
acall delay unsigned int j,k;
sjmp for (j=0; j<t;j++)
venkatesh for (k=0; k<1275; k++);
}

32
ELECTRICAL AND ELECRTRONICS ENGINEERING
delay:
mov r0, #16
mov tmod, #01h
here1:mov tl0, #00h
mov th0, #00h
setb tr0
here: jnb tf0, here
djnz r0, here1
clr tf0
clr tr0
ret
0-99 Display:

Fig 3.5.8 0-99 Display

Assembly Language: C Language:

venkatesh: #include <regx52.h>


mov p2, #3fh #define venkatesh
acall delay P2 #define john P3
movp2, #06h void delay (unsigned int);
acall delay
movp2, #5bh void main ()
acall delay {unsigned int num [10] = {0x3f,0x06,0x5b,0x4f,
mov p2, #4fh 0x66,0x6d,0x7d,0x07,0x7f,0x67};
acall delay unsigned int i=0, l=0;
movp2, #66h while (1)
acall delay {for ((i=0; i<10; i++)
movp2, #6dh { venkatesh =
acall delay num[i]; for (l=0;
sjmp l<10; l++)
venkatesh { john = num[l];
delay (150);
delay: }
mov p3, #3fh }
acall delay1 }
mov p3, #06h }
acall delay1 void delay (unsigned int t)
movp3, #5bh {
acall delay1 unsigned int j,k;
mov p3, #4fh for (j=0; j<t;j++)
acall delay1 for (k=0; k<1275; k++);
movp3, #66h }
acall delay1
movp3, #6dh
acall delay1

33
ELECTRICAL AND ELECRTRONICS ENGINEERING
mov p3, #7Dh
acall delay1
mov p3, #07h
acall delay1
mov p3, #7fh
acall delay1
mov p3, #67h
acall delay1

delay1:
mov r0, #16
mov tmod, #01h
here1:mov tl0, #00h
mov th0, #00h
setb tr0
here: jnb tf0, here
djnz r0, here1
clr tf0
clr tr0
ret
0-999 Display:

Fig 3.5.9 0-999 Display

Assembly Language: C Language:

venkatesh: #include <regx52.h>


mov P1, #3fh #define venkatesh
acall delay2 P1 #define john P2
mov P1, #06h #define loki P3
acall delay2 void delay (unsigned int);
mov P1, #5bh
acall delay2 void main ()
mov P1, #4fh {unsigned int num [10] ==
acall delay2 {x3f,0x06,0x5b,0x4f,0x66,
mov P1, #66h 0x6d,0x7d,0x07,0x7f,0x67};
acall delay2 unsigned int i=0, l=0, h=0;
mov P1, #6dh while (1)
acall delay2 {for (i=0; i<10; i++)
mov P1, #7dh { venkatesh = num[i];
acall delay2 for (l=0; ll<10; ll++)
mov P1, #07h { john = num[l]; for
acall delay2 (h=0; h<10; h++)
mov P1, #7fh { loki = num[h];delay
acall delay2 (150);}

34
ELECTRICAL AND ELECRTRONICS ENGINEERING
mov P1, #6fh }
acall delay2 }
sjmp venkatesh }
delay2: }
mov P2, #3fh
acall delay void delay (unsigned int t)
mov P2, #06h {unsigned int j,k;
acall delay for (j=0; j<t;j++)
mov P2, #5bh for (k=0; k<1275; k++);
acall delay }
mov P2, #4fh
acall delay
mov P2, #66h
acall delay
mov P2, #6dh
acall delay
mov P2, #7dh
acall delay
mov P2, #07h
acall delay
mov P2, #7fh
acall delay
mov P2, #6fh
acall delay1
delay:
mov P3, #3fh
acall delay1
mov P3, #06h
acall delay1
mov P3, #5bh
acall delay1
mov P3, #4fh
acall delay1
mov P3, #66h
acall delay1
mov P3, #6dh
acall delay1
mov P3, #7dh
acall delay1
mov P3, #07h
acall delay1
mov P3, ##7fh
acall delay1
mov P3, #6fh
acall delay1
ret

delay1:
mov tmod, #01h
mov tl0, #00h

35
ELECTRICAL AND ELECRTRONICS ENGINEERING
mov th0, #00h
setb tr0
here:jnb tf0, here
clr tf0
clr tr0
ret

A-Z Display:

Fig 3.5.10 A-Z Display

Assembly Language: C Language:

venkatesh: #include <regx52.h>#define venkatesh P1 #define


mov p2, #0cfh john P2 #define loki P3
mov p3, #88h void delay (unsigned int);
acall delay
mov p2, #3fh void main ()
mov p3, #2ah {unsigned int num1[26] =
acall delay {0xcf,0x3f,0xf3,0x3f,0xf3,0xc3,
mov p2, #0f3h 0xfb,0xcc,0x33,0x63,0xc0,0xf0,0xcc,0xcc,
mov p3, #00h 0xff,0xc7,0xff,0xc7,0xbb,0x03,0xfc,0x0c,
acall delay 0xcc,0x00,0x00,0x33};
mov p2, #3fh unsigned int num2[26]
mov p3, #22h ={0x88,0x2a,0x00,0x22,0x88,0x88,0x88,0x88,
acall delay 0x22,0x22,0x94,0x00,0x05,0x11,0x00,0x88,0x10,
mov p2, #0f3h 0x98,0x88,0x22,0x00,0x11,0x50,0x55,0x25,
mov p3, #88h 0x44};
acall delay unsigned int i=0;while (1)
mov p2, #0c3h {for (i=0; i<26; i++)
mov p3, #88h {venkatesh = num1[i];
acall delay john = num2[i];
mov p2, #0fbh delay (150);
mov p3, #08h } } }
acall delay void delay (unsigned int t)
mov p2, #0cch {
mov p3, #88h unsigned int j,k;for (j=0; j<t;j++)
acall delay for (k=0; k<1275; k++);
mov p2, #33h }
mov p3, #22h delay:
acall delay mov r0, #16
mov p2, #63h
mov p3, #22h
acall delay

36
ELECTRICAL AND ELECRTRONICS ENGINEERING
mov p2, #0c0h mov tmod, #01h
mov p3, #94h here1:mov tl0, #00h
acall delay mov th0, #00h
mov p2, #0f0h setb tr0
mov p3, #00h here:jnb tf0, here
acall delay djnz r0, here1
mov p2, #0cch clr tf0
mov p3, #05h clr tr0
acall delay ret
mov p2, #0cch
mov p3, #11h
acall delay
mov p2, #0ffh
mov p3, #00h
acall delay
mov p2, #0c7h
mov p3, #88h
acall delay
mov p2, #0ffh
mov p3, #10h
acall delay
mov p2, #0c7h
mov p3, #98h
acall delay
mov p2, #0bbh
mov p3, #88h
acall delay
mov p2, #03h
mov p3, #22h
acall delay
mov p2, #0fch
mov p3, #00h
acall delay
mov p2, #0c0h
mov p3, #44h
acall delay
mov p2, #0cch
mov p3, #50h
acall delay
mov p2, #00h
mov p3, #55h
acall delay
mov p2, #84h
mov p3, #0a8h
acall delay
mov p2, #33h
mov p3, #44h
acall delay
sjmp
venkatesh

37
ELECTRICAL AND ELECRTRONICS ENGINEERING
CHAPTER-4
C LANGUAGE
4.1 INTRODUCTION
C is a procedural programming language initially developed by Dennis Ritchie in the year
1972 at Bell Laboratories of AT&T Labs. It was mainly developed as a system programming
language to write the UNIX operating system.
The main features of the C language include:
 General Purpose and Portable
 Low-level Memory Access
 Fast Speed
 Clean Syntax
4.2 WHY SHOULD WE LEARN C?
 Many later languages have borrowed syntax/features directly or indirectly from the C
language. Like syntax of Java, PHP, JavaScript, and many other languages are mainly
based on the C language. C++ is nearly a super set of C language (Only a few
programs may compile in C, but not in C++).
 So, if a person learns C programming first, it will help him to learn any modern
programming language as well. Learning C helps to understand a lot of the underlying
architecture of the operating system. Like pointers, working with memory locations,
etc.

4.3 STRUCTURE OF C
By structure, it means that any program can be written in this structure only. Writinga C
program in any other structure will hence lead to a complication error

Fig 4.3 Structure of the C program

4.4 COMPONENTS OF C:
1. Header Files Inclusion – [#include <stdio.h>]
The first and foremost component is the inclusion of the Header files in a C program. A
header file is a file with extension .h which contains C function declarations and macro
definitions to be shared between several source files. All lines that start with # are processed
by a preprocessor which is a program invoked by the compiler. Some of the C Header files:
 stdio.h – Defines core input and output functions.
 string.h – Defines string handling functions.
 math.h – Defines common mathematical functions.
38
ELECTRICAL AND ELECRTRONICS ENGINEERING
2. Main Method Declaration – [int main ()]
The next part of a C program is to declare the main () function. It is the entry point of a
C program, and the execution typically begins with the first line of the main (). The empty
brackets indicate that the main doesn’t take any parameter. The int that was written before
the main indicates the return type of main ().

3. Body of Main Method – [enclosed in {}]


The body of a function in the C program refers to statements that are a part of that
function. It can be anything like manipulations, searching, sorting, printing, etc. A pair of
curly brackets define the body of a function. All functions must start and end with curly
brackets.
4. Statement – [printf (“Hello World”);]
Statements are the instructions given to the compiler. In C, a statement is always
terminated by a semicolon (;). In this particular case, we use the printf() function to instruct
the compiler to display “Hello World” text on the screen.

5. Return Statement – [return 0;]


The last part of any C function is the return statement. The return statement refers to the
return values from a function. This return statement and return value depend upon the return
type of the function. The return statement in our program returns the value from main ().

4.5 KEYWORS OF C
auto break case char const continue default do

double else enum extern float for goto if

int long register return short signed sizeof static

struct switch typedef union unsigned void volatile while


Table 4.5 Keywords in C

Types of Operators in C
C has many built-in operators and can be classified into 6 types:
1. Arithmetic Operators
2. Relational Operators
3. Logical Operators
Bitwise Operators
4. Assignment Operators
4.6 PREPROCESSOR DIRECTIVES

Table 4.7 Preprocessor directives of C


39
ELECTRICAL AND ELECRTRONICS ENGINEERING
CHAPTER-5
ARDUINO
5.1 INTRODUCTION
Arduino is an Open-source-electronic-prototyping-base for simple used hardware and
software in the field of microcontrolling. It is suitable to realize fascinating projects in a short
time. Many of them can be found on YouTube under “Arduino” . It is mostly used by artists,
designers, or thinkers to realize creative ideas. But Arduino is also increasingly used by
universities and schools to teach an interesting and simple beginning to the world of micro
controlling.

5.2 TYPES OF ARDUINO

 Arduino Uno (R3)


 Arduino Nano.
 Arduino Micro.
 Arduino Due.
 Lily Pad Arduino Board.
 Arduino Bluetooth.
 Arduino Diecimila.
 Red Board Arduino Board.
Fig 5.2 Types of Arduino Boards

q the boards with the name Arduino on them are the official boards but there are also a
lot of really great clones on the market as well. One of the best reasons to buy a clone is the
fact they are generally less expensive than their official counterpart.

5.3 ARDUINO UNO


One of the most popular Arduino boards out there is the Arduino Uno. While it was not
the first board to be released, it remains the most actively used and most widely documented
on the market. Because of its extreme popularity, the Arduino Uno has a ton of project tutorials
and forums around the web that can help you get started or out of a jam.

Fig 5.3 Arduino Uno

40
ELECTRICAL AND ELECRTRONICS ENGINEERING
Here are the components that make up an Arduino board and what each of their functions are.
1. Reset Button – This will restart any code that is loaded to the Arduino board.
2. AREF – Stands for “Analog Reference” and is used to set an external reference voltage.
3. Ground Pin – There are a few ground pins on the Arduino, and they all work the same.
4. Digital Input/Output – Pins 0-13 can be used for digital input or output.
5. PWM – The pins marked with the (~) symbol can simulate analog output.
6. USB Connection – Used for powering up your Arduino and uploading sketches.
7. TX/RX – Transmit and receive data indication LEDs.
8. Microcontroller – This is the brain and is where the programs are stored.
9. Power LED Indicator – This LED lights up anytime the board is plugged into a power
source.
10. Voltage Regulator – This controls the amount of voltage going into the Arduino board.
11. DC Power Barrel Jack – This is used for powering your Arduino with a power supply.
12. 3.3V Pin – This pin supplies 3.3 volts of power to your projects
13. 5V Pin – This pin supplies 5 volts of power to your projects
14. Ground Pins – There are a few ground pins on the Arduino, and they all work the same.
15. Analog Pins – These pins can read the signal from an analog sensor and convert it too
digital.

5.4 ARDUINO POWER SUPPLY


The Arduino Uno needs a power source for it to operate and can be powered in a variety
of ways. You can do what most people do and connect the board directly to your computer via
a USB cable. If you want your project to be mobile, consider using a 9V battery pack to give
it juice. The last method would be to use a 9V AC power supply.

5.5 SOFTWARE
The software that is used to program the microcontroller is open-source software and
can be downloaded for free on www.arduino.cc. With this “Arduino software,” you can write
little programs that the microcontroller should perform. These programs are called “Sketch”.
In the end, the sketches are transferred to the microcontroller by USB cable. More on that later
the subject of “programming”.
Arduino Keywords
Digital I/O Time
 digital Read()  delay()
 digital Write()  millis()
 pinMode() Communication
Analog I/O  Print
 analog Read()  Serial
 analogReference()  SPI
 analog Write()

41
ELECTRICAL AND ELECRTRONICS ENGINEERING
Installation
Now one after another the Arduino software and the USB driver for the board have to
be installed.
 Installation and setup of the Arduino software.
1. Download the Arduino software on www.arduino.cc and install it on the computer (The
microcontroller is NOT connected to the PC). After that, you open the software file and start 6
the program named arduino.exe.
Two setups on the program are important and should be considered.
a) The board that you want to connect to must be selected on the Arduino software. The
“Funduino Uno” is here known as “Arduino / Genuino Uno”.
b) You must choose the right “Serial-Port”, to let the computer know to which port the
board has been connected. That is only possible if the USB driver has been installed
correctly. It can be checked this way:
c) 7 At the moment the Arduino isn't connected to the PC. If you now choose “Port”, under
the field “Tool”, you will already see one or more ports here (COM1/ COM2/
COM3…). The quantity of the shown ports doesn't depend on the quantity of the USB
ports on the computer. When the board gets connected to the computer, you will find
one more port.

Fig 5.5.2.1Board Selection Fig 5.5.2.2Port Selection

Installation of the USB driver


How it should be:
1. You connect the board to the computer.
2. The Computer recognizes the board and suggests installing a driver automatically.
Control: At the control panel of the computer, you can find the “Device Manager”. If the board
has been installed successfully, it should appear here. When the installation has failed, there is
either nothing special to find or you will find an unknown USB device with an 8 yellow
exclamation mark. In this case: Click on the unknown device and choose “update USB driver”.
Now you can start over with the manual installation.

42
ELECTRICAL AND ELECRTRONICS ENGINEERING
5.6 PROGRAMMING

Fading LED
Task: A LED should pulsating get brighter and darker (fade).
Required equipment: Microcontroller / one LED (blue) / resistor with 100 Ohm / Breadboard
/ cables
Setup:

Fig 5.6.1 Fading LED

Code:

int LED=9;
int brightness=0;
int fading=5;
void setup ()
{
pinMode(LED, OUTPUT);
}
void loop ()
{
analogWrite(LED, brightness);
brightness=brightness + fading;
delay (25);
if (brightness==0 || brightness== 255)
{
fading= -fading;
}}

43
ELECTRICAL AND ELECRTRONICS ENGINEERING
Push button and LED
Task: After pushing the button an LED is supposed to light up for 5 seconds.
Required equipment: Arduino / one LED (blue) / one resistor with 100Ohm / one resistor
with 1K Ohm (1000 Ohm) / Breadboard / Cables / Push button
Setup:

Fig 5.6.2 Push button and LED

Code:
int LEDblue=6;
int button=7;
int buttonstatus=0; 
void setup ()
{
pinMode(LEDblue, OUTPUT);
pinMode(button, INPUT);
}
void loop ()
{
buttonstatus=digitalRead(button);
if (buttonstatus == HIGH)
{
digitalWrite(LEDblue, HIGH);
delay (5000);
digitalWrite(LEDblue, LOW);
}
{
digitalWrite(LEDblue, LOW);
}
}

44
ELECTRICAL AND ELECRTRONICS ENGINEERING
Motion detector
Task: As soon as a motion gets detected, a piezo speaker should beep.
Required equipment: Arduino / motion detector/breadboard/cables / piezo speaker.
Setup:

Fig 5.6.3 Motion Detector

Code:
int piezo=5;
int movement=7;
int movementstatus=0;
void setup ()
{
pinMode(piezo, OUTPUT);
pinMode(movement, INPUT);
}
void loop ()
{
movementstatus=digitalRead(movement);
if(movementstatus==HIGH)
{
digitalWrite(piezo,HIGH);
delay (5000);
digitalWrite(piezo, LOW);
}
else
{
digitalWrite(piezo,LOW);
}
}

45
ELECTRICAL AND ELECRTRONICS ENGINEERING
Measurement of distance
Task: Measure a distance with the HC-SR04 ultrasonic sensor and show the result on the
serial monitor.
Required equipment: microcontroller board / cables / Breadboard / HC-SR04 ultrasonic
sensor

Fig 5.6.3 Measurement of distance

Code:
inttrigger=7;
int echo=6;
long time=0;
long dist=0;
void setup ()
{ Serial.begin (9600);
pinMode(trigger, OUTPUT);
pinMode(echo, INPUT);}
void loop ()
{ digitalWrite(trigger, LOW);
delay (5);
delay (10);
digitalWrite(trigger, LOW);
time = pulseIn(echo, HIGH);
dist = (time/2) / 29.1;
if (dist >= 500 || dist <= 0)
{ Serial.println("No measurement");}
else
{ Serial.print(dist);
Serial.println("cm");}
delay (1000); }

46
ELECTRICAL AND ELECRTRONICS ENGINEERING
Control a servo
Task: A servo has to turn to three different positions. Between the movements there should be
a short break.
Required equipment: Arduino / one servo / three cables
Setup:

Fig 5.6.4 Control of servo

Code:
#include <servo.h> //Include the servo library
Servo servoblue; //The servo gets the name “servoblue”
void setup ()
{
servoblue.attach(8); //The signal line of the servo is on pin 8
}
void loop ()
{
servoblue.write(0);
delay (3000);
servoblue.write(90);
delay (3000);
servoblue.write(180);
delay (3000);
servoblue.write(20);
delay (3000);

ELECTRICAL AND ELECRTRONICS ENGINEERING 47


LCD Display
Task: Show a text on an LCD Display.
Required equipment: Arduino / potentiometer / 14 cables / breadboard
Setup:

Fig 5.6.5 LCD Display

Code:
#include
Liquid Crystal lcd (12, 11, 5, 4, 3, 2);
void setup ()
{
lcd.begin(16, 2);
}
void loop ()
{
lcd.setCursor(0, 0);
lcd.print("up");
delay (2000);
lcd.clear();
lcd.setCursor(5, 1);
lcd.print("down");
delay (2000);
lcd.clear();

ELECTRICAL AND ELECRTRONICS ENGINEERING 48


CHAPTER 6
PYTHON PROGRAMMING
6.1 INTRODUCTION TO PYTHON:
It is a widely used general purpose, high level programming language. It was
mainly developed for emphasis on code read ability, and its syntax allows programmers to
express concepts in fewer lines of code.

Data types: Python has various standard data types that are used to define the operations
possible on then and the storage method for each of them.
The data stored in memory can be of many types. They are:
1.int 2.Float 3.boolean 4.string

List: It is a general purpose most widely used in data structures. List is a collection which is
ordered and changeable and allows duplicate members.

Variables: These are nothing but reserved memory locations to store values. This means that
when you create a variable you reserve some space in memory.

Expression: An expression is a combination of values, variables, and operators. An expression


is evaluated using assignment operator.

Identifiers: Any name that is used to define a class, function, variable module is an identifier.

Literals: These are language-independent terms in python and should exist independently in any
programming language. In python, there are string, byte, integer, floating and imaginary literals.

Operators: You can implement the following operations using the corresponding tokens.
1. add(+)
2. subtract(-)

3.multiply(*)
4.integerdivision(/)
5.remainder(%)
6.and(&)
7. or(|)

8.binaryleftshift(<<)
9.binaryrightshift(>>)
10.lessthan(<)
11.greaterthan(>)
12.equality(==)

ELECTRICAL AND ELECRTRONICS ENGINEERING 49


Statements: A statement is an instruction that the python interpreter can execute. We have
normally two basic statements. They are:
1. Assignment statement

2. Printstatement

Modules: Python module can be defined as a python program file which contains a python code
including python functions, class or variables.

Functions: It is a group of related statements that perform a specific task. Functions help break
our program into smaller and modular chunks. These are divided into two types:
1. Build-in functions
2. User-defined functions

There are three types of python function arguments using which we can called function.
1. Default arguments
2. Keyword arguments
3. Variable-length arguments

6.2 CONTROL FLOWS AND LOOPS:


Boolean values and operators: A Boolean expression is expression that is either true or false.
The operator== which compares two operands and produces true if they equal otherwise false.

Conditional(if): The if statement contains a logical expression using which data is compared
and a decision is made based on the result of the comparison.

Alternative if(if-else): An else statement can be combined with an if statement. An else


statement contains the block of code that executes if the conditional expression in the if
statement resolves to zero or a false value.

Chained conditional(if-el if-else): The el if statement allows us to check multiple


expressions for true and execute a block of code as soon as one of the conditions evaluates to
true.

Iteration: A loop statement allows to execute statement or group of statements multiple times as
long as condition is true. Repeated execution of a set of statements help of loops called iteration.

Statements: In python statements iteration statements are three types:

i. For loop
ii. While loop
iii. Nested for loop

ELECTRICAL AND ELECRTRONICS ENGINEERING 49


Break: The break statement terminates the loop containing it and control of the program flows
to the statement immediately after the body of the loop. If break statement is inside an nested
loop( loop inside the another loop),break will terminate the inner most loop.

Continue: The continue statement is used to skip the rest of the code inside a loop for the
current iteration only. Loop does not terminate but continues on with the next iteration.

Pass: It is an full statement. The difference between a comment and pass statement in python
is that, while the interpreter ignores a comment entirely, pass is not ignored. Pass is just a
place holder for functionality to be added later.

6.3 FUNCTIONS AND ARRAYS:

Fruitful functions : We write functions that returns values, which will call fruitful functions.
We have seen return statement before, but in fruitful function return statement includes
return value.

Return function: The keyword return is used to return back the value to the called function.
Parameters: These are passed during the definition of function while arguments are passed
during the function call.

Local space: A variable which is defined inside a function is local to the function. It is accessible
for the point at which it is defined until the end of the function.

Global space: A variable which is define in the main body of a file is called a global
variable. It will be visible throughout the file, and also inside any file which imports that file.

ELECTRICAL AND ELECRTRONICS ENGINEERING 51


Function composition: Having two functions where output of one function is input for
another.
Immutability: It is tempting to use the [] operator on the left side of assignment, with the
intension of changing a character in a string.

String: It is a sequence of characters. This is how we declare a string. We can use a pair of
single or double quotes. Every string object is of the type ‘str’. The string functions are

1.is a num() 2.is alpha () 3.is digit() 4.is lower() 5.is numeric() 6.escape() 7.is title() 8.is
upper() 9.replace(old, new[,max])10.split() 11.count() 12.find() 13.swapcase()
14.startswitch()

 All the string methods will be returning either True or False as the result.
Template: These class is used to create a string template for simpler string substitutions.
Array: It is a container which can hold a fixed number of items and these items must be of
the same type. Most of the data structures makes us of arrays through implement their
algorithms.

Basic operations of array: Following are the basic operations supported by an array.
1.Traverse 2.Insertion 3.Deletion 4.Search 5.Update
Array methods: Python has a set of built-in methods that you can use on arrays. They are:
1.append() 2.clear() 3.copy() 4.count() 5.extend() 6.index
7.insert() 8.pop() 9.remove() 10.reverse 11.sort()

6.4 LISTS, TUPLES, AND DICTIONARIES:


List: It is most widely used in data structures. It is a collection which is ordered and change
able and allows duplicate methods. To use a list declared using square brackets.
List operations: These operations include looping, indexing, slicing, adding and multiplying.

List methods: The list data types has some more methods here are all of the methods of list.

1.Del() 2.Append() 3.Extend() 4.Insert() 5.Pop( ) 6.Remove() 7.Reverse() 8.Sort()

Mutability: These objects can be changed after it is created, and an immutable objects can’t.

Aliasing: It is a second name for a piece of data. It happens whenever one variables value is
assigned to another variable. If data can change, aliases can result in lot of hard-to-find bugs.
List comprehension: It provides a concise way to create lists. Common applications are to
make new list where each element is the result of one operation applied to each member of
another sequence or to create a sub sequence of those elements that satisfy a certain
condition.

ELECTRICAL AND ELECRTRONICS ENGINEERING 52


Tuples: It is a collection which is ordered and unchangeable. These are returning round
brackets. These are more efficient that list. Some of the operations of tuple are:
1.Access tuple items 2.Count() 3.Change tuple items 4.Index() 5.Loop through a tuple

6. Length()

Tuple assignment: These assignment feature enable to assign more than one variable at a

time.

Tuple comprehension: The result of a tuple comprehension is special. You might expect it
to produce a tuple, but what it does is object that we can iterate over.
Tuple as return values: A tuple is a common separated sequence of items. It is created with
or without(). Tuples are immutable.
Dictionaries: It is a collection which is in ordered changeable and indexed. These are return
with curly brackets, and they have keys and values. Following are the methods of
dictionaries:
1.clear() 2.copy() 3.fromkeys(seq[,v]) 4.get(key[,d]) 5.item() 6.keys()
7. pop(key[,d]) 8.popitem() 9.setdefault(key[,d]) 10.update([other]) 11.values()

 Dictionary operators are: 1.Add/change 2.Remove 3.Length 4.Delete


Dictionary comprehension: It can be used to create dictionaries from arbitrary key and
value expression.

6.5 FILES,EXCEPTIONS, MODULES AND PACKAGES:


Files: A file is some information or data which stays in the computers to rage devices.
Python gives you easy way to manipulate these files. Generally file divided into two
categories:
1.Textfiles 2.Binaryfiles
Exception: It is an event, which occurs during the execution of a program that disrupts the
normal flow of the programs instructions.

ELECTRICAL AND ELECRTRONICS ENGINEERING 53


Command line argument: It must be given whenever we want to give the input before
the start of the script, while on the other hand, raw_ input() is used to get input while the

script is running .
Errors and Exceptions: Python rises exceptions when it encounters errors. When writing a
program, we more often will not encounter error caused by not following the proper
structure of the language is called syntax error. Types of errors are:
1.Zerodivision 2.Overflow 3.Import 4.Index 5.Type 6.Indentation 7.Syntax 8.Runtime

9.Key

Different types of Exceptions: 1.Array Index out of Bound Exception 2.IO Exception

3.ClassNotFound 4.FileNotFound 5.Interupted 6.NoSuchField

7.NoSuchMethod

Handling Exceptions: The cause of an exception is often external to the program itself. The
exception should be properly handled so that an abrupt termination of the program is
prevented.
Module: It refers to a file containing python statements and definitions. We use modules to
break down large programs in to small manageable and organized files. Types of modules:
1. Date module 2.Time module 3.Osmodule 4.Calendermodule
5.Mathmodule

Packages:
 We don’t usually store all of our files in our computer in the same location we use a well
organized hierarchy of directories for easier access.
We plays singular modules in one package and different modules in different package.

ELECTRICAL AND ELECRTRONICS ENGINEERING 54


CHAPTER 7
INTERNET OF THINGS (IOT)
7.1 INTRODUCTION TO IOT:
Today the Internet has become ubiquitous, has touched almost every corner of the
globe, and is affecting human life in unimaginable ways. The Internet of Things (IOT) refers to
the network of physical devices that connect to the internet, enabling them to collect, share, and
analyze data. This concept extends beyond traditional computing devices, encompassing a wide
range of everyday objects like home appliances, vehicles, and wearable technology.
KEY COMPONENTS OF IOT:
Devices and Sensors: These are the physical objects equipped with sensors that collect data.
Examples include smart thermostats, fitness trackers, and connected appliances.
Connectivity: IOT devices need a way to communicate with each other and with centralized
systems. This can be through Wi-Fi, Bluetooth, cellular networks, or other protocols.
Data Processing: Once data is collected, it needs to be processed. This can occur on the
device itself, in the cloud, or on local servers.
User Interface: Users interact with IOT systems through applications, dashboards, or web
interfaces, allowing them to monitor and control devices.

APPLICATIONS OF IOT:

 Smart Homes: Automation of household systems like lighting, heating, and security.
 Healthcare: Wearable devices that monitor health metrics and transmit data to healthcare
providers.
 Industrial IOT: Use of connected machinery for monitoring and optimizing production
processes.
 Smart Cities: Enhancements in infrastructure, such as traffic management and waste
management, to improve urban living.

CHALLENGES AND CONSIDERATIONS

 Security: Ensuring data protection and device security is crucial, as connected devices can
be vulnerable to cyber attacks.
 Interoperability: Different devices and platforms need to work together seamlessly.
 Data Privacy: Managing and protecting user data is essential, especially in sensitive
applications like healthcare.

FUTURE OF IOT

The potential for IOT is vast, with predictions of billions of connected devices in the coming
years. This growth will drive innovations in AI, machine learning, and data analytics, enabling
smarter solutions across various sectors

7.2 HISTORY OF IOT:

55
ELECRTRONICS &COMMUNICATION ENGINEERING
The history of the Internet of Things (IOT) traces back several decades, marked
by key developments in technology and connectivity. Here’s a brief overview:

1960s-1980s:EARLY CONCEPTS

 1960s: The idea of interconnected devices began with ARPANET, the precursor to the internet,
which connected various computers for data sharing.
 1982: One of the earliest examples of IOT was a modified Coke vending machine at Carnegie
Mellon University, which could report its inventory and whether drinks were cold.

1990s: THE BIRTH OF THE TERM

 1999: The term "Internet of Things" was coined by Kevin Ashton, a British technology pioneer,
during a presentation at Procter & Gamble. He used it to describe a system where the internet
connects to the physical world through sensors.

2010s: EXPANSION AND DEVELOPMENT

 2010: The launch of the IPv6 protocol allowed for a virtually limitless number of IP addresses,
facilitating the connection of billions of devices.
 2011: Major tech companies, including IBM, Cisco, and GE, began investing heavily in IOT
technologies, leading to the development of smart homes and industrial IOT solutions.

2020s: MATURITY AND INTEGRATION

 2020: The COVID-19 pandemic accelerated the adoption of IOT technologies for remote
monitoring and smart health solutions.
 2021-2023: Continued advancements in AI, machine learning, and edge computing enhanced IOT
capabilities, leading to smarter and more efficient systems across various sectors.

7.3 CLOUD:
In networking, the cloud is a global network of server that are connected and work
together as a single system.
CLOUD COMPUTING :
Cloud networking, also known as virtual cloud networking is the use of cloud based
services to connect an organization resources, applications and employees .

TYPES OF CLOUD COMPUTING :

56
ELECRTRONICS &COMMUNICATION ENGINEERING
IOT ARCHITECTURE :

ELECRTRONICS &COMMUNICATION ENGINEERING 57


7.4 SENSORS:
A device that detects and measures changes in the physical world and sends
the data to a network for analysis.
APPLICATIONS OF SENSOR :
 Smart homes
 Health monitoring
 Manufacturing
 Environmental management
TYPES OF SENSORS :
1. Temperature sensor
2. Motion sensor
3. Light senor
4. Gas sensor
5. Pressure sensor
6. Humidity sensor
7. Alcohol sensor
8. Ultra sonic sensor

7.5 ACTUATOR
A device that converts energy into motion to control (or) move a system(or)mechanism.
TYPES OF ACTUATOR:
1. Electric linear actuator
2. Electric rotary actuator
3. Hydraulic linear actuator
4. Hydraulic rotary actuator
5. Piezoelectric actuator

7.6 WIRELESS TECHNOLOGY :


Wireless technology is a method of connection with in an iot system
that includes sensors, platforms, routers, applications and other systems.

58
ELECRTRONICS &COMMUNICATION ENGINEERING
TYPES OF WIRELESS NETWORK:

1. Cellular network
2. Local area network(LAN/PAN)
3. Low power wide area network(LPWAN)
4. Mesh protocols

7.7 DATA MANAGEMENTS AND ANALYTICS:


Iot analytics is used to derive understanding from the massive amount of
data for actionable insight. Analytics can be categorized in three catagories:

 Historical analytics
 Real-time analytics
 Predictive analytics

THE IOT ANALYTICS LIFECYCLE :


1. GENERATE:
The first step for any IoT project is to generate some data. For equipment
manufacturers, this is likely telemetry data from your machines, like voltage, temperature,
rpm, flow rate, or fuel level. For smart building applications, this is probably data like room
occupancy, motion, office temperature, and air quality.

2. COLLECT:
Once the data is generated, it must be collected in a central repository that can be
accessed and queried by your team. This repository is sometimes called a data warehouse or
data lake. Implementing your own data warehouse can be a challenge, especially for
companies that may not have existing internal expertise in managing a large data
infrastructure.
3. ANALYZE:
Now that the data is stored, it can be analyzed. This is also an inflection
point on the analytics lifecycle when it comes to the value of your data. While there is some
amount of value in generating and collecting data, this is the point at which you can start
delivering real ROI.
4. REACT:
If your company can reach the React stage in the analytics lifecycle, you’ll
begin to see significant value being added to your organization. The React stage is about
automatically making real-time decisions from your data that feed back into a business
process.

59
ELECRTRONICS &COMMUNICATION ENGINEERING
5. PREDICT:
Predicting the future can be the end-result of successfully traversing all
stages of the IoT Analytics Lifecycle. The Predict stage is about identifying the predictive
indicators that lead to eventual failures.

TYPES OF DATA ANALYTICS:

There are four major types of data analytics:


1. Predictive (forecasting)
2. Descriptive (business intelligence and data mining)
3. prescriptive(optimization and simulation)
4. Diagnostics analytics

7.8 IOT PLATFORMS AND TOOLS:


PLATFORMSTOOLS
1. Microsoft azure 1. Arduino
2. Google cloud 2.Raspberry pi
3. AWS 3.Flutter
4. Cisco 4.kinoma
5. Oracle 5.Zetta
IOT PRIVACY AND SECURITY:
 Encrypt all data being transferred.
 Use strong passwords and two factor authentication to prevent unwanted access.
 Employ access controls so only authorized users can access iot devices.
 Update firmware consistently to patch vulnerabilities.
TOP IOT TRENDINGS:
1. Smart cities. 4. Iot security.
2. Traffic management. 5. Block chain.
3. Digital twins. 6. Voice activated iot deivce.

60
ELECRTRONICS &COMMUNICATION ENGINEERING
CHAPTER-8
RASPBERRY PI
8.1 INTRODUCTION
The Raspberry Pi is a debit card-sized low-cost computer that connects to a computer
Desktop or TV and uses a standard mouse and Keyboard. It has a dedicated processor, memory,
and a graphics driver, just like a PC. It also comes with its operating system, Raspberry Pi OS,a
modified version of Linux. Raspberry Pi can browse the internet and stream high-definition
video, as well as spreadsheets, word processing, and gaming, just like a desktop computer. The
Raspberry Pi can communicate with the outside world and has been used in various digital
maker projects, including music machines and parent detectors, weather stations, and tweeting
birdhouses with infrared cameras.

Fig 6.1 Raspberry Pi

People worldwide use Raspberry Pi to learn how to program and understand how
computers function. Although the Raspberry Pi lacks storage, you can use micro SD cards to
store whichever operating system you choose (Raspberry Pi, Ubuntu Mate, etc.). Because the
Raspberry Pi has Bluetooth, Ethernet, and Wi-Fi connectivity, it may transfer files over the
internet. The software and the design of the Raspberry Pi project are not open source.

8.2 RASPBERRY PI APPLICATIONS

Fig 6.2 Raspberry Pi Applications

61
ELECRTRONICS &COMMUNICATION ENGINEERING
8.3 TYPES OF
RASPBERRY PI
 Raspberry Pi model B
 Raspberry Pi model A
 Raspberry Pi model B+
 Raspberry Pi Model A+
 Raspberry Pi Zero
 Raspberry Pi 2
 Raspberry Pi 3 Model B
 Raspberry Pi 4
 Raspberry Pi Zero W Fig 6.3 Types of Raspberrys Pi

Advantages
 The Raspberry Pi is a small computer that is roughly the size of a credit card.
 Using a group of Raspberry Pi’s to function as a server is more efficient than using
a regular server.
 The Raspberry Pi is ideal for adaptive technology
Disadvantages
 It is not a computer replacement, and the processor is not as fast. Downloading and
installing software takes time so you won't do any intricate multitasking.
 Other operating systems, such as Windows, are incompatible.
 Not able to run Windows Operating system.

8.4 SETTING UP YOUR RASPBERRY PI

For setting up your Raspberry Pi. It is categorized into two types: -


1.Hardware. 2.Software.
HARDWARE
Step 1-Choosing the right power supply.

Step 2-Connecting a display.

Step 3- SD Cards for Raspberry Pi

Step 4- Connecting to the internet.

Step 5- Connecting a keyboard and mouse.

Step 6- Connecting audio.

Hardware Installation is completed.

62
ELECRTRONICS &COMMUNICATION ENGINEERING
8.5 SOFTWARE
Step 1- Download and install the latest version of Raspberry Pi Imager (Raspberry Pi OS
called Raspberry Pi Imager) on your SD card and you can download the Imager from this link
https://www.raspberrypi.com/software. Turn on the monitor and you will see this

Step 2- Choose device and select your


Raspberry Pi model from the list.

Step 3- Select the OS you want to install.


The current recommended version of
Raspberry Pi OS is always at the top of the
list.

Step 4- If you have more than


one mountable storage device
connected to your computer,
make sure you choose the
correct card.
Step 5 -(Optional) In a popup, Fig 6.6.2 Selection of Device & OS
Imager will ask you to apply OS
customisation. We strongly
recommend configuring your
Raspberry Pi via the OS
customisation settings. Click the
EditSettings button to open OS
customisation.
If you plan to use your Raspberry Pi remotely over your network, check the box next
to Enable SSH. You should enable this option if you plan to run a headless Raspberry Pi.
 Choose the password authentication option to SSH into your Raspberry Pi over the
network using the username and password you provided in the general tab of OS
customisation.
 Choose Allow public-key authentication only to pre-configure your Raspberry Pi for
password less public-key SSH authentication using a private key from the computer
you’re currently using. If you already have an RSA key in your SSH configuration,
Imager uses that public key. If you don’t, you can click Run SSH-keygen to generate a
public/private key pair. Images will use the newly generated public key.
OS customisation also includes an Options menu that allows you to configure the behaviourof
Imager during a write. These options allow you to play a noise when Imager finishes
verifying an image, to automatically unmount storage media after verification, and to disable
telemetry.
Now, Click save
Finally, respond Yes to the "Are you sure you want to continue?" popup to begin writing data
to the storage device.
If you see an admin prompt asking for permissions to read and write to your storage medium,it’s
safe to proceed.
Grab a cup of coffee or go for a walk. This could take a few minutes.
When you see the "Write Successful" popup, your image has been completely written and
verified. You’re now ready to boot a Raspberry Pi from the storage device!

63
ELECRTRONICS &COMMUNICATION ENGINEERING
Step 6- Network Install enables a Raspberry Pi to install an operating system on a storage
device using a version of Raspberry Pi Imager downloaded over the network. With Network
Install, you can get an operating system installed on your Raspberry Pi with no separate SD
card reader and no computer other than your Raspberry Pi. You can run Network Install on
any compatible storage device, including SD cards and USB storage

Network Install only runs on Raspberry Pi 4, 400. If your Raspberry Pi runs an olderbootloader,
you may need to update the bootloader to use Network Install.
Network Install requires the following:
 a compatible Raspberry Pi model running firmware that supports Network Install
 a monitor
 a keyboard
 a wired internet connection
.
To launch Network Install, power on your Raspberry Pi while pressing and holding
the SHIFT key in the following configuration:
 no bootable storage device
 attached keyboard.
 attached compatible storage device, such as an SD card or USB storage.
If you haven’t already connected your Raspberry Pi to the internet, connect it with an
Ethernet cable.
Once you’re connected to the internet, your Raspberry Pi will download Raspberry Piinstaller.
If the download fails, you can repeat the process to try again.
Eventually it should start the Raspberry Pi Imager application allowing you to install a fulloperating
system to a blank SD Card or a USB Drive.

After installing an operating system image, connect your storage device to your Raspberry Pi.
First, unplug your Raspberry Pi’s power supply to ensure that the Raspberry Pi is powered
down while you connect peripherals. If you installed the operating system on a microSD card,
you could plug it into your Raspberry Pi’s card slot now. If you installed the operating system
on any other storage device, you could connect it to your Raspberry Pi now.
Then, plug in any other peripherals, such as your mouse, keyboard, and monitor.
Finally, connect the power supply to your Raspberry Pi. You should see the status LED light
up when your Pi powers on. If your Pi is connected to a display, you should see the boot screen
within minutes. If you chose to skip OS customisation in Imager, your Raspberry Pi will run a
configuration wizard on the first boot. You need a monitor and keyboard to navigate through
the wizard; a mouse is optional.
Step 6-Set up Bluetooth devices.
Step 7-Set country.
Step 8-Create user.
Step 9-Select a wireless network.
Step 11-Select a default browser.

ELECRTRONICS &COMMUNICATION ENGINEERING 64


Step 12-Check for software updates
Finish

Software Installation is completed

ELECRTRONICS &COMMUNICATION ENGINEERING 65


CONCLUSION

Training at CITD Auto Nagar was a great learning experience, both


technically and personally. The training provided by them with valuable
knowledge and skills in various aspects of electrical and electronic systems.
We have learned about different Technologies, Implementation methods and
industrial management methods. With this training, we gained hands-on
practice in Analyzing, Designing, Implementing, Coding, and Testing
Electrical and Electronic Devices, and We also worked with hardware
components such as Digital ICs, ARM7, Arduino, IOT, PYTHON and
Raspberry Pi, and learned knowledge about different software tools like Keil
C, Proteus 8 Professional, Turbo C, and Arduino tools & tinker cad And
we also done some real- time projects and we concluded that industrial
training provided enhanced academic knowledge and prepared us for our
future employment opportunities in the field of Electrical and Electronic
Engineering.

66
ELECRTRONICS &COMMUNICATION ENGINEERING
Future Scope
The course in Electrical and Electronics Engineering offers promising future
prospects in various fields. Some of the potential career opportunities include:

 Graduates can work in the power generation, transmission, and


distribution sectors, designing and maintaining electrical grids and
power systems.

 There are opportunities in the telecommunications industry, designing


and developing communication systems, mobile devices, and
networking technologies.

 With the increasing focus on sustainable energy sources, graduates can


contribute to the development and implementation of renewable energy
systems such as solar power, wind power, and hydroelectric power.

 Graduates can work in industries that require automation and control


systems, such as manufacturing, robotics, and process control.

 There is a growing demand for professionals skilled in designing and


programming embedded systems used in various applications like
automotive, aerospace, and consumer electronics.

Overall, the field of electrical and electronics engineering offers a wide range of
career opportunities with the potential for growth and innovation.

We concluded that Industrial training is merged a great knowledge in


academics with learning and earning to furnish the bright future during the
employability and to establish a new firm /entrepreneurship to create the jobs
based on new innovative real-time projects in the subject of electrical and
electronics engineering."

ELECRTRONICS & COMMUNICATION ENGINEERING 67


ELECRTRONICS & COMMUNICATION ENGINEERING 68
ELECRTRONICS & COMMUNICATION ENGINEERING 69

You might also like