Iot Hardware Development for 9 Th
Iot Hardware Development for 9 Th
Hardware Development
IX
Internet of Things
Hardware Development
Grade – IX
i|Page
Author: Muhammad Umair researcher,Sensors Cloud and Services (SCS)
Lab, School of Computer Sciences
Reviewers:
1. Dr. Ahmed Mustafa, Chief Instructor, P-TEVTA, Lahore
2. Dr. Hina Khalid, Assistant Professor, UET, Lahore
3. Mr. Atif Anees, DACUM Facilitator
4. Ms. Mansoorah Ibrahim, Education Officer, NCC, Islamabad
5. Mr. Muhammad Asim, Coordinator, NAVTTC
Designing: Gul Awan Printers, Blue Area, Islamabad.
Edition: 1st Edition, 2022
ISBN:
Publishers: National Vocational & Technical Training Commission H-9, Islamabad.
Website: www.navttc.gov.pk,
All rights are preserved with the National Vocational and Technical Training Commission. No
part of this book can be copied, translated, reproduced or used for guide books, key notes,
helping books etc. without permission of NAVTTC.
Note: Names of Curriculum Developers will be part of curriculum document. In the book there
will be names of reviewers only.
ii | P a g e
PREFACE
This book has been written to meet the requirements of Matric Tech to train the students
in the trade Internet of Things (IoT). This book is specific for IoT hardware development.
Matric-Tech in IoT has been introduced for the first time in the history of Pakistan. This
textbook is the first national effort to describe all the topics related to IoT hardware
development in a single book. A key attempt has been made to make the book interesting
and useful. All the chapters presented in this book cover the required basic details in a
manner understandable to the students of Matric Tech. All the chapters include
assessments in form of MCQs, short questions and long questions.
The book covers 40% theoretical and 60% practical content. This content is equally
helpful for the students of electronics, computer sciences and networking.
Any improvements and suggestions for the betterment of this book will be highly
appreciated.
Executive Director
National Vocational & Technical Training Commission
(NAVTTC)
iii | P a g e
Table of Contents
Sr. No. Chapter Name Page Number
1. Basic Electrical Theory 1
1.1 Basic Principle of Electricity 2
1.2 Ohm’s Law 9
1.3 Cells and Batteries 12
2. Electric Circuits 22
2.1 Basic Components of Electric Circuits 23
2.2 Kichoff’s Voltage Law 26
2.3 Kirchoff’s Current Law 30
3. Fundamental Electronics-I for IoT 37
3.1 PN Junction 38
3.2 Diodes 39
3.3 Zener Diode 46
3.4 BJTs 51
4. Electronics-2 for IoT 59
4.1 Field Effect Transistors 60
4.2 JFETs 63
4.3 MOSFETs 66
4.4 Thyristors 70
4.5 UJT 71
5. Introduction to Microcontrollers 81
5.1 Microcontrollers 82
5.2 Arduino 84
5.3 Arduino IDE 85
5.4 Connecting an Arduino with Computer System 92
5.5 Programming Arduino 95
6. Work Heath and Safety 101
6.1 Basics of Work Health and Safety 102
6.2 WHS in IoT Environments 107
iv | P a g e
Chapter 1
Basic Electrical Theory
1|Page
Chapter 1
2|Page
Chapter 1
Power Transmission
Powerplant
Power Distribution
Grid Station
Voltage
A voltage is a potential difference between two points of an electric circuit. A voltage is
the pressure from an electrical power source that causes current in an electric circuit.A
voltage is like a diffusion phenomenon as shown in Figure 1.2. A voltage is represented
by V and is measured in volts (V).
Current
Flow of charges inside an electric circuit is called electric current. An electric power
source such as a battery consists of high number of charged particles which creates a
potential difference between two points of an electric circuit, causing current. Figure 1.3
shows an analogy between water and current. A current is represented by Iand is
measured in amperes (A).
3|Page
Chapter 1
Do you know?
A voltage is just like diffusion
phenomenon in an electric circuit.
Resistance
A resistance is a component opposing the current flow in an electric circuit. The higher
the value of resistance, more will be the opposition. A resistance is represented by R and
is measured in ohms (Ω).
4|Page
Chapter 1
AC and DC Quantities
There are two types of current. Direct Current (DC) and Alternating Current (AC).
Magnitude (value) and direction of DC remains constant while AC keeps on changing its
direction. Similarly, there exists AC and DC voltages.
Point to Ponder
Why there exists two different types of quantities: AC and DC voltage and current?
Conductors
Current can flow in conductors. Conductors have free electrons on its surface which
allow current to pass through easily. They are made up of atoms having free electrons.
Copper, silver and aluminum are good conductors of electricity.
Insulators
Insulators are made up of material that do not allow electricity to pass through it. They
are made up of atoms that do not have free electrons. Plastic, glass and rubber etc. are
good insulators for electricity.
5|Page
Chapter 1
Semi conductor
Semiconductors have limited free electrons so their conductivity lies between conductors
and Insulators. Silicon and germanium are semiconductors.
Activity
Identify conductors and insulators of heat in your home.
Point to Ponder
Is a good conductor of heat also a good conductor of current?
Electric Power
Electric power of an electric circuit or appliance is the rate at which it consumes energy.
Unit of Power is Watt which is 1 Joule per second. Equation 1 represents power in terms
of energy.
Δ𝐸 -----------------------------(1)
𝑃=
Δ𝑡
ΔE is work being done. So, equation 1.1 can be rewritten as:
𝑊𝑄
𝑃= ----------------------------(2)
𝑄 𝑡
Voltage is basically the work done (W) per unit charge (Q). While current is charge per
unit of time. So, equation 1.2 can be rewritten as:
𝑃 = 𝑉𝐼 ----------------------------(3)
Electric Energy
It is a form of energy resulting from flow of electrons. It is usually derived from power.
Most common unit of consuming energy is in terms of kWh, that is equivalent of using 1
6|Page
Chapter 1
kilowatt power for one hour. kWh is also used as a unit for computing electricity bill by
energy suppliers.
Do you know?
When purchasing an electric appliance, consumer asks for the power rating (Watts)
of the appliance, which is the rate at which it will consume energy.
Activity
Compute the static load (total power rating of all the appliances in your home).
From your electric energy meter, note down the units which you have consumed.
Ohm Meter
An ohm meter is a device to measure resistance. Connecting leads of ohm meter are
connected with the resistance to measure and display the resistance on ohm meter.
7|Page
Chapter 1
Voltmeter
A voltmeter is used to measure voltages. Probes of voltmeter are connected with the
terminals of the circuits across which voltages are to be measured. A voltmeter is always
connected in parallel across a component whose voltages are to be measured.
Ammeter
An ammeter is used to measure current. Probes of
ammeter are connected with the terminals of the
circuits across which current is to be measured. It
should be noted that ammeter is always connected
in series (as shown in Figure 1.8) in the circuit
whose current is to be measured.
Fig 1.8 Ammeter
8|Page
Chapter 1
Oscilloscope
An oscilloscope is a laboratory instrument commonly used to display and analyze the
waveform of electronic signals. It draws a graph of the instantaneous signal voltage in
terms of time.
There are multiple controls on an oscilloscope. Scale of x-axis and y-axis can be adjusted.
There is a separate control to adjust the time scale of x-axis. To scale the y-axis, there is a
knob called voltage/div. There are multiple channels on an oscilloscope. This means you
can plot different signals simultaneously. To calibrate the oscilloscope, a probe is
connected on an input of a channel and the other end is connected to the calibration
terminal. The resulting waveform is then calibrated on the required scale.
𝑉 ∝𝐼 ----------------------------(4)
9|Page
Chapter 1
This means that higher the voltage across a component, more will be the current through
it. Introducing a constant of proportionality in equation (4):
𝑉 = 𝐼𝑅 ----------------------------(5)
Resistance (R) is the constant of proportionality. From equation (5), we can find the third
parameter if we know two of them.
Example 1.1
If the resistance of an electric hearth is 50 Ω and a current of 3.2 A flows through the resistance. Find
the voltage across resistance.
Solution:
If we are asked to calculate the value of voltage with the value of current and resistance given to us,
then cover V in the triangle. Now, we are left with I and R or more precisely I × R.
Therefore, we use the following formula to calculate the value of V:
V=I×R
V = 160V
Example 1.2
A voltage source of 8.0 V is connected to a purely resistive electrical appliance (a light bulb). An
electric current of 2.0 A flows through it. Assume the conducting wires to be resistance-free.
Calculate the resistance offered by the electrical appliance.
Solution:
When we are asked to find out the value of resistance when the values of voltage and current are
given, then we cover R in the triangle. This leaves us with only V and I, more precisely V ÷ I.
Substituting the values in the equation, we get
R=V÷I
R=8V÷2A=4Ω
R=4Ω
10 | P a g e
Chapter 1
Calculating Electrical Power Using Ohm’s Law
Ohm’s Law can be used to rewrite equation 1.3. The power formula written in terms of
ohm’s law is:
𝑃 = (𝐼𝑅) 𝐼 = 𝐼 2 𝑅 ----------------------------(6)
or
𝑉 𝑉2 ----------------------------(7)
𝑃=𝑉 =
𝑅 𝑅
Example 1.3
If the current and voltage of an electric circuit are given as 2.5A and 10V
respectively. Calculate the electrical power?
Example 1.4
Calculate the power of an electrical circuit consisting of resistance 3Ω and a current
4A flowing through this circuit?
Solution:
Given parameters are,
I = 4A and R = 3Ω
Electric power formula is,
P = I2 R
P = 42×3
P = 16×3 = 48 watts
11 | P a g e
Chapter 1
Battery
Series and Parallel Connection of Cells/Batteries
Different batteries can also be tied together to enhance voltage and current capacity.
Series Connection: A series connection is formed when positive terminal of one battery
is connected with the negative terminal of the other battery. Series connection increases
the voltage capacity of the battery bank but current capacity remains the same.
12 | P a g e
Chapter 1
connected together. Parallel connection increases the current capacity of the battery bank
while voltage rating remains the same.
Point to Ponder
What is the voltage rating of a UPS battery?
Voltage of a battery is DC or AC.
Do you know?
The voltage rating of a laptop battery is 19.5V and is usually formed of 6 cells.
Importance of Batteries
A battery provides portability to a device / appliance.
The main purpose of the batteries is to store electrical energy.
Rechargeable batteries enable multiple times usage of batteries.
Size of battery is very crucial to use it in a specific application.
1.3.1 Types of Batteries
There are four main types of secondary batteries:
Lead – Acid Batteries
Nickel – Cadmium Batteries
Nickel – Metal Hydride Batteries
Lithium – Ion Batteries
Lead–Acid Batteries: Lead-acid batteries are the most widely Lead-Acid Battery
13 | P a g e
Chapter 1
14 | P a g e
Chapter 1
oxidation reaction, one electrode gets negatively charged called cathode and due to the
reduction reaction, another electrode gets positively charged called anode.
The cathode forms the negative terminal whereas anode forms the positive terminal of a
battery. To understand the basic principle of battery properly, first, we should have some
basic concept of electrolytes and electrons affinity. Actually, when two dissimilar metals
are immersed in an electrolyte, there will be a potential difference produced between
these metals.
It is found that, when some specific compounds are added to water, they get dissolved
and produce negative and positive ions. This type of compound is called an electrolyte.
The popular examples of electrolytes are almost all kinds of salts, acids, and bases etc.
The energy released during accepting an electron by a neutral atom is known as electron
affinity.
If two different kinds of metals are immersed in the same electrolyte solution, one of
them will gain electrons and the other will release electrons.The metal with low electron
affinity will gain electrons from the negative ions of the electrolyte solution. Whereas,
the metal with high electron affinity will release electrons and these electrons come out
into the electrolyte solution and are added to the positive ions of the solution. In this way,
one of these metals gains electrons and another one loses electrons. Therefore, there will
be a difference in electron concentration between these two metals.
15 | P a g e
Chapter 1
16 | P a g e
Chapter 1
Visual Test
Check the container, cover and terminals. If physical damage is present, replace
the battery.
Check the indicator (If the battery has the indicator). Always look right down
when viewing the indicator and lightly tap the indicator on the battery to dislodge
any air bubbles.
Voltage Test
If voltage is below 12.4V, recharge the battery immediately.
Load Test
Connect the battery tester to battery terminals.
Measure the temperature of the battery around.
Apply the load for 15 seconds and read the voltage.
If the voltages drop significantly, recharge the battery and test again.
If the battery fails the load test twice, replace it.
17 | P a g e
Chapter 1
Gravity Test
The most accurate and direct way to test the state of charge of a battery cell is to
determine the specific gravity of the battery electrolyte. The higher the specific gravity of
the electrolyte the higher the state of charge.
Hydrometer: Hydrometer is used to perform gravity test. Hydrometers come in many
sizes and shapes. A hydrometer with a float is recommended, contained in a glass vessel
with a rubber bulb to draw the acid into the tube. Stay away from floating-colored balls
as the extra inaccuracy results in very subjective testing. The hydrometer should give you
a numeric reading directly from the instrument. A good hydrometer is accurate to +/-
0.005 points so 1.265 could read from 1.260-1.270. The instrument accuracy should be
known.
Test
It is recommended to disconnect the battery especially if on a high rate of
charge/discharge.
Remove vent cap. Carefully insert the hydrometer into the cell, not pushing down
on the top of the plates.
Carefully draw liquid into the hydrometer and avoid "bumping" the hydrometer.
Be careful the float is not flooded (too much liquid) or sticking to the sides of the
glass tube.
Obtain a reading by looking directly at the float.
Repeat steps 3-5 to reconfirm reading.
Record the cell number and result.
18 | P a g e
Chapter 1
To test a sealed battery or to troubleshoot a charging or electrical system, you will need a
digital voltmeter with 0.5 percent (or better) accuracy. A digital voltmeter can be
purchased at an electronics store. Analog (needle type) voltmeters are not accurate
enough to measure the millivolt differences of a battery's state-of-charge or measure the
output of the charging system. A battery load tester is optional.
19 | P a g e
Chapter 1
Exercise
20 | P a g e
Chapter 1
21 | P a g e
Chapter 2
Electric Circuits
22 | P a g e
Chapter 2
Electric charges need a conductive path to flow. An electric circuit is a closed path to
allow the flow of electrons. It usually includes a voltage source and a load. There can be
other components as well to control the parameters of the circuit.
2.1 Basic Components of Electric Circuits
There are following basic components of electric circuits:
Conducting Wire
Voltage Source
Load
Resistors
Capacitors
Conducting Wire
A conducting wire forms a path for the flow of electrons. It is used to connect different
electrical components together. It should be a good conductor. Lesser the resistance of
the wire, higher will be the conductance. It is a good practice to incorporate the resistance
of conducting wire while solving an electric circuit.
Voltage Source
A voltage source is an essential component in an electric circuit. It acts as a source of
electrons and hence causes current. There can be different types of voltage sources in a
circuit i.e., battery, power supply and DC adapter etc. These sources can be AC or DC
voltage sources. Different symbols used for the voltage source are given below:
23 | P a g e
Chapter 2
Load
Load is the consumer of electric current. It can be an appliance i.e., light bulb and fan etc.
Load can be resistive, capacitive and inductive. Current consumed in a circuit is decided
by the load. Lower the resistance of the load, more will be the current.
Resistors
Resistor is one of the basic elements of an electric circuit. They
are commonly used to reduce the current flowing in a certain
Symbol of Resistor
branch of an electric circuit. Its symbol is:
Capacitors
A capacitor is an electrical component to store electrical energy. It is
created using two conductors placed next to each other and there is an
insulator in between them. It stores electrical energy in its electric field.
Symbol of Capacitor
It blocks the DC but allows AC to pass through it. Its symbol is:
2.1.1 Series Connections in Electric Circuits
In series connection, there is a single path for the current flow. All the components are
connected end to end such that current flowing in the circuit remains the same. The sum
of voltage across each element in a series circuit is equal to the total voltage of the power
supply. Total resistance of the circuit is equal to the sum of individual resistances.
24 | P a g e
Chapter 2
25 | P a g e
Chapter 2
Here, R1 and R2 are connected in parallel. Similar is the case with R3 and R4. These two
sets of resistance are then connected in series.
26 | P a g e
Chapter 2
Figure 2.4 gives an example of KVL. We go around the circuit in the direction of the
arrow, which is the direction in which we think current will flow. On passing the battery,
the potential increases by 6V. We then lose 4V on passing the 2Ω resistor to give a new
potential of 2V. Finally, the potential drops by 2V in the 1Ω resistor. So, the total voltage
inside a loop is zero.
6𝑉 − 4𝑉 − 2𝑉 = 0
Fig. 2.4
Example 2.1
Find the current I and voltage V over each resistor.
Solution:
Apply KVL:
12V – V1 – V2 + 6V – V3 – V4 = 0
Putting the values of Voltages using Ohm’s Law:
12V – (I X 10 Ω) - (I X 20 Ω) + 6V - (I X 40 Ω) - (I X 20 Ω) = 0
I X 90 Ω = 18V
I = 18V / 90 Ω = 0.2 A
Now Applying Ohm’s law to find voltages:
V1 = 0.2 X 10 = 2 V
V2 = 0.2 X 20 = 4 V
V3 = 0.2 X 40 = 8V
V4 = 0.2 X 20 = 4V
27 | P a g e
Chapter 2
Example 2.2
Find the current I and voltage V over each resistor, where as
R1 = 5Ω, R2 = 10Ω, R3 = 5Ω, R4 = 10Ω
And V = 20Volts
Solution:
There are two loops (closed paths) in the circuit, loop 1 with two resistors and a
single voltage source, wherein loop 2 there is no voltage source, three resistors
only.
The next step is to write equations for each loop. Based on the sign and current
name assigned, as shown below.
Loop 1:
V = I1 R1 + I2 R4
0 = I3 R2 + I3 R3 – I2 R4
Notice the negative sign in the second equation, it is because of being opposite in
direction of loop arrow i.e., for R2 and R3 it is (+ -) but for R4 it is (- +).
It should be noted that
I1 = I 2 + I 3
Now, put the value of I1, which will give you two simultaneous equations with
unknown variable I2 and I3. The value of these currents can be easily computed.
V = (R1 + R4) I2 + R1 I3
0 = - R4 I2 + (R3+ R2) I3
Let’s put the values of resistors and the voltage source,
28 | P a g e
Chapter 2
29 | P a g e
Chapter 2
I1 + I2 = I 3
It is important to note what is meant by the signs of the current in the diagram. A positive
current means that the currents are flowing in the directions indicated on the diagram.
Directions are the direction in which any positive charges would flow, that is from the
plus of the battery round the circuit to the minus.
The standard way of displaying Kirchhoff's current law is by having all currents either
flowing towards or away from the node, as shown in Figure 2:
30 | P a g e
Chapter 2
Here, at least one of the currents will have a negative value (in the opposite direction to
the arrows on this diagram) and Kirchhoff's current law here would be written as:
I1 + I2 + I3 = 0
Example 2.3
What is the value of I in the circuit segment shown in Figure?
Solution:
Apply KCL:
I + 5A = 3A + 4A +2A
I = 4A
Interesting Information
In 1845 Kirchhoff first announced Kirchhoff’s laws, which allow calculation of the
currents, voltages, and resistances of electrical networks. Extending the theory of the
German physicist Georg Simon Ohm, he generalized the equations describing current flow
to the case of electrical conductors in three dimensions. In further studies, he demonstrated
that current flows through a conductor at the speed of light.
31 | P a g e
Chapter 2
Example 2.4
Find the current flowing in the 40Ω Resistor, R3
Solution:
The circuit has 3 branches, 2 nodes (A and B) and 2 independent loops.
Using Kirchhoffs Current Law, KCL the equations are given as:
At node A : I1+ I2 = I3
At node B : I3 = I1 + I2
Using Kirchhoffs Voltage Law, KVL the equations are given as:
Loop 1 is given as : 10 = R1 I1 + R3 I3 = 10 I1 + 40 I3
Loop 2 is given as : 20 = R2 I2 + R3 I3 = 20 I2 + 40 I3
Loop 3 is given as : 10 – 20 = 10 I1 – 20I2
As I3 is the sum of I1 + I2 we can rewrite the equations as;
Eq. No 1 : 10 = 10 I1 + 40(I1 + I2) = 50 I1 + 40 I2
Eq. No 2 : 20 = 20 I2 + 40(I1 + I2) = 40 I1 + 60 I2
We now have two “Simultaneous Equations” that can be reduced to give us the
values of I1 and I2
Substitution of I1 in terms of I2 gives us the value of I1 as -0.143 Amps
Substitution of I2 in terms of I1 gives us the value of I2 as +0.429 Amps
As : I3 = I1+ I2
The current flowing in resistor R3 is given as : -0.143 + 0.429 = 0.286 Amps
and the voltage across the resistor R3 is given as : 0.286 x 40 = 11.44 volts
The negative sign for I1 means that the direction of current flow initially chosen
was wrong, but never the less still valid. In fact, the 20v battery is charging the 10v
battery.
32 | P a g e
Chapter 2
Key Points
33 | P a g e
Chapter 2
Exercise
Multiple Choice Questions
34 | P a g e
Chapter 2
4. Find the current I and voltage V over each resistor, where R1 = 13Ω, R2 = 15Ω, R3
= 5.5Ω, R4 = 11Ω and V = 25Volts.
35 | P a g e
Chapter 2
36 | P a g e
Chapter 3
Fundamental Electronics-I for IoT
37 | P a g e
Chapter 3
38 | P a g e
Chapter 3
When an electron diffuses from the n-side to the p-side, an ionized donor is left behind on
the n-side, which is immovable. As the process goes on, a layer of positive charge is
developed on the n-side of the junction. Similarly, when a hole goes from the p-side to
the n-side, and ionized acceptor is left behind in the p-side, resulting in the formation of a
layer of negative charges in the p-side of the junction. This region of positive charge and
negative charge on either side of the junction is termed as the depletion region. Due to
this positive space charge region on either side of the junction, an electric field direction
from a positive charge towards the negative charge is developed. Due to this electric
field, an electron on the p-side of the junction moves to the n-side of the junction. This
motion is termed as the drift. The direction of drift current is opposite to that of the
diffusion current.
3.2 Diode
A diode is defined as a two-terminal electronic component that only conducts current in
one direction (as long as it is operated within a specified voltage level). An ideal diode
will have zero resistance in one direction, and infinite resistance in the reverse direction.
Although in the real world, diodes cannot achieve zero or infinite resistance. Instead, a
diode will have negligible resistance in one direction (to allow current flow), and very
high resistance in the reverse direction (to prevent current flow).
Semiconductor diodes are the most common type of diode. These diodes begin
conducting electricity only if a certain threshold voltage is present in the forward
direction (i.e., the “low resistance” direction). The diode is said to be “forward biased”
when conducting current in this direction. When connected within a circuit in the reverse
direction (i.e., the “high resistance” direction), the diode is said to be “reverse biased”.
A diode only blocks current in the reverse direction (i.e., when it is reverse biased) while
the reverse voltage is within a specified range. Above this range, the reverse barrier
breaks. The voltage at which this breakdown occurs is called the “reverse breakdown
voltage”.
39 | P a g e
Chapter 3
When the voltage of the circuit is higher than the reverse breakdown voltage, the diode is
able to conduct electricity in the reverse direction (i.e., the “high resistance” direction).
This is why we say diodes have a high resistance in the reverse direction – not an infinite
resistance.
A P-N junction is the simplest form of the semiconductor diode. In ideal conditions, this
P-N junction behaves as a short circuit when it is forward biased, and as an open circuit
when it is in the reverse biased.
Diode Symbol
The symbol of a diode is shown below. The arrowhead points in the direction of
conventional current flow in the forward biased condition. That means the anode is
connected to the p side and the cathode is connected to the n side.
Symbol of Diode
We can create a simple P-N junction diode by doping pentavalent or donor impurity in
one portion and trivalent or acceptor impurity in the other portion of silicon or
germanium crystal block.
These dopings make a PN junction in the middle part of the block. We can also form a P-
N junction by joining a p-type semiconductor and n-type semiconductor together with a
special fabrication technique. The terminal connected to the p-type is the anode. The
terminal connected to the n-type side is the cathode.
3.2.1 Working Principle of a Diode
A diode’s working principle depends on the interaction of n-type and p-type
semiconductors. An n-type semiconductor has plenty of free electrons and a very few
numbers of holes. In other words, we can say that the concentration of free electrons is
high and that of holes is very low in an n-type semiconductor. Free electrons in the n-type
40 | P a g e
Chapter 3
semiconductor are referred to as majority charge carriers, and holes in the n-type
semiconductor are referred to as minority charge carriers.
A p-type semiconductor has a high concentration of holes and a low concentration of free
electrons. Holes in the p-type semiconductor are majority charge carriers, and free
electrons in the p-type semiconductor are minority charge carriers.
41 | P a g e
Chapter 3
42 | P a g e
Chapter 3
through the diode from positive to the negative side. The amplitude of this current is very
small as the number of minority charge carriers in the diode is very small. This current is
called reverse saturation current.
If the reverse voltage across a diode is increased beyond a safe value, a number of
covalent bonds are broken to contribute a huge number of free electron-hole pairs in the
diode. This is due to higher electrostatic force and due to higher kinetic energy of
minority charge carriers colliding with atoms. The huge number of such generated charge
carriers would contribute a huge reverse current in the diode. If this current is not limited
by an external resistance connected to the diode circuit, the diode may permanently be
destroyed. This phenomenon is called Avalanche Breakdown.
43 | P a g e
Chapter 3
44 | P a g e
Chapter 3
The half-wave rectifier has both positive and negative cycles. During the positive half of
the input, the current will flow from positive to negative which will generate only a
positive half cycle of the AC supply. When AC supply is applied to the transformer, the
voltage will be decreasing at the secondary winding of the diode. All the variations in the
AC supply will reduce, and we will get the pulsating DC voltage to the load resistor.
In the second half cycle, the current will flow from negative to positive and the diode will
be reverse biased. Thus, at the output side, there will be no current generated, and we
cannot get power at the load resistance. A small amount of reverse current will flow
during reverse bias due to minority carriers.
45 | P a g e
Chapter 3
high resistance. The circuit is designed in such a manner that in the first half cycle if the
diode is forward biased then in the second half cycle it is reverse biased and so on.
region is known as the Zener diode. The symbolic representation of Zener diode is shown
in the figure.
46 | P a g e
Chapter 3
Example 3.1
An AC voltage of peak value 20 V is connected in series with a silicon diode and load
resistance of 500 Ω. If the forward resistance of diode is 10 Ω, Find:
(i) peak current through diode
(ii) peak output voltage
(iii) What will be these values if the diode is assumed to be ideal?
Solution:
Peak input voltage = 20 V
Forward resistance, rf= 10 Ω
Load resistance, RL= 500 Ω
Potential barrier voltage, V0 = 0.7 V
The diode will conduct during the positive half-cycles of AC input voltage only.
V4 = 0.2 X 20 = 4V
(i) The peak current through the diode will occur at the instant when the input
voltage reaches positive peak i.e. Vin = VF = 20 V.
47 | P a g e
Chapter 3
Example 3.2
Find the current through the diode in the circuit shown:
(i) Assume the diode to be ideal.
Solution:
We shall use Thevenin’s theorem to find current in the diode.
Fig shows Thevenin’s equivalent circuit. Since the diode is ideal, it has zero
resistance
48 | P a g e
Chapter 3
the negative terminal of the supply. The depletion region of the diode is very thin because
it is made of the heavily doped semiconductor material.
49 | P a g e
Chapter 3
electrons to the conduction band reduces the barrier between the p and n-type material.
When the depletion region become completely vanish the diode starts conducting in the
reverse biased.
50 | P a g e
Chapter 3
51 | P a g e
Chapter 3
Example 3.3
For the circuit shown in Figure
Find:
(i) the output voltage
(ii) the voltage dop across series resistance
(iii) the current through Zener diode.
Solution:
If you remove the Zener diode in Figure, the voltage V across the open-circuit is
given by:
Since voltage across Zener diode is greater than Vz (= 50 V), the Zener is in the
“on” state. It can,therefore, be represented by a battery of 50 V as shown in
Figure.
52 | P a g e
Chapter 3
From the above figure, we can see that every BJT has three parts named emitter, base and
collector. JE and JC represent the junction of emitter and junction of collector
53 | P a g e
Chapter 3
Activity
Build the LED switch circuit shown in figure 3.10 on your solder-less breadboard.
RC serves to limit the current that flows in the LED from the +5 V power supply (Vp).
The switch is controlled by digital signal DO. Scope channel 1 will display the voltage
across the switch transistor Q1 (VCE) and scope channel 2 will display the voltage across
the LED.
54 | P a g e
Chapter 3
Teacher Notes:
Conduct this activity in Lab. Oscilloscope must be used to plot voltages.
Example 3.4
A 7.2 V Zener is used in the circuit shown in Fig. 3 and the load current is to vary
from 12 to 100 mA. Find the value of series resistance R to maintain a voltage of 7.2
V across the load. The input voltage is constant at 12V and the minimum Zener
current is 10mA.
Solution:
The voltage across R is to remain constant at 12 − 7.2 = 4.8 V as the load current
changes from 12 to 100 mA. The minimum Zener current will occur when the load
current is maximum.
If R = 43.5 Ω is inserted in the circuit, the output voltage will remain constant over the
regulating range. As the load current IL decreases, the Zener current IZ will increase
to such a value that IZ + IL = 110 mA.
Note that if load resistance is open-circuited, then IL = 0 and Zener current becomes
110 mA. 55 | P a g e
Chapter 3
Key Points
A p-n junction is a boundary between two semiconductor material types,
namely the p-type and the n-type, inside a semiconductor.
The p-side or the positive side of the semiconductor has an excess of holes
and the n-side or the negative side has an excess of electrons.
A diode only conducts current in one direction.
A diode is forward biased if a positive terminal of a source is connected to
the p-type side and the negative terminal of the source is connected to the n-
type side of the diode.
A diode is reverse biased if we connect the negative terminal of the voltage
source to the p-type side and the positive terminal of the voltage source to
the n-type side of the diode.
Rectifiers are used to convert AC signals to DC signals Flow of charges
inside an electric circuit is called electric current.
In a half-wave rectifier, one half of each AC input cycle is rectified.
Full-wave rectifier circuits are used for producing an output voltage or
output current which is purely DC.
Zener diode is a heavily doped semiconductor diode which is designed to
operate in reverse direction.
Zener diode is commonly used for load regulation.
56 | P a g e
Chapter 3
Exercise
Select the most appropriate option
1. ____ allows uni-directional flow of current.
a. Resistance b. Capacitor c. Diode d. None of these
57 | P a g e
Chapter 3
2. A 10-V Zener diode is used to regulate the voltage across a variable load resistor.
The input voltage varies between 13 V and 16 V and the load current varies
between 10 mA and 85 mA. The minimum Zener current is 15 mA. Calculate the
value of series resistance R.
3. The Zener diode shown in Figure has VZ = 18 V. The voltage across the load
stays at 18 V as long as IZ is maintained between 200 mA and 2 A. Find the value
of series resistance R so that E0 remains 18 V while input voltage Ei is free to
vary between 22 V to 28V.
58 | P a g e
Chapter 4
Electronics for Internet of Things
59 | P a g e
Chapter 4
FETs are also known as unipolar transistors as opposed to BJTs that are bipolar
transistors. In FETs, either holes or electrons are used for the conduction process.
Whereas, conduction process doesn’t involve both charge carriers simultaneously. FETs
usually come with high input impedance at lower frequencies. They are robust and cheap
and are used in many electrical circuits. The low power consumption and low power
dissipation make this device an ideal fit for integrated circuits.
60 | P a g e
Chapter 4
The current-carrying path that exists between the source and drain terminals is known as
“channel” which can be composed of either N-type or P-type semiconductor material.
Refer to Figure 4.2 for working of FET.
Interesting Information
The concept of a field-effect transistor (FET) was first patented by Austro-
Hungarian physicist Julius Edgar Lilienfeld in 1925and by Oskar Heil in 1934,
but they were unable to build a working practical semiconducting device based
on the concept.
Some of the mainspecifications of FET are defined below. These specifications are
always provided in datasheets. Some of the parameters are particularly important for
61 | P a g e
Chapter 4
different types of FET, e.g., JFET, while others may be more applicable to the MOSFETs
etc.
Gate source voltage, VGS: The FET parameter VGS is the rating for the maximum
voltage that can be tolerated between the gate and source terminals. The purpose
for including this parameter in the datasheet is to prevent damage of the gate
oxide. The actual gate oxide withstand voltage is typically much higher than this
but it varies as a result of the tolerances that exist in the manufacturing processes.
It is advisable to remain well within this rating so that the reliability of the device
is maintained.
Drain-Source Voltage, VDSS:This is a rating for the maximum drain-source
voltage that can be applied without causing avalanche breakdown. The parameter
is normally stated for the case where the gate is shorted to the source.While
designing a circuit, it is always best to leave a significant margin between the
maximum voltage to be experienced and the VDSS specification.
Gate Reverse Leakage Current, Igss: The current which flows in the reverse
bias.It is the leakage current between the gate and source at VDS = 0 and is defined
by applying the maximum rating VGSS between the gate and source.
Threshold voltage VGS(TH): The threshold voltage VGS(TH) is the minimum gate
voltage that can form a conducting channel between the source and the drain.
Drain current at zero gate voltage, Idss: This FET parameter is the maximum
continuous current the device can carry with the device fully on. Normally it is
specified for a particular temperature, typically 25°C.This FET specification is
based on the junction-to-case thermal resistance rating and the case
temperature.This FET parameter is of particular interest for power MOSFETs and
when determining the maximum current parameter, no switching losses are
accounted for. Also holding the case at 25°C is not feasible in practice. As a result,
the actual switching current should be limited to less than half of the Idss at TC =
25°C rating in a hard switched application.
62 | P a g e
Chapter 4
Gate source cut-off voltage, VGS(off):The gate source cut-off voltage is a turn-off
specification. It defines the threshold voltage for a given residual current, so the
device is basically off but on the edge of turning on. The threshold voltage has a
negative temperature coefficient, i.e., it decreases with increasing temperature.
This temperature coefficient also affects turn-on and turn-off delay times.
Forward transconductance, Gfs: Forward transconductance (Gfs) represents the
signal gain (drain current divided by gate voltage) of a MOSFET.
Input capacitance, Ciss: The input capacitance parameter for a FET is the
capacitance that is measured between the gate and source terminals with the drain
shorted to the source for AC signals. In other words, this is the capacitance
between the gate and channel. Ciss is made up of the gate to drain capacitance Cgd
in parallel with the gate to source capacitance Cgs. This can be expressed as:
Ciss=Cgs+Cgd
Drain-source on resistance, Rds(on): With the FET turned hard on, this is the
resistance in ohms exhibited across the channel between the drain and source. It is
particularly important in switching applications from logic to power switching as
well as in RF switching (in radios and televisions), including applications in
mixers. FETs typically are able to provide a good performance for switching and
have a relatively low Rds(on) value.
FET datasheets contain different parameters and specifications to define the performance
of the FET. These are all provided in datasheets that enable the correct choice of FET to
be made.
4.2 JFET
The junction-gate field-effect transistor (JFET) is one of the simplest types of field-effect
transistor. Figure 4.3 shows the basic form of construction of a practical n-channel and p-
channel JFET. A p-channel JFET can be made by transposing the p and n materials as
shown in Figure 4.3. All JFETs operate in the depletion mode.
63 | P a g e
Chapter 4
64 | P a g e
Chapter 4
The most important characteristics of the JFET are as follows:
When a JFET is connected to a supply with the polarity shown in Figure 4.2 (drain
+ve for an n-channel FET, -ve for a p-channel FET), a drain current (ID) flows and
can be controlled via a gate-to-source bias voltage VGS.
ID is maximum when VGS = 0, and is reduced by applying a reverse bias to the gate
(negative bias in an n-channel device, positive bias in a p-type). The magnitude of
VGS needed to reduce ID to zero is called the ‘pinch-off’ voltage, VP, and typically
has a value between 2 and 10 volts. The magnitude of ID when VGS = 0 is denoted
IDSS, and typically has a value in the range 2 to 20mA.
The JFET’s gate-to-source junction has the characteristics of a silicon diode.
When reverse-biased, gate leakage currents (IGSS) are only a couple of nA (1nA =
.001µA) at room temperature. Actual gate signal currents are only a fraction of
annA, and the input impedance of the gate is typically thousands of mega ohms at
lower frequencies.
If the JFET’s gate-to-source junction is forward-biased, it conducts like a normal
silicon diode. If it is excessively reverse-biased, it avalanches like a Zener diode.
In both cases, the JFET suffers no damage if gate currents are limited to a few
milli amperes.
Note in Figure 4.4 that, for each VGS value, drain current ID rises linearly from
zero as the drain-to-source voltage (VDS) is increased from zero up to some value
at which a ‘knee’ occurs on each curve, and that ID then remains constant as VDS is
increased beyond the knee value. Thus, when VDS is below the JFET’s knee value,
the drain-to-source terminals act as a resistor.
RDS can be varied from a few hundred ohms (at VGS = 0) to thousands of mega
ohms (at VGS = VP), enabling the JFET to be used as a voltage-controlled switch or
as an efficient ‘chopper’ that does not suffer from offset-voltage or saturation-
voltage problems.
65 | P a g e
Chapter 4
Note in Figure 4.4 that when VDS is above the knee value, the ID value is
controlled by the VGS value and is almost independent of VDS, i.e., the JFET acts
as a voltage-controlled current generator. The JFET can be used as a fixed-value
current generator by either tying the gate to the source, or by applying a fixed
negative bias to the gate. Alternatively, it can (when suitably biased) be used as a
voltage-to-current signal amplifier.
FET ‘gain’ is specified as transconductance, gm, and denotes the magnitude of
change of drain current with gate voltage, i.e., a gm of 5mA/V signifies that a
VGS variation of one volt produces a 5mA change in ID. Note that the form I/V is
the inverse of the ohms formula, so gm measurements are often expressed in
‘mho’ units. Usually, gm is specified in FET data sheets in terms of mmhos (milli-
mhos) or µmhos (micro-mhos).
In most practical applications, the JFET is biased into the linear region and used as
a voltage amplifier. N-channel JFET can be used as a common source amplifier
(corresponding to the bipolar npn common emitter amplifier).
4.3 MOSFET
The second and most important family of FETs are IGFET or MOSFET. In these FETs,
the gate terminal is insulated from the semiconductor body by a very thin layer of silicon
dioxide, hence the title ‘Insulated Gate Field Effect Transistor,’ or IGFET. The devices
generally use a ‘Metal-Oxide Silicon’ semiconductor material in their construction, hence
the alternative title of MOSFET.
Figure 4.5 shows the basic construction and the standard symbol of the n-channel
depletion-mode FET. It resembles the JFET, except that its gate is fully insulated from
the body of the FET (as indicated by the Figure 4.6) but, in fact, operates on a slightly
different principle to the JFET.
66 | P a g e
Chapter 4
It has a normally-open n-type channel between drain and source, but the channel width is
controlled by the electrostatic field of the gate bias. The channel can be closed by
applying suitable negative bias, or can be increased by applying positive bias.
In practice, the FET substrate may be externally available, making a four-terminal device,
or may be internally connected to the source, making a three-terminal device. An
important point about the IGFET/MOSFET is that it is also available as an enhancement-
mode device, in which its conduction channel is normally closed but can be opened by
applying forward bias to its gate.
67 | P a g e
Chapter 4
To turn the device on, significant positive gate bias is needed, and when this is of
sufficient magnitude, it starts to convert the p-type substrate material under the gate into
an n-channel, enabling conduction to take place.
Figure 4.7 shows the typical transfer characteristics of an n-channel enhancement-mode
IGFET/MOSFET, and the VGS/ID curves of the same device. Note that no ID current
flows until the gate voltage reaches a ‘threshold’ (VTH) value of a few volts, but that
beyond this value, the drain current rises in a non-linear fashion.
68 | P a g e
Chapter 4
Note that the transfer graph is divided into two characteristic regions, as indicated (in
Figure 4.7) by the dotted line.These are the ‘triode’ region and the ‘saturated’ regions
respectively. In the triode region, the device acts like a voltage-controlled resistor.In the
saturated region, it acts like a voltage-controlled constant-current generator.
The basic n-channel MOSFETs can be converted to p-channel devices by simply
transposing their p and n materials, in which case their symbols must be changed by
reversing the directions of their substrate arrows.
Note that the very high gate impedance of MOSFET devices makes them liable to
damage from electrostatic discharges and, for this reason, they are often provided with
internal protection via integral diodes or Zener diodes.
Symbol
Input impedance JFET have much smaller MOSFETs have much higher input
input impedance mainly of impedance of about 1010 to 1015 Ω due
the order of 108 Ω. to small leakage current.
Characteristic As JFET has higher drain The characteristic curve is less flat
curve resistance, the characteristic than those of JFET.
curve is flatter.
69 | P a g e
Chapter 4
Drain resistance JFET has drain resistance of Drain resistance in case of MOSFETs
the order of 105 to 106 Ω is of the order of 1 to 50 K Ω.
4.4 Thyristors
Thyristors are also switching devices similar to the transistors. Transistors can be used as
amplifying and switching device but they cannot handle higher current. So, to
handlehigher currents, thyristors are used.
Thyristor includes many types of switches, some of them are SCR (Silicon Controlled
Rectifier), GTO (Gate Turn OFF), and IGBT (Insulated Gate Controlled Bipolar
Transistor) etc. SCR is the most widely used device, so the word Thyristor become
synonymous to SCR.
SCR or Thyristor is a four-layered, three-junction semiconductor switching device. It has
three terminals: anode, cathode, and gate. Thyristor is also a unidirectional device like a
diode, which means it allows current only in one direction. It consists of three P-N
junctions in series as it is of four layers. Gate terminal is used to trigger the SCR by
providing small voltage to this terminal, which is called gate triggering method to turn
ON the SCR.
70 | P a g e
Chapter 4
Difference betweenThyristorand MOSFET
Thyristor and MOSFET both are electrical switches and are most commonly used. The
basic difference between both of them is that MOSFET switches are voltage-controlled
devices and can only switch DC current while Thyristors switches are current controlled
device and can switch both DC and AC current. There are some more differences
between Thyristor and MOSFET which are given below in the table:
Temperature
less high
sensitivity
Separate switching
Turning off Not required
circuit is required
Resistive input
Low high
impedance
4.5 UJT
UJT stands for UniJunction Transistor. It is a three terminal semiconductor switching
device. The Unijunction Transistor is a simple device that consists of a bar of n-type
71 | P a g e
Chapter 4
silicon material with a non-rectifying contact at either end (base 1 and base 2), and with a
rectifying contact (emitter) alloyed into the bar part along its length, to form the only
junction within the device (hence the name ‘Unijunction’).
The Unijunction Transistor is also known as Double Base Diode. The unique switching
characteristics of UJT makes it different from conventional BJT’s and FET’s by acting as
switching transistor instead of amplifying the signals. It exhibits negative resistance in its
characteristics which employs it as relaxation oscillators in variety of applications.
4.5.1 Symbol and Construction of Unijunction Transistor (UJT):
In Unijunction Transistor, the P-N Junction is formed by lightly doped N-type silicon bar
with heavily doped P-type material on one side. The ohmic contact on either ends of the
silicon bar is termed as Base 1 (B1) and Base 2 (B2) and P-type terminal is named as
emitter.
The emitter junction is placed such that it is closer to terminal Base 2 than Base 1. The
symbols of both UJT and JFET resemble the same except the emitter arrowhead
represents the direction in which conventional current flow, but they operate differently.
72 | P a g e
Chapter 4
73 | P a g e
Chapter 4
junction is reverse biased; when small amount of voltage which is less than voltage
developed across resistance RB1 (ηVBB) is applied across the terminal emitter (E). Thus, a
very high impedance is developed prompting device to move into non-conducting state
i.e., it will be switched off and no current flows through it. The UJT begins to conduct
when the P-N junction is forward biased.
The forward biased is achieved when voltage applied across emitter terminal is increased
and becomes more than VRB1. This results in larger flow of emitter current from emitter
region to base region. Increase in emitter current reduces the resistance between emitter
and Base 1, resulting in negative resistance at emitter terminal.
The Unijunction Transistor (UJT) will act as voltage breakdown device, when the input
applied between emitter and base 1 reduces below breakdown value i.e., RB1 increases to
a higher value. This shows that RB1 depends on the emitter current and it is variable.
Cutoff
Negative Resistance Region
Saturation
Figure 4.10 shows the detailed characteristics of UJT.
Cutoff
Cutoff region is the area where the Unijunction Transistor (UJT) doesn’t get sufficient
voltage to turn on. The applied voltage hasn’t reached the triggering voltage, thus making
transistor to be in off state.
Negative Resistance Region
When the transistor reaches the triggering voltage, VTRIG, Unijunction Transistor (UJT)
will turn on. After a certain time, if the applied voltage increases to the emitter lead, it
74 | P a g e
Chapter 4
will reach out at VPEAK. The voltage drops from VPEAK to Valley Point even though the
current increases (negative resistance).
Saturation
In saturation region, current increases with the increase in the applied voltage to emitter
terminal.
4.5.4 Applications of Unijunction Transistor (UJT)
The Unijunction Transistor can be employed in variety of applications such as:
Switching Device
Triggering Device for Triacs and SCR’s
Timing Circuits
For phase control
In sawtooth generators
In simple relaxation oscillators
Activity
Implement UJT as a switch on breadboard.
75 | P a g e
Chapter 4
Example 4.1
The intrinsic stand-off ratio for a UJT is determined to be 0.6. If the inter-base
resistance (RBB) is 10kΩ what are the values of RB1 and RB2?
Solution:
Intrinsic stand-off ratio for a UJT is given as
𝑅𝐵1
𝜂=
𝑅𝐵1+𝑅𝐵2
𝑅𝐵1
0.6 =
10𝐾
𝑅𝐵1 = 6𝐾Ω
76 | P a g e
Chapter 4
Teacher Notes
All the topics of this chapter should be taught covering only the basics. Details should
be as minimum as possible.
Example 4.2
A UJT has 10V between the bases. If the intrinsic stand-off ratio is 0.65, find the
value of stand-off voltage. What will be the peak point voltage if the forward voltage
drop in the p-n junction is .7V?
Solution:
VBB=10V, 𝜂=0.65, 𝑉𝐷 =0.7𝑉
Stand-off voltage (VRB1) is given as
𝑉𝑅𝐵1 =𝜂𝑉𝐵𝐵
𝑉𝑅𝐵1 =0.65×10
𝑉𝑅𝐵1 =6.5𝑉
Peak point Voltage (VP) is given as
𝑉𝑃 =𝜂𝑉𝐵𝐵 + 𝑉𝐷
After putting values and solving:
𝑉𝑃 =7.2𝑉
77 | P a g e
Chapter 4
Key Points
The FET (Field Effect Transistor) is a three-terminal electronic device used
to control the flow of current by the voltage applied to its gate terminal.
The conductivity process in FET is controlled by applying the input voltage
at the gate terminal.
The junction-gate field-effect transistor (JFET) is one of the simplest types
of field-effect transistor.
All JFETs operate in the depletion mode.
In MOSFETs, the gate terminal is insulated from the semiconductor body by
a very thin layer of silicon dioxide.
In the triode region, MOSFET acts like a voltage-controlled resistor; in the
saturated region, it acts like a voltage-controlled constant-current generator.
Thyristors are also switching devices similar to the transistors and they are
capable of operating in high current conditions.
The unique switching characteristics of UJT makes it different from
conventional BJT’s and FET’s by acting as switching transistor instead of
amplifying the signals.
The main disadvantage of Unijunction Transistor is its inability to provide
appropriate amplification.
78 | P a g e
Chapter 4
Exercise
Select the most appropriate option
1. Which of the following are three terminal electronic devices:
a. Resistance b. FET c. MOSFET d. Both b and c
79 | P a g e
Chapter 4
1. The intrinsic stand-off ratio for a UJT is determined to be 0.5. If the inter-base
resistance (RBB) is 12kΩ what are the values of RB1 and RB2?
2. A UJT has 15V between the bases. If the intrinsic stand-off ratio is 0.75, find the
value of stand-off voltage. What will be the peak point voltage if the forward
voltage drop in the p-n junction is .7V?
3. Determine the minimum and maximum peak-point voltage for UJT with
VBB=24V. Given that UJT has a range of 𝜂=0.74 𝑡𝑜 0.86.
80 | P a g e
Chapter 5
Introduction to Microcontrollers
81 | P a g e
Chapter 5
5.1 Microcontrollers
5.1.1 What is a Microcontroller?
A microcontroller is a programmable integrated chip (IC). It has different ports which can
be controlled using a program written by the user. These ports control the connected
circuitry according to the uploaded program. A typical microcontroller has a
microprocessor unit (MPU), memory, and some peripherals.
5.1.2 What Do Microcontrollers Do?
A microcontroller board can sense, monitor and respond to various events, behaviors or
input signals that it receives from connected components.
A microcontroller, for example, might be programmed to push a specific type of output
signal or behavioral control in response to certain input conditions. This could include the
execution of tasks such as:
Turning ON an LED or OLED display in response to touch-based user demand.
Playing lights and sounds in temperature-sensing applications or other varieties of
alarms and warning systems.
Responding to the need for a motor to switch on or off in a pump or other
mechanical device.
Adjusting tilt, balance, and velocity in gyroscope or accelerometer-based
applications.
82 | P a g e
Chapter 5
Microcontroller
Microprocessor
is much more complex and versatile in terms of function range, and intended
for use in more general computing (as opposed to in specialized one-task
devices).
have much faster processor (clock) speeds than MCUs, often measured in
gigahertz (GHz) rather than Hz.
is challenging and expensive to manufacture, unlike relatively simple and
cheap microcontrollers.
require far more external components (RAM, I/O ports, data storage,
EEPROM or flash memory) to operate, none of which are integrated into the
microprocessor and must be connected separately.
have a considerably higher power draw and are subsequently much less cost-
effective to run continually.
83 | P a g e
Chapter 5
Common Microcontrollers
Some commonly used microcontrollers are:
1. 8086 Microcontrollers
2. AVR Microcontrollers
3. Arduino Boards
4. STM
5. ESP
6. Raspberry Pi
Microcontrollers for IoT
5.2 Arduino
Arduino is an open-source embedded systems platform based on easy-to-use hardware
and software. Arduino boards are able to read inputs - light on a sensor, a finger on a
button, or a Twitter message - and turn it into an output - activating a motor, turning on
an LED, publishing something online. You can tell your board what to do by sending a
set of instructions to the microcontroller on the board. You need to use the Arduino
programming language (based on Wiring), and the Arduino Software (IDE) to start
working on Arduino.
5.2.1 Arduino UNO
Arduino UNO is a microcontroller board based on the ATmega328P (datasheet). It has 14
digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16
MHz ceramic resonator (CSTCE16M0V53-R0), a USB connection, a power jack, an
ICSP header and a reset button. It contains everything needed to support the
84 | P a g e
Chapter 5
microcontroller; simply connect it to a computer with a USB cable or power it with an
AC-to-DC adapter or battery to get started. Pin configuration of Arduino UNO is shown
below:
85 | P a g e
Chapter 5
A range of Arduino modules are available including Arduino Uno, Arduino Mega,
Arduino Leonardo, Arduino Micro and many more.
Each of them contains a microcontroller on the board that is actually programmed
and accepts the information in the form of code.
The main code, also known as a sketch, created on the IDE platform will
ultimately generate a Hex File (executable file containing hex codes) which is then
transferred and uploaded in the controller on the board.
The IDE environment mainly contains two basic parts: Editor and Compiler. The
former is used for writing the required code and thelater is used for compiling and
uploading the code into the given Arduino Module.
This environment supports both C and C++ languages.
86 | P a g e
Chapter 5
87 | P a g e
Chapter 5
88 | P a g e
Chapter 5
Then the Library Manager will open and you will find a list of libraries that are already
installed or ready for installation. In this example we will install the Bridge library. Scroll
the list to find it, click on it, then select the version of the library you want to install.
Sometimes only one version of the library is available:
89 | P a g e
Chapter 5
Finally click on install and wait for the IDE to install the new library. Downloading may
take time depending on your connection speed. Once it has finished, an Installed tag
should appear next to the Bridge library. You can close the library manager:
Teacher Notes:
Tell students about the available interfaces on Arduino UNO.
90 | P a g e
Chapter 5
You can now find the new library available in the Sketch > Include Library menu. If you
want to add your own library to Library Manager, follow these instructions.
Libraries are often distributed as a ZIP file or folder. The name of the folder is the name
of the library. Inside the folder will be a .cpp file, a .h file and often a keywords.txt file,
examples folder, and other files required by the library. Starting with version 1.0.5, you
can install 3rd party libraries in the IDE. Do not unzip the downloaded library, leave it as
is.
In the Arduino IDE, navigate to Sketch > Include Library > Add .ZIP Library. At the top
of the drop-down list, select the option to "Add .ZIP Library'':
You will be prompted to select the library you would like to add. Navigate to the .zip
file's location and open it:
91 | P a g e
Chapter 5
Return to the Sketch > Include Library menu. menu. You should now see the library at
the bottom of the drop-down menu. It is ready to be used in your sketch. The zip file will
have been expanded in the libraries folder in your Arduino sketches directory.
USB-Mini cable is used to connect Arduino to your computer. Different types of USB
connectors are shown in figure:
92 | P a g e
Chapter 5
2. Install/update USB-Serial Driver
The following instructions are for Windows 7, Vista and 10. They are also valid for
Windows XP, with small differences in the dialog windows. In the following instruction
only the Leonardo board will be mentioned, but the same procedure is valid for all the
Arduino boards.
Plug in your board and wait for Windows to begin its driver installation process. If the
installer does not launch automatically, navigate to the Windows Device Manager
(Start>Control Panel>Hardware) and find the Arduino listing. Right click and
choose Update driver:
Note: The following figure shows driver for Arduino Leonardo. Process of updating the
driver is same for all boards.
Interesting Information
A device driver is a software
component that allows a hardware
device to communicate with the
operating system of a computer.
Drivers allow an operating system to
correct interpret and implements the
signals that come from the hardware
device.
93 | P a g e
Chapter 5
In the next screen, click "Browse my computer for driver software", and click Next.
Click the Browse button. Another dialog appears: navigate to the folder with the
Arduino software that you just downloaded. Select the drivers folder an click OK, then
click Next.
94 | P a g e
Chapter 5
You will receive a notification that the board has not passed Windows Logo testing.
Click on the button Continue Anyway.
Open the LED blink example sketch: File > Examples >01.Basics > Blink.
95 | P a g e
Chapter 5
You'll need to select the entry in the Tools > Board menu that corresponds to your
Arduino board.
Select the serial device of the board from the Tools | Serial Port menu. This is likely to
be COM3 or higher (COM1 and COM2 are usually reserved for hardware serial ports).
96 | P a g e
Chapter 5
To find out, you can disconnect your board and re-open the menu; the entry that
disappears should be the Arduino board. Reconnect the board and select that serial port.
Hardware Setup
Place the LED sensor in the breadboard. Connect a 220-ohm resistor to its anode and
connect its pin to GND pin of Arduino. Connect a wire from the resistor to corresponding
pin on Arduino (digital pin). Connect the Cathode of LED to GND of Arduino.
97 | P a g e
Chapter 5
Simply click the "Upload" button in the environment. Wait a few seconds - you should
see the RX and TX LEDs on the board flashing. If the upload is successful, the message
"Done uploading." will appear in the status bar.
98 | P a g e
Chapter 5
Key Points
A microcontroller has different ports which can be controlled using a
program written by the user.
Microcontroller contains peripherals i.e. RAM/ROM, I/O ports, EEPROM
etc.
A microprocessor contains no peripherals.
IDE is used to write a code, compile code, burn the code and debug the
program.
A device driver is necessary to connect arduino with computer.
Operating voltage of Arduino is 5V.
Libraries are the ready-made programs/functions which can be added in the
existing code according to the need.
99 | P a g e
Chapter 5
Exercise
Activites.
1. Install Arduino IDE.
2. Install device driver for Arduino.
3. Add any library in Arduino IDE.
4. Connect an LED with Arduino and blink it using an example program.
5. Explore serial port. Print some text on serial monitor of Arduino IDE.
100 | P a g e
Chapter 6
Work Health and Safety
101 | P a g e
Chapter 6
102 | P a g e
Chapter 6
Those who manage or control activities that give rise, or may give rise, to risks to
health or safety are responsible for eliminating or reducing health and safety risks.
Employers and employees should exchange information about risks to health and
safety and measures that can be taken to reduce those risks.
103 | P a g e
Chapter 6
6.1.3 Ergonomics
Ergonomics is the process of designing or arranging workplaces, products and systems so
that they fit the people who use them. Ergonomics applies to the design of anything that
involves people – workspaces, sports and leisure, health and safety. Itis a branch of
science that aims to learn about human abilities and limitations, and then apply this
learning to improve people’s interaction with products, systems and environments.
Ergonomics helps to improve workspaces and environments to minimize risk of injury or
harm. Ergonomics should be applied to design amenities of a working environment. As
technologies change, so does the need to ensure that the tools we access for work, rest
and play are designed for our body’s requirements.
104 | P a g e
Chapter 6
105 | P a g e
Chapter 6
Ergonomic: Ergonomic hazards are a result of physical factors that can result
in musculoskeletal injuries. For example, a poor workstation setup in an office,
poor posture and manual handling.
Psychosocial: Psychosocial hazards include those that can have an adverse
effect on an employee’s mental health or wellbeing. For example, sexual
harassment, victimization, stress and workplace violence.
6.1.6 Managing Workplace Hazards
If it is not possible to eliminate the hazard.Below are six steps to determine the most
effective measures to control workplace hazards and to minimise risk.
Step 1: Design or re-organise to eliminate hazards.
Step 2: Substitute the hazard with something safer.
Step 3: Isolate the hazard from people.
Step 4: Use engineering controls.
Step 5: Use administrative controls.
Step 6: Use Personal Protective Equipment (PPE).
6.1.7 Purpose of Organizational Policies, Procedures and Processes
The purpose of organizational policies, procedures, processes and systems for WHS are
to establish the practices and standards that a company will follow in regards to
compliance with Work Health & Safety guidelines.
These company policies and procedures will ensure that the company is in full
compliance with the legislative requirements concerning work health & safety
for employees
The policies will create a safe work environment for all employees and will
reduce the cost the company has for sending employees to see doctors after
accidents, and will reduce the insurance costs of the company because of their
safety rating
106 | P a g e
Chapter 6
The establishment of the policies will create better work relationships between
company owners, and their employees. The employees will know that the
company is trying to protect them from injury
Different teams are involved in the development of an IoT system i.e., software team,
electronics team, PCB team and QA etc. So, WHS requirements will vary for the
different teams. For example, WHS principle for software team will be different as
compared to that of hardware team.
107 | P a g e
Chapter 6
108 | P a g e
Chapter 6
Key Points
Structural aspects of the work environment should take into account the safety of
passageways, workplace lighting, sound environment and indoor air quality.
Functional factors of the work environment must include the organization of
transportation and keeping workplaces and offices organized and neat.
Those who manage or control activities that give rise, or may give rise, to risks to
health or safety are responsible for eliminating or reducing health and safety
risks.
Employers and employees should exchange information about risks to health and
safety and measures that can be taken to reduce those risks.
Psychosocial hazards include those that can have an adverse effect on an
employee’s mental health or wellbeing.
109 | P a g e
Chapter 6
Exercise
110 | P a g e
Glossary
111 | P a g e
Impedance: Impedance is the opposition to alternating current presented by the combined effect
of resistance and reactance in a circuit.
Instruction Set:An instruction set is a group of commands for a CPU in machine language.
I/O Port: The input/output port is a memory address used by software to communicate with
hardware on your computer.
Kinetic Energy:Kinetic energy, form of energy that an object or a particle has by reason of its
motion.
Oxidation-Reduction Reaction:An oxidation-reduction (redox) reaction is a type of chemical
reaction that involves a transfer of electrons between two species.
Rating: Ratings are the maximum and minimum values of electrical quantities compatible with a
specific component.
Raw Materials:Raw materials are the input goods or inventory that a company needs to
manufacture its products.
Risk:A risk is the chance of something happening that will have a negative effect.
Sensitivity: Sensitivity is a measure of how well a test can identify true positives and specificity
is a measure of how well a test can identify true negatives.
SOP:A standard operating procedure (SOP) is a set of step-by-step instructions compiled by an
organization to help workers carry out routine operations.
Substrate: A substrate is the medium in which a chemical reaction takes place
Unit of measurement:A unit of measurement is a definite magnitude of a quantity, defined and
adopted by convention or by law, that is used as a standard for measurement of the same kind of
quantity.
Valence Band: The valence band is the band of electron orbitals that electrons can jump out of,
moving into the conduction band when excited.
112 | P a g e
About the Author
Muhammad Umair is a researcher at the Sensors, Cloud and Services (SCS) Lab,
School of Computer Sciences, The University of Sydney, Australia. Muhammad
Umairis also aLecturer at the Department of Electrical, Electronics and
TelecommunicationEngineering, New Campus, UET Lahore. He completed his
B.Sc. Electrical Engineering and M.Sc.Electrical Engineering from the University
of Engineering & Technology (UET) Lahore in 2014 and 2017,respectively. He
has worked as a Research Officer at Internet of Things (IoT) lab at Al-
KhwarizmiInstitute of Computer Sciences, UET Lahore. He has also worked at
Sultan Qaboos IT Researchlab as a Research Officer. His survey on Social IoT
platforms is the most cited survey for SIoTapplications. He has designed graduate
level courses on IoT.
113 | P a g e
National Vocational & Technical Training Commission (NAVTTC)
Plot No.38, Sector H-9/4, Kirthar Road, Islamabad.
Tel: +92-51-9207518
Website: www.navttc.gov.pk