You are on page 1of 118

ELECTRONICS BEGINNERS

by Muhammad Waleed
Copyright © 2023 by Muhammad Waleed

All rights reserved. No part of this book may be reproduced


or used in any manner without written permission of the
copyright owner except for the use of quotations in a book
review. For more information, address:
m.waleed1048@outlook.com

First e-book edition March 2023


Book design by Muhammad Waleed

If you're just getting your feet wet in the world of electronics,


then an Electronics for Beginners book is a great way to kick
things off. This book covers all the basics, including
electricity fundamentals, basic components, and their
working, circuit design and layout, basic electronics
components such as transistors and resistors, and tips on
constructing your projects. Even the advanced topics are
described clearly in easy-to-understand language so that you
can progress from absolute beginner to proficient enthusiast
in no time.

Moreover, this book often comes packed with graphical


layouts and illustrations which make it easier to understand
unfamiliar concepts. As such, if you're looking for a helpful
introduction to electronics engineering or even some
advanced knowledge to help out with future projects - an
Electronics for Beginners book would be an ideal place for
you to start!
Contents
Chapter 1: Electricity Basics

AC voltage
………………………………………………………………………………
…………………………..…………………2

DC voltage
………………………………………………………………………………
……………………………..………………3

Conductors and non-conductors


………………………………………………………………….…….………
4

Voltage and current directions


…………………………………………………………………………..……
…..5

Chapter 2: Basic Electronic Components

Resistors
………………………………………………………………………………
……………………………………………..….6
Potentiometers
………………………………………………………………………………
…………………………...........12

Capacitors
………………………………………………………………………………
…………………………………………...15

Diodes………………………………………………………………………
……………………………………………………...……20

Light Emitting Diodes (LEDs)


…………………………………………………………………………..……
…..24

Inductors……………………………………………………………………
…………………………………………..…………….28

Transistors
………………………………………………………………………………
………………………...………………..30
Fuse…………………………………………………………………………
………………………………………..……………………34

Thermistors………………………………………………………………
………………………………..……………………….35

Chapter 3: Building Circuits on a breadboard

Introduction to breadboard
………………………………………………………………………………
…………37

Bread connections
………………………………………………………………………………
…………………………..38

LED with a push button


………………………………………………………………………………
………………...39
Series and Parallel
LED…………………………………………………………………………
…………………..…..42

Transistor as a
switch………………………………………………………………………
……………………..……..44

Touch sensor with a


transistor……………………………………………………………………
…..………...47

Water level
indicator……………………………………………………………………
………………….…………… 48

Chapter 4: 555 timer IC

555 basics
………………………………………………………………………………
……………………………………..50

Internal
structure……………………………………………………………………
………………………………….51

LED
blinking……………………………………………………………………
……………………………………………52

Variable PWM circuit


………………………………………………………………………………
………...........54

Chapter 5: Logic gates

AND Gate
………………………………………………………………………………
………………………………………58

OR Gate
………………………………………………………………………………
………………………………………….59

NOT Gate
………………………………………………………………………………
………………………………………..61
NAND Gate
………………………………………………………………………………
……………………………………62

NOR Gate
………………………………………………………………………………
……………………………………….63

XOR
Gate…………………………………………………………………………
…………………………………………… .64

XNOR
Gate…………………………………………………………………………
…………………………………………66

Logic gates using


transistors…………………………………………………………………
…………….68
Adder circuit
………………………………………………………………………………
…………………………………71

bit calculator using full


adder………………………………………………………………………
…76

Chapter 6: Arduino basics

Microcontroller introduction
………………………………………………………………………………..
77

Arduino board
………………………………………………………………………………
…………………………….78

LED blinking
………………………………………………………………………………
……………………………..…80

LED with push button


………………………………………………………………………………
…………..…82

LED brightness control using PWM


…………………………………………………………………..83

Chapter 7: Electronic Schematics and Symbols

Electronic schematics
………………………………………………………………………………
……..…….86
✓ LED with a push
button………………………………………………………………………
…..88
✓ 555
timer…………………………………………………………………………
……………………………..89
✓ Transistor as a
switch………………………………………………………………………
……...90
✓ Linear power
supply………………………………………………………………………
…….……91

Common electronic symbols


……………………………………………………………….……………..9
2
Important concepts

Decoupling capacitor
…………………………………………………………….…………………
……………..95

Pull-up and pull-down resistors


…………………………………………………………….…………96

Measuring voltage and current


…………………………………………………………….……………98

Electricity is a form of energy that can be generated


through many

different sources, such as nuclear power plants, wind


turbines, and solar panels. This energy runs on volts, or units
of electric pressure. In domestic applications, electricity is
mainly used to run household appliances such as
refrigerators, washing machines, and lights. It can also be
used in industrial processes like melting metals and
powering manufacturing machinery.

A circuit must be established for the flow of electricity to


occur – this includes a controller (like an electrical switch), a
conductor (wires), and an appliance or device which
consumes the electric current. Safety measures must also be
taken to prevent injury or damage from occurring due to
hazardous currents or voltages.
Electricity is a form of energy
resulting from the flow of charged
particles, typically electrons or ions, through a conductor.
Electricity involves the use of electric fields between two
objects to move electric charges between them. This form of
energy can be generated by chemical reactions, nuclear
reactions, and kinetic energy conversions such as wind
turbines or solar cells. The key concept with charge is that it
can come in two types: positive (+) or negative (-) It means
if a charge moves from point A to point B, we can say that
current is flowing.

AC and DC voltage are two types of electrical charges that


power gadgets and machines in our everyday lives. AC
stands for Alternating Current, which is the type of electricity
that flows from your wall outlets. This current has a
frequency associated with it, while DC stands for Direct
Current, the type which is typically used in smaller electronic
devices like cell phones or computers.

AC Voltage

AC voltage or Alternating Current is the type of voltage that


changes direction continuously with change in time and is
used in our homes, offices, and industries.
Oscilloscope: Device used to measure and display different
electrical signals.

The
shape of the AC voltage is sinusoidal which looks like an up
and downhill and can be seen with the help of an
oscilloscope.
DC Voltage
Direct Current is the type of voltage that has only one
direction with changes in time and it has a straight-line
waveform.
Conductors and Non-conductors

When it comes to electricity, the concept of conductors and


nonconductors is key for safety. Knowing which is important
in electrical work since any wires carrying a current should
be insulated with nonconducting material for safety and
proper functioning. In everyday life too, the presence of
these different materials can be essential - think of those
rubber doormats you might have at your entrance they’re
generally made of conductive material so they won’t build up
a static charge.

Conductors

Such objects or materials that allow the electricity to pass


through. In conductors, electrical charge carriers can move
easily from one atom to another atom when voltage is
applied. Conductors can conduct both heat and electricity.

The best examples of conductors are Copper, Steel, Gold,


Silver, Platinum, Aluminum, and Brass.
Non-conductors / Insulators

Such objects or material that doesn’t allow electricity to pass


through. Non-conductors block the flow of electrical charge
from one to another atom and they can’t conduct heat and
electricity.

Common examples of insulators are Wood, Rubber, Plastic,


Wool, Glass, etc.,
Voltage and Current Directions

Voltage and current directions can be confusing concepts for


those new to electronics. Voltage is often denoted as "+"
(positive) and "-" (negative). Current flows from "+" to "-".
This means if the voltage is going from point A to point B,
the current will flow in the same direction, and vice versa.
Having established that, it's important to note that while
positive voltages prefer one direction over another, either
direction can work. But of course, matching positive and
negative directions when necessary is key!
The direction of electrons is essential to how electricity
behaves. Electrons form part of the subatomic particles that
make up atoms, and they carry a negative electrical charge.
When electric current flows, electrons move in one direction
along a conductor such as a wire or a circuit board. It's this
movement of electrons that allows electricity to power
gadgets, lights, and other devices around us.
Resistors
Resistors are devices that limit the flow of electricity. They’re
used wherever a controlled amount of current is needed in a
circuit. They are also used for adjusting signal levels, dividing
voltages, and in many other applications.

The resistor comes in many sizes and shapes depending on


the requirement for high voltage and current values high
power resistors are used. For small power values low
wattage resistors are used which are small in size.

Resistors are made from carbon film that conducts electricity


with some resistance and ceramic rod. The carbon film is
wound around the ceramic rod.
The value of the resistor is measured in ohms, kilo ohms and
Mega ohms and it is represented by a symbol omega (Ω).
Resistor packages: Resistors comes in two packages which
are THT (Through Hole) and SMD (Surface Mount Devices).

THT resistors or through holes are the ones that have long
legs or pins as shown in the picture. These are easy to solder
and easy to remove from the circuits.
A surface mount resistor is a tiny rectangular ceramic body
with silver conductive edges on either end.

Surface mount resistors are used in large quantities and are


the preferred resistor for use in electronics equipment,
because of their small size and high reliability.
Resistor combinations: In electronics, resistors can be
connected in two combinations. One is Parallel and the other
is a Series combination.

In the Series combination, one end of the resistor is


connected to the other end of the second resistor like a
chain. In this combination, resistance is added.

R = R1 + R2 + R3
= 470Ω + 330Ω + 5KΩ
= 5800Ω or 5.8kΩ
In a series combination, voltage is divided and the current
remains the same.

In Parallel combination both

of their terminals are respectively connected to each


terminal of the other resistor or resistors.

1= 1+ 1+ 1
R R1 R2 R3
=
1+ 1+ 1
470Ω 330Ω 5kΩ
=186.64 Ω
In this combination, the
voltage remains the same,
and the current is divided.

Calculating resistance:
The resistance of the resistor can be calculated with the help
of the multimeter or you can use the resistor color chart if
you didn’t have the multimeter.
Potentiometers are basically type of
resisters but their resistance
can be changed. They are also called variable resistors with
three terminals. Two terminals are connected to resistive
element and the center terminal is connected to rotating
wiper. The center terminal is used to sets the resistance
value.
Types of potentiometers: In the market, there are two types
of potentiometers which are
Rotary

Linear
Rotary potentiometers

Rotary potentiometer has a knob at the center which we


rotate to change the resistance. Some potentiometers are
single turns and they can’t reach more than 270 degrees but
some can rotate over 360 degrees which are called
multiturn.

They are used in a variety of applications such as controlling


volume, servo power supplies, and signal control. They are
further motors, variable divided into

Dual Gang

Concentric POT

Servo POT

Presets and Trimmers.

Linear potentiometers
Linear potentiometers are the same as the rotary
potentiometers but instead of moving in a circular direction
they move in a straight line. Linear potentiometers are
available in two pins as well as in 3 pins.

The linear pots are commonly used for measuring the


voltage across a branch of a circuit, for measuring the
internal resistance of a battery cell, and also for comparing a
battery cell with a standard cell. Types of linear
potentiometers are

Slide and Dual slide POT

Motorized Fader

Multi-Turn slide
Capacitors
A capacitor is a two-terminal, electrical component that
stores electrical charge. Along with resistors and inductors,
they are one of the most fundamental passive components
we use. Common applications of capacitors are charge
storage, voltage spike reduction, and signal filtration.

A capacitor is made from two metal plates and an insulating


material called a dielectric.A dielectric is an insulating
material which can be paper, rubber, glass, plastic, or
ceramic that prevents the flow of current and the plates are
made from conductive materials like aluminum, silver, and
tantalum. The value of the capacitor depends on the surface
area of the dielectric material. The larger the area of
dielectric material means a lesser value of the capacitor.
Capacitor combinations: Like resistors, there are also two
combinations for capacitors series and parallel.
In a series combination, one negative end of the first
capacitor is connected to the positive end of the second
capacitor. In the case of resistors in series, resistance is
added but in series capacitance, this thing is interchanged.

1= 1+ 1+ 1 C C1 C2 C3
1 + 1 + 1=
= 0.5uF
1uF 1uF 1uF
The total capacitance in this combination is 0.5 microfarad.
In parallel combination, the

positive ends of the capacitors are connected and the


negative ones are connected like this.

In a parallel combination of
capacitors, the capacitance is
added.
C = C1 +C2 +C3
= 1uF + 1uF +1uF
= 3uF

Types of capacitors

Capacitors are an essential component in electric systems,


and there are numerous types available to choose from.
Each type has its advantages and disadvantages depending
on the application for which it is being used.

Generally, capacitors can be divided into three main


categories: Electrolytic, Ceramic, and Film Capacitors.
Electrolytic capacitors include Aluminum Electrolytics,
Tantalum Polymerizable, and Supercapacitors.

Ceramics consist of Multi-layer Ceramics (MLCs), Single-


Layer Ceramics (SLCs), and Variable Tuned Capacitors.

Film capacitors come in different styles such as Metallized


Paper & Plastic (MPP), Foil & Plastic (FPP), or Metallized
Foil/Polypropylene (MFP).
Diodes

Diodes are a type of electrical component found in most


electronics. Essentially, they act like one-way valves,
allowing electrical current to flow in one direction but not the
other. Diodes are essential for controlling current flow and
ensuring that circuits correctly operate within their
parameters. As such, these tiny components are found in
almost all types of modern electronic devices from
computers to phones and even cars. There are many
varieties available, each serving its own particular purpose,
ranging from low power rectifier diodes to high power laser
diodes. Nowadays diodes have become small enough where
they’re practically invisible but yet potent enough to make
our lives much easier with the everyday gadgets we use.
ifi di d
1n4007 rectifier diode
SMDDiodesizecomparetoacoin
Construction

Diodes can be made of either of the two semiconductor


materials, silicon, and germanium. When the anode voltage
is more positive than the cathode voltage, the diode is said
to be forward-biased, and it conducts readily with a relatively
low-voltage drop. Likewise, when the cathode voltage is
more positive than the anode, the diode is said to be
reverse-biased.

Working

When a battery is connected across the diode it starts


conducting the voltage. But there is a condition which is that
the voltage must be above that certain limit which depends
on the material being used.

For germanium, the forward voltage is 0.3V and


For silicon, the forward voltage is 0..7v

Diode connections Forward biased

The diode only conducts voltage when it is forward biased


means the positive terminal of the diode is connected to the
positive of the battery and the negative one to the negative
terminal of the battery.

Reversed biased

In reversed biased diode stops the flow of current but only to


a certain limit. But when the voltage limit exceeds the diode
will be damaged and this limit is known as the reverse
breakdown voltage.
Types of diodes
The most common type of diode is Light Emitting Diode or
LED which emits light when connected to a battery.

The other most common of type of diode is rectifier diode


which converts the AC voltage into DC voltage. In rectifier
where 2 diodes are used is known as half bridge rectifier and
the where 4 diodes are used is known as full bridge rectifier.

The other types of diodes are

Laser diode

Avalanche diode

Zener diode

Schottky diode

Photodiode

Light Emitting Diodes (LEDs) is a


semiconductor device that
emits light when current flows through them. Electrons in the
semiconductor recombine with electron holes, releasing
energy in the form of photons. The color of the light is
determined by the energy required for electrons to cross the
band gap of the semiconductor.

LEDs are like tiny lightbulbs but they require a lot less power
than filament bulbs which is 0.25 watts for LEDs and 2.5
Watts for filament bulbs at 5V.
Working principle:

When the positive terminal of the LED is connected to the


positive terminal of the battery and the negative of the LED
to the negative terminal of the battery it makes the electrons
and holes recombine at the PN-junction releasing energy in
the form of light. The color of the light emitted depends on
the material used in the semiconducting element.

Aluminum alloys are used to obtain red, orange, and yellow


light, and indium alloys are used to get green, blue, and
white light. Slight changes in the composition of these alloys
change the color of the emitted light.

Led working voltage

Not all LEDs require the same amount of voltage to work.


Some LEDs work at 2.2 volts and some work at 3.2 volts. It
depends on the color of the LED that you are using.
LED packages Like resistors and capacitors LEDs also come
in two different packages Through-hole (THT) and Surface
Mount Devices (SMD).
In Through-hole there are three packages which are 10mm,
5mm, and 3mm.
10mm LEDs are a little rarer they are huge and chunky but
are usually just 5mm LEDs with a bigger case so they aren't
any brighter. They can be good indicators but we rarely see
them as illuminators.

5mm LEDs can be so bright, they are often used as


illumination.

3mm LEDs are not as bright but are smaller, and are good
for the indication (like an LED that tells you something is on).
They're not as good for illumination because they have a
smaller area that is lit.

SMD LEDs came in a variety of sizes like 1206, 0805, 0603,


0402, and 0201 which are the same in size as resistors and
capacitors.
Inductors
An inductor is an electrical component that can store energy
in its magnetic field. It is a coil of wire wound around a core,
typically made of ferromagnetic material like iron or steel,
and when an electric current passes through it, the inductor
creates a magnetic field around it.

The amount of inductance depends on the number of turns


in the coil, as well as its cross-sectional area. Inductors can
be used in many applications, such as filtering audio signals
or controlling power inductors for regulating voltage or
current levels. They are also used in applications that require
signal storage, such as oscillators and pulse generators. In
addition, because these components have low impedance
and low losses at high frequencies, they are often used in RF
(radio frequency) circuits.
di l d
Radial Inductor
Axial Inductor
Types of inductors
Depending on the type of material used inductors can be
classified as follows:

1. Iron Core Inductor (used in audio equipment)


2. Air Core Inductor (used where less amount of inductance
is required)
3. Iron Powder Inductor (used in switching power supplies)
4. Ferrite Core Inductor which is divided into,

Soft Ferrite

Hard Ferrite

Transistors
Transistors are one of the most exciting inventions in modern
technology. They're tiny yet powerful switches that allow
electrical signals to be manipulated in a variety of ways,
whether through amplification or logic processing.
Transistors work by allowing current to flow between two
contacts when an input voltage is applied, allowing a wide
range of targeted applications from communication devices
and amplifiers, to digital logic circuits and much more. Even
though they may look simple but today's most advanced
transistors contain myriad buried structures within their tiny
footprint for efficient operation in high-speed scenarios. It's
no
wonder why the invention of transistors revolutionized the
way we think about computing and communication!
Material Transistors are made from pure sometimes other
semiconductor materials manufacturing.
silicon or germanium but

are used for transistor Working In general, the transistor is of


types N-P-N and P-N-P which are made from three layers of
semiconductor material like a sandwich. If we connect all
three layers a transistor is made which can be used as a
switch or as an amplifier.

All the transistors have three terminals which are named


according to their working which are Collector, Base, and
transistor the center semi-conductor is Collector, and the
right one is the Emitter. Emitter. In the case of a PNP the
Base, the left one is the

To understand the working we have to connect the transistor


to the battery. When the voltage is supplied, the direction of
the current will be from Collector to the Emitter. But this flow
will only be possible if the Base terminal is connected to the
voltage source. So Base terminal act as a barrier between
the Collector and the Emitter. The amount of the current flow
can be controlled with the Base by increasing or decreasing
the level of the voltage.

If we go deeper, we can say that the p-type has an


oversupply of electrons and the n-type has holes that act as
a barrier for electrons to move from Emitter to the Collector.
In this situation, the transistor is in OFF state.

When the Base is connected to the voltage source it pulls the


electrons from the Emitter into the Base and from the Base
into the Collector. This condition makes the transistor turn
ON. Just a small amount of current is required at the Base
terminal to turn ON the transistor that allows a large current
to flow.
Types of transistors
Based on the switching speed and power handling the
transistors are classified into two categories, which are also
further divided into many
1. Bipolar Junction Transistors (BJT)
i. NPN
ii. PNP
2. Field Effect Transistors (FET)
i. Junction FET
ii. Metal Oxide Field Effect Transistor (MOSFET)
The Junction FET and the MOSFET are also further divided
into 3 more categories.
Electronic Fuse is an electrical
component used to protect circuitry
from over-current or short-circuit situations. It consists of a
sensitive electronic sensing device, such as a MOSFET
transistor, that trips when the current flowing through it
reaches a preset level. This trip initiates a fastswitching
action which disconnects the circuit, preventing any further
damage to it.

Construction A fuse consists of a metal strip or wire fuse


element, of a small cross-section compared to the circuit
conductors, mounted between a pair of electrical terminals A
and B.
Compared with traditional mechanical significantly faster
response times and fuses, electronic fuses offer more precise
current control.

Additionally, due to their inherently low voltage drop and no


moving parts, they are much less prone to wear out over
time compared with traditional fuses. For these reasons, they
have become one of the most frequently used pieces of
safety equipment in many industries today.

Connection Fuses are connected with the power source


before the main circuit so that if the current exceeds a
certain limit it will break the connection and protect the
circuit from damage.

Thermistor A thermistor is a type of


temperature-sensing device that
can be used in a wide range of applications. It is a
semiconductor device made from a material that shows large
changes in electrical resistance with temperature and is
typically made from ceramic or metal oxide materials.

This makes them useful in applications such as air


conditioning and heating systems, electronic devices like
computers and industrial automation systems, medical
instruments, and cellphones,

laboratory equipment. They are also used to maintain


accuracy in many commercial applications such as ovens
and refrigerators where the temperature must remain
accurate over time. Due to their simplicity of construction,
they are relatively inexpensive compared to other types of
temperature sensors.
Types of thermistors There are two types of thermistors
depending upon the type of material used.

Negative Temperature Coefficient or NTC thermistors


(resistance decreases as temperature increases)

Positive Temperature Coefficient or PTC thermistors


(resistance increases as temperature increases)

Building circuits on a breadboard is a great way to quickly


create electronic devices and test out designs. You can
create anything from an LED indicator display to motor
controllers for robotics, or even an advanced retro gaming
setup! Breadboards are easy to get started with - they have
power rails that can be connected to your power source, a
variety of sockets to insert components, and simply need
jumper wires connecting the different parts up. As
everything stays in place using pressure rather than
soldering, it's perfect for prototyping and experimenting -
plus you don't need any fancy equipment. The only limitation
you'll come across is the complexity of your design; although
more complex devices may require some creativity with the
layout of components on your breadboard!

Breadboard

A breadboard is an essential tool in electronics, allowing


quick and easy prototyping without the need for soldering. It
generally consists of a board with conductive rails
underneath, along with sockets that allow you to easily
connect components such as resistors and transistors. A
great thing about using a breadboard is that any mistakes
can be quickly fixed; components can be removed and
rearranged as needed. This makes it an ideal choice for
anyone wanting to experiment with circuits or create
something from scratch.

To start building circuits, we have to understand the basic


connections of a breadboard.
Breadboard connections
Figure: Mediumsize breadboard
Figure: Smallsize breadboardwihno power rails
LED with a switch

LED with a switch is the first circuit that every beginner


made to enter the vast field of electronics. This circuit
consists of a LED, resistor, switch, 9V battery, and
breadboard (any size). To prototype this circuit on a
breadboard we have to calculate the resistance value.
Otherwise, with the high or low value of the resistor LED will
not work properly.

To calculate the resistance Ohm's law is used which is


After the resistance calculation, we have to understand the
pin connections of the pushbutton. The push that we are
using has 4 pins two on one side and two on the other side.
The internal pin connection looks like this.

Two pins on one side A and A’ are connected and the same
with the opposite pins B and B’.
Circuit
LED in Parallel and Series combination

Led in parallel

In prevoius chapter we studied resistors and capacitors in


series and parallel combinations. But now we will learn about
the LED in parallel combination and how the resistor value
calculation is different from the previous circuit.

In all parallel circuits current is divided depending upon the


number of paths and voltage remains the same. So, in order
to make the LED to light up at full brightness we connect the
LEDs in parallel combination.
To calculate the resistance value we will use the same
formula as used before.

LED in series
In series combination of LEDs voltage is divided and current
remains the and the LEDs are connected like a chain.
Transistor as a switch
The most common type of transistor is the BC547 which
came in two type NPN and PNP.

To use a transistor in circuit


we have to first read its
datasheet first which
includes all the information
related to voltage and
current values, electrical
characteristics, and dimensions.

Collector-Emitter Voltage 45 v
Emitter-Base Voltage 6 v
Collector Current 0.01 amps
These are maximum voltage and current values of BC547
and if the voltage and current reaches above that limit the
transistor will be damaged.

Base-Emitter On Voltage 0.7 v


Base-Emitter On voltage is the voltage required to turn ON
the transistor. This is because a diode is connected between
the Base and the Emitter terminal which only allows current
to flow when voltage is above 0.7 volts.

It blocks the voltage when voltage tried to flow from Emitter


to the Base but only to a limit.

Circuit

In this circuit the transistor is used to turn ON and OFF the


motor. When the button is pressed the current will flow from
the Collector to the Emitter terminal and allow the motor to
spin.

Application of transistor as a switch


Transistors is used as a switch when controlling high power
devices with microcontroller is required. This is because
microcontroller pins can’t handle high power. It can only
provide 5V and around 40-50 milli amps.
Like the sample circuit above, an Arduino board is used to
control the motor with the help of a transistor to prevent the
board from burning.
Touch sensor with a transistor
Electric resistance is present in your body. You can determine
this by using a multimeter to measure the resistance
between your fingertips.

Your body acts as a resistor when you touch the touchpad's


wires. This means that a tiny amount of current can pass
from the battery's positive terminal through the base of the
transistor and turn it on.

The LED will turn on when the transistor is turned on


because current can flow from the transistor's collector to
emitter. When the two wires are touched the first transistor
on the left turn ON the transistor on the right and the LED
will light up.

Circuit

Water level indicator

Water level indicators are incredibly useful in a variety of


settings. They measure the exact amount of water stored in
a tank and then display this information clearly, often via
LED readouts or alarms. This helps to ensure that water
tanks remain full at all times.

In addition, these devices can be used as early warning


systems for floods by detecting when water levels rise above
predetermined levels, giving affected individuals plenty of
time to take necessary precautions. Furthermore, it
eliminates guesswork when filling up tanks with liquids other
than water since you know exactly how much is present at
any given moment.

The water-level circuit can be easily made with the help of


just 3-4 transistors. In this circuit each transistor act as a
switch just like the touch sensor circuit. But instead of
touching, the two wires are placed in a water tank. Tap water
isn’t pure it has some minerals that conduct some kind of
electricity which makes this water level indicator work.

Circuit

Working

To check the circuit, we have to place the 5 wires in a glass


of water like the sequence as shown below. The red wire with
the ‘+’ sign is the positive main wire that makes contact with
every wire when the glass started filling with water.

When the glass is empty all the LEDs will be OFF. When the
water level reaches the green wire, the green LED will light
up because the current will start flowing from red to the
green wire. When more water is added the water level rises
and the LEDs will continue to light up in a sequence.

Water level reaches green wire Water level reaches yellow


wire Water level reaches orange wire

Water level reaches red wire Q1 turned ON Q2 turned ON Q3


turned ON Q4 turned ON Green LED turned ON Yellow LED
turned ON Orange LED turned ON

Red LED turned ON

555 IC is the most common IC in the electronics world that


can be used in a variety of ways such as timers, pulse
generators, LED and lamp flashers, Pulse Width Generation
(PWM), logic clocks, etc.,

The 555 IC has 8 pins, two for the voltage


and the other 6 which can be used for
different purposes with external
components. The outer look of this IC is
pretty simple with the IC number and the
manufacturer logo or name on it.
Ever wondered what the inside of IC looks like? The inside of
NE555 looks a lot more beautiful than the outer cover.

The number of
components in this IC are

Transistors=25
Diodes= 2
Resistors=15
The transistors in this IC are in the size of nanometers which
is smaller than the grain of rice.
Image from the Wikipedia --NXP-7555
The first pin of any IC can be identified by the circle which
will be on the left side and it goes from top to bottom and
from left to right
LED blinking using 555

For LED blinking we have to generate a square wave signal


which can be generated by using 555 in Astable mode. Thus,
the output will fluctuate from high to low and zero to high.
This signal is also called Pulse Width Modulation or PWM.

Circuit diagram:

Working : 555 timer is most commonly used in the astable


mode which can be created with the combination of resistor
and capacitor to cycling function.

When the 9V battery is connected to the breadboard the


voltage at the capacitor, trigger pin 2, and threshold pin 6 is
low. If the voltage at the trigger pin 2 is low then the current
will be able to flow from internal resistors which in turn
charges the 100nF capacitor.

When the capacitor charges up to 6 volts which takes some


milliseconds the output pin 3 voltage becomes zero (LED is
OFF). The voltage of output pin 3 causes the discharge pin 7
to turn ON and drain out the capacitor voltage. Once the
capacitor voltage drops to 3 volts the trigger pin turns OFF
the discharge pin and the capacitor starts charging again.

Variable PWM using 555


In this LED blinking circuit PWM signal is generated which
can’t change its width to adjust the brightness. Like the
picture below which shows the change in width of the square
wave. To generate a variable PWM a few components are
added which are diodes and a potentiometer.

Working

The output of the IC is LOW when the capacitor C1 is


discharging but only through the resistor R2. So, we can
notice that if we change the values of any of these three
components, we will get different ON and OFF times, or
different duty cycle of the square wave output signal. An
easy and instant way to do this is to replace the R2 resistor
with a potentiometer, and additionally add two diodes in the
circuit.

In this configuration the ON time will depend on the resistor


R1, the left side of the potentiometer and the capacitor C1,
while the Off time will depend on the capacitor C1 and the
right side of the potentiometer. We can also notice that in
this configuration the period of one cycle, thus the
frequency, will always be the same, because the total
resistance, while charging and discharging, will remain the
same.

Usually, the R1 resistance is much smaller than the


resistance of the potentiometer, for example, 1K compared
to 50K of the potentiometer. In that way we have 99%
control over the charging and discharging resistance in the
circuit. The control pin of the 555 Timer is not used but it’s
connected to a 100nF capacitor in order to eliminate any
external noise from that terminal. The reset, pin number 4, is
active low so therefore it is connected to VCC in order to
prevent any unwanted reset of the output.
Circuit diagram

Logic gates form the basis of modern computing and have


been around for a long time. In the simplest terms, logic
gates are digital circuits that take one or more inputs and
output a single Boolean (true/false) result. A logic gate is
essentially a device that processes signals, often
represented as binary numbers, according to logic
operations. Together, the numerous logic gates within a
computing system allow for the manipulation of data and
form the backbones of modern digital systems.
Logic gates are essential to most digital systems because
they define how they will process information. The input and
output of any digital system are determined by its logic
gates. Each logic gate has a Boolean function as its output.
These Boolean functions are typically written in terms of
"AND," "OR," "NAND," "NOR," "XOR," and "NOT" logic gates.
Each type of logic gate accepts two logic inputs and
produces a single output.

Logic gates are used among numerous digital platforms. In


digital circuits, they are used to build basic logic components
like adders, multiplexers, latches, and flip-flops, which are
key components in all computers and other electronic digital
devices. In programmable logic controllers (PLCs), logic
gates are commonly used to provide access to specific areas
of a production process, as well as provide safety control.
They are also used in modern artificial intelligence that helps
computers better understand the world around them and
make decisions.

AND Gate

In digital electronics, an AND gate is a logic gate that


implements logical conjunction — it behaves according to
the truth table to the right. A HIGH output (1) results only if
all the inputs to the AND gate are HIGH (1). If none or not all
inputs to the AND gate are HIGH, a LOW output (0) results.

INPUT A INPUT B OUTPUT 0 0 0


100
010
111

We can verify this table by simulating the AND Gate in


software.

In first gate the both inputs are zero so the output is also
zero.

In second gate the input A is 1 and the input B is 0 but still


the output is 0.

In the third we switched the inputs but the output is zero.


When we turned ON the both inputs A and B we will get 1 at
the output. If we make the circuit to understand the AND
gate it would be like this

Two push buttons are connected in a series combination. The


LED will only turn ON if we press the two buttons at the same
time.
OR Gate

The OR gate is a logic gate that is used to implement logical


operations on two or more input signals. The output of the
OR gate is true if at least one of the inputs is true. The OR
gate has two or more input lines, each of which determines
the output. The output is false if all of the inputs are false.

INPUT A INPUT B OUTPUT 0 0 0 1 0 1 0 1 1 1 1 1

Simulation results are

In first gate the both inputs are zero so the output is also
zero.

In second gate the input A is 1 and the input B is 0 and the


output is 1.

In the third we switched the inputs but the output is still 1


When we turned ON the both inputs A and B we will get the
same 1 output.

For better understanding, the OR gate circuit will be like this


The LED will turn ON when just one push button is pressed.
NOT Gate

A Logic NOT gate is a type of digital logic gate that has one
input and one output. It is typically symbolized by a triangle
with a line crossing through it. It performs a logical "not"
operation, which means that if the input is true (1), the
output is false (0). If the input is false (0), the output is true
(1).

INPUT OUTPUT 0 1 1 0

In the first NOT gate, when the input is 0 the output is 1 and
in the second NOT gate it does the opposite.
When battery is connected to the circuit the LED will light up
and when the push button is pressed it will short the positive
and negative terminal of the battery and LED will turn OFF

NAND Gate

A NAND gate is a digital logic gate that produces an output


that is the negation of the logical AND of its inputs. The
output of a NAND gate is true (1) only if at least one of its
inputs is false (0). The symbol for a NAND gate is a standard
AND symbol with a small circle on the output.
INPUT A INPUT B OUTPUT 0 0 1
101

The NAND gate is the opposite of AND gate and when the
both inputs are 0 the output will be 1 because of the NOT
gate at the output.

When both inputs are 1 the NAND gate gives 0.

NOR Gate

A NOR gate is a digital logic gate that produces an output


that is the negation of the logical OR of its inputs. The output
of a NOR gate is true (1) only if both of its inputs are false
(0). The symbol for a NOR gate is a standard OR symbol with
a small circle on the output. The NOR gate is also known as
an OR-NOT gate. Like NAND gates, NOR gates are considered
as "universal gates" because they can be used to implement
any other type of logic gate.

INPUT A INPUT B OUTPUT 0 0 1 1 0 0

The output of OR gate is 0 when both the inputs are 0. In


NOR the NOT gate at the end changes the output to 1.

XOR Gate
A XOR gate (Exclusive OR gate) is a digital logic gate that
produces an output that is true (1) if and only if exactly one
of its inputs is true (1). The output of a XOR gate is false (0)
if both inputs are the same. The symbol for a XOR gate is a
standard OR symbol with an additional line crossing it. The
XOR gate is also known as an "exclusive OR" gate. It can be
used to compare two bits and see if they are different.
Additionally, it can be used to create a parity bit in a circuit.

INPUT A INPUT B OUTPUT 0 0 0 1 0 1 XOR Gate is basiclly a


combination of 2 NOT, AND, and 1 OR Gate.

There are two AND gates that makes the output 0 when the
both inputs are also 0.

When the input A is 1 the second NOT gate and the input A
makes the first AND gate to turn ON. At the end OR gate is
used which outputs 1 if one of the inputs is 1.

Same thing happens when the input B is 1 but AND gate 2


turns ON in this case.

XNOR Gate

A XNOR gate (Exclusive NOR gate) is a digital logic gate that


produces an output that is true (1) if both of its inputs are
the same and false (0) if both inputs are different. The output
of a XNOR gate is the negation of the output of a XOR gate.
The symbol for a XNOR gate is a standard XOR symbol with a
small circle on the output. It is also known as an "exclusive
NOT-OR" gate. It can be used to compare two bits and see if
they are the same. Additionally, it can be used to create an
inverted parity bit in a circuit.

It is a combination of 2 OR, 1 NOT and 1 AND gate.

INPUT A INPUT B OUTPUT 0 0 1 1 0 0 0 1 0 1.

2.
3.
4.
Logic gates using transistors

Logic gates ICs are also available in the market but logic
gates can be made with the help BJT transistors which
require transistors, resistors, and push buttons.

AND gate

LED will light up when push buttons A and B are press


together. When A is pressed the transistor Q turned ON but
still LED is OFF because the transistor Q2 blocks the flow
current. So, when button B is pressed along with A the
current will flow through the circuit and LED will light up.

OR gate

NAND gate NOR gate

NOT gate Adder circuits


An adder circuit is a type of digital logic circuit that is used to
perform addition of two or more numbers. The two most
common types of adders are half adders and full adders.

In digital circuits, adders are used in many applications such


as arithmetic logic units, counters, and memory address
generators, etc.
Half adder

A half adder is a simple adder circuit that can add two binary
digits (bits) and produce a sum (S) and a carry (C) output.
The half adder has two inputs (A and B) and two outputs (S
and C). The sum output (S) is the XOR of the inputs (A and
B), and the carry output (C) is the AND of the inputs (A and
B). Half adder is used to add two single digits and if the sum
of these binary digits is a three-digit number it becomes a
carry.

The 2-bit half adder truth table is as below:

INPUTS OUPUTS INPUT A INPUT B SUM CARRY 0 0 0 0 0 1 1 0


1 0 1 0 1 1 0 1 In decimal addition, if you add 8 + 2 you get
ten, which you write as 10; in the sum this gives a digit 0
and a carry of 1. Something similar happens in binary
addition when you add 1 and 1; the result is two (as always),
but since two is written as 10 in binary, we get, after
summing 1 + 1 in binary, a digit 0

and a carry of 1.
0+0=0
0+1=1
1+0=0
1 + 1 = 10
LogicGates ICwihcode writtenontopofthem
CD4001 for NOR Gate

CD4001 internal pinout


Full adder

A full adder is a more complex adder circuit that can add


three binary digits (bits) and produce a sum (S) and a carry
(Cout) output. The full adder has three inputs (A, B, and Cin)
and two outputs (S and Cout). The sum output (S) is the XOR
of the inputs (A, B, and Cin), and the carry output (Cout) is the
OR of the AND of inputs A and B, and the AND of input Cin
with the XOR of inputs A and B.

INPUTS OUTPUTS A B C-in SUM CARRY 0 0 0 0 0 0 0 1 0 1 0 1


0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 The
output carry is designated as C-OUT and the normal output is
represented as S which is ‘SUM’.
With the above full adder truth-table, the implementation of
a full adder circuit can be understood easily. The SUM ‘S’ is
produced in two steps:
1. By XORing the provided inputs ‘A’ and ‘B’ 2. The result of
A XOR B is then XORed with the C-IN

This generates SUM and C-OUT is true only when either two
of three inputs are HIGH, then the C-OUT will be HIGH. So,
we can implement a full adder circuit with the help of two
half adder circuits. Initially, the half adder will be used to add
A and B to produce a partial Sum and a second-half adder
logic can be used to add C-IN to the Sum produced by the
first half adder to get the final S output.

If any of the half adder logic produces a carry, there will be


an output carry. So, C-OUT will be an OR function of the half-
adder Carry outputs.
4-bit Calculator using full adder IC
This 4-bit calculator uses 74LS83 full adder IC along with 7-
segment decoder and 7-segment. It is called 4-bit it has 4
inputs and it can add up to 16 because 24= 16 (it’s a 4-bit
calculator).

In the first four inputs we add 1 and 4 and in the last four
inputs we added 2. The total sum of these three numbers are
1 + 4 + 2 = 7.

Microcontroller: A microcontroller is a small size computer


that is designed to perform specific tasks. It consists of
Inputs/Outputs, Random Access Memory (RAM), Read Only
components. Microcontrollers are
used in many electronic devices to
Memory (ROM), and various other
perform specific tasks.
microcontroller needs to

The
be
programmed before doing any kind
of task.

So, how do they are programmed?


To program a microcontroller, we
used different kinds of software like

Arduino Ide, MPLAB, and STM cube IDE. In which we wrote


multiple lines of code in programming languages like C,
C++, Python, etc. because microcontrollers can’t understand
our languages.
After writing the code it is then converted into a hexadecimal
form which is 0x00, 0x01, 0x20 by the software itself.
void setup() :100000000C945C000C946E000C946{
E000C946E00CApinMode(LED_BUILTIN, OUTPUT);
:100010000C946E000C946E000C946} E000C946E00A8void loop()
:100020000C946E000C946E000C946{
E000C946E0098digitalWrite(LED_BUILTIN,

HIGH);:100030000C946E000C946E000C946delay(1000);
E000C946E0088digitalWrite(LED_BUILTIN, LOW);
:100040000C9413010C946E000C9delay(1000);

}
The leftimage shows thesimple code writteninC++and the
image onthe right shows the hexadecimalformofthatcode.

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, that runs on your
computer, used to write and upload computer code to the
physical board.

Arduino board : There are several boards developed by


Arduino that are different in size, speed, memory, and
compatibility. The widely used Arduino Boards are:

Arduino Nano
Width = 1.8 cm Length = 4.5cm

Arduino UNO
Width = 5.34 cm Length = 6.86 cm

Arduino
software:
program Arduino boards
The software used to is the Arduino IDE (integrated
Development Board)

What is an IDE…?
An IDE is basically any kind of software application that helps
people to write codes.
i d i d
First Arduino code

LED blinking In the previous chapter, we learned about how


to make a blinking LED circuit using 555 timer IC which is
slightly more difficult as it consists of many components. In
this, we will learn about the LED blinking using the
microcontroller.

In the 555 blinking circuit capacitor is used to control the


time to turn ON and OFF the LED but in the
microcontroller, we will add delay like 1000 for 1 second and
500 for 0.5

seconds and so on. Here is

the simple code to blink an LED for 1 second.

In the picture, pinMode is used to make the pins of the


microcontroller to be used as an output or as an input.

For LED blinking we choose PIN 13 and make it OUTPUT.


pinMode (13, OUTPUT)
In void loop() we write our main code which runs over and
over until the reset button is pressed. So in void loop() the
code is
digitalWrite(13,1); turns ON the PIN 13
delay(1000); keeps the PIN 13 ON for 1 second
digitalWrite(13,0); turns OFF the PIN 13
delay(1000); keeps the PIN 13 OFF for 1 second

After uploading this code, the LED will continue blinking until
the power is removed or the reset button is pressed.
The circuit for the blinking LED will look like this with the
330-ohm resistor connected with the long leg of the LED and
the other leg of the LED is connected to GND or ground.

The Arduino board will be connected to the computer with


the help of a USB type-b mini cable.
Circuit diagram

LED with pushbutton:


To control a LED with a push button by using a
microcontroller we have to configure any two pins of the
microcontroller. One pin as an INPUT because it will receive a
signal from the button and
the other pin as an OUTPUT for the LED
because it will give the signal to the LED.

In the previous blinking code, we already


know how to make a pin as OUTPUT by
pinMode(13,OUTPUT);
To make a pin as INPUT simply write
INPUT in the place of OUTPUT.
pinMode(13,INPUT);

To process to control an LED with a push


button can be understood with the help of a flow chart. A
condition is used which says If a button is pressed, then turn
ON the LED else the LED remains OFF
So, the code for this
condition will be like this

That uses the if-else condition. Whenever a button is pressed


it will supply 5V to PIN A0 which will then supply the 5V
signal to turn ON the LED.
The circuit is the same as the previous one but two more
components are added, a pushbutton and a 10k
ohm resistor.

LED
brightness control using variable PWM

In chapter 4 we created a circuit through which we can


change the brightness of a LED using a 555 timer. It works
by sending short pulses of electric current to the LED at
different intervals, controlling how much voltage and
consequently, how much light, it gets. This allows for precise
regulation, with very little power waste and a smooth color
transition from full-on to total darkness.

The circuit uses the ADC module of the Arduino board which
receives data from the potentiometer and changes the
output signal. There are 6 ADC pins which are labeled A0, A1,
A2, A3, A4, and A5 and the 6 other pins that can create a
PWM signal are 2, 3, 5, 9, 10, and 11.
Let’s start with the working of Analog to Digital Converter
(ADC). It converts the analog signal into a digital signal
which can be understood by a microcontroller. Almost all
sensors like temperature, humidity, and smoke send analog
signals to a microcontroller which is then converted into a
digital signal to get data. ADC converts analog values like 1,
10 220, 150, and 100 into 1011010.
Connections of LED and a Potentiometer are defined at the
start.

In the beginning the ADC value is zero and its range is 0 to


1023.

In void setup() LED is defined as an OUTPUT and the


potentiometer as an INPUT.

In the main loop section, the ADC will read the value from
the potentiometer with the help of theanalogRead() function.
At first, the ADC value is zero but when we rotate the
potentiometer the value will change. After that, we will use
the map function in which we set the minimum and
maximum value of the ADC and the minimum and maximum
value of the PWM module. The map function compares the
values and changed the value of the PWM when there is the
change in the ADC value.
A schematic is essentially a graphical representation of an
electrical circuit that uses symbols to identify each
component and how they are connected together.
Schematics can provide a great deal of information about
your device or system, including input/output relationships,
power consumption, and expected performance levels. With
some practice, even non-technical types can become
familiar with reading these diagrams - it's almost like
learning a new language. So why not get out those wire
strippers and test probes and start exploring this exciting
realm?

Reading schematics

Reading electronics schematics can seem like a daunting


task, but it is just taking the time to understand the symbols
and their relationship to each other. Reading through a
schematic will help you gain an understanding of how
electrical components interact with one another. By
becoming familiar with the different symbols used in
schematic drawings, you'll be able to decipher which
resistors, capacitors, transistors, and integrated circuits are
needed for the project at hand.

This is the basic schematic of an LED connected with a 220-


ohm resistor, a push button, and a battery. Whenever the
push button is pressed the LED turns ON. If we implement
this on a Veroboard we can easily understand the schematic
and all the connections.
This schematic can also be drawn by using a GROUND
terminal which makes the schematic a lot easier to read
especially in the case of complex circuits.

You can add any numbers of ground and battery positive


terminals in the schematic but simple the schematic the
easier to read.
555 Timer LED blinking schematic:

In general, we use schematics to make any kind of circuit.


Like the LED blinking circuit using 555 timer IC that is made
on a breadboard by using the above schematic.
When making circuits on a breadboard or a Veroboard make
sure to check all the connections first and then connect the
battery. With wrong connections, the components can be
damaged or can explode.

Transistor as a switch:

In the above schematic, when the button KEY 1 is pressed


the base pin B of the transistor allows the voltage to flow
from collector pin C to emitter pin E which makes the motor
spin.
Linear Power supply:
The linear power supply uses fixed voltage regulators that
can provide fixed voltage when there is a fluctuation in the
input voltage. 7805 regulator provides the 5V voltage at the
output when 7v to 9v power is connected at pin 1. regulators
into 3.3V. The AMS1117-3.3 then converts the 5V from the
7805
Important concepts

Decoupling capacitor

A decoupling capacitor is a capacitor that is used to reduce


the effects of unwanted electromagnetic interference (EMI)
on a circuit. It is often placed near an integrated circuit (IC)
to provide a local source of power when the IC's power
supply is temporarily disrupted or "noisy." This helps to
stabilize the voltage and reduce the amount of noise in the
circuit. Decoupling capacitors are typically small ceramic or
tantalum capacitors with values in the range of 0.1 to 10
microfarads.

In addition, they act as a filter for low-frequency signals,


ensuring that only specific frequencies can be transmitted
along the desired path. The selection of the proper resistor
size and capacity is paramount to ensure optimal
performance with regards to noise reduction and power
flicker prevention.

Pull-up and pull-down resistors

A pull-up resistor is a resistor that is used to ensure that a


signal line is at a known state when it is not actively driven
by a circuit. It is connected between a signal line and a
voltage source, typically VCC. When the signal line is not
driven by the circuit, it will be pulled up to the voltage level
of VCC, hence the name "pull-up." The value of the resistor is
chosen so that it is high enough to prevent the signal line
from being pulled up too quickly, but low enough to allow it
to be pulled up quickly enough to prevent any false signals.
A pull-down resistor is a resistor that is used to ensure that a
signal line is at a known state when it is not actively driven
by a circuit. It is connected between a signal line and ground.
When the signal line is not driven by the circuit, it will be
pulled down to ground, hence the name "pull-down." The
value of the resistor is chosen so that it is high enough to
prevent the signal line from being pulled down too quickly,
but low enough to allow it to be pulled down quickly enough
to prevent any false signals.

Both pull-up and pull-down resistors are commonly used in


digital circuit design to ensure that a signal line is in a known
state when it is not actively driven. They are used to prevent
floating inputs (undefined state) and to provide a stable
voltage level for the input of a digital device.

Voltage and current measurement

A voltmeter is a device used to measure voltage, or electrical


potential difference, between two points in an electrical
circuit. It typically has a range of measurements, such as 0-
100V, and can be connected in parallel with the circuit being
measured. The reading on the voltmeter will indicate the
voltage difference between the two points to the leads are
connected. To measure the voltage in a circuit, the voltmeter
leads are connected across the two points in the circuit
where the voltage is to be measured. The voltmeter must be
connected in parallel with the components to measure
voltage otherwise it will become a load to the circuit.

A current measurement is used to determine the flow of


electrical current in a circuit. The most common device used
to measure current is an ammeter. It typically has a range of
measurement, such as 0-20A, and is connected in series with
the circuit being measured otherwise it will become a load.
The reading on the ammeter will indicate the current flowing
through the circuit. To measure the current in a circuit, the
ammeter is connected in series with the circuit, meaning the
ammeter is placed in the path of the current flow. It is
important to note that connecting an ammeter in parallel
with the circuit can damage the ammeter and should be
avoided.

100

THE END ----------

You might also like