0% found this document useful (0 votes)
21 views

Module 5

Uploaded by

prakashmunda2002
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Module 5

Uploaded by

prakashmunda2002
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 65

MODULE 5

Binary Number System

The binary number system uses only two digits: 0 and 1. The numbers in this
system have a base of 2. Digits 0 and 1 are called bits and 8 bits together make a
byte. The data in computers is stored in terms of bits and bytes.

Octal Number System

The octal number system uses eight digits: 0,1,2,3,4,5,6 and 7 with the base of 8.
Just like the binary, the octal number system is used in minicomputers but with
digits from 0 to 7.

Decimal Number System

The decimal number system uses ten digits: 0,1,2,3,4,5,6,7,8 and 9 with the base
number as 10. If any number is represented without a base, it means that its base is
10.
Hexadecimal Number System

The hexadecimal number system uses sixteen digits/alphabets: 0,1,2,3,4,5,6,7,8,9


and A,B,C,D,E,F with the base number as 16. Here, A-F of the hexadecimal
system means the numbers 10-15 of the decimal number system respectively. This
system is used in computers to reduce the large-sized strings of the binary system.
For example, 7B316, 6F16, and 4B2A16 are some examples of numbers in the
hexadecimal number system.

Conversion of Number System

Steps for Conversion of Binary to Decimal Number System

To convert a number from the binary to the decimal system, we use the
following steps.
• Step 1: Multiply each digit of the given number, starting from the rightmost
digit, with the exponents of the base.
• Step 2: The exponents should start with 0 and increase by 1 every time we
move from right to left.
• Step 3: Simplify each of the above products and add them.

Let us understand the steps with the help of the following example in which
we need to convert a number from binary to decimal number system.
Example: Convert 1001112 into the decimal system.
Solution:
Step 1: Identify the base of the given number. Here, the base of 1001112 is
2.
Step 2: Multiply each digit of the given number, starting from the rightmost
digit, with the exponents of the base. The exponents should start with 0 and
increase by 1 every time as we move from right to left. Since the base is 2
here, we multiply the digits of the given number by 20, 21, 22 , and so on
from right to left.

Step 3: We just simplify each of the above products and add them.

Or, we can use the following steps to make this process simplified.
100111 = (1 × 25) + (0 × 24) + (0 × 23) + (1 × 22) + (1 × 21) + (1 × 20)
= (1 × 32) + (0 × 16) + (0 × 8) + (1 × 4) + (1 × 2) + (1 × 1)
= 32 + 0 + 0 + 4 + 2 + 1
= 39
Thus, 1001112 = 3910.
Conversion of Decimal Number System to Binary / Octal /
Hexadecimal Number System

Example: Convert 432010 into the octal system.


Solution:
Step 1: Identify the base of the required number. Since we have to convert
the given number into the octal system, the base of the required number is
8.
Step 2: Divide the given number by the base of the required number and
note down the quotient and the remainder in the quotient-remainder form.
Repeat this process (dividing the quotient again by the base) until we get
the quotient less than the base.

Step 3: The given number in the octal number system is obtained just by
reading all the remainders and the last quotient from bottom to top.

Therefore, 432010 = 103408


Conversion from One Number System to Another Number
System

To convert a number from one of the binary/octal/hexadecimal systems to


one of the other systems, we first convert it into the decimal system, and
then we convert it to the required systems by using the above-mentioned
processes.
Example: Convert 10101111002 to the hexadecimal system.
Solution:
Step 1: Convert this number to the decimal number system as explained in
the above process.

Thus, 10101111002 = 70010 → (1)


Step 2: Convert the above number (which is in the decimal system), into
the required number system (hexadecimal).
Here, we have to convert 70010 into the hexadecimal system using the
above-mentioned process. It should be noted that in the hexadecimal
system, the numbers 11 and 12 are written as B and C respectively.

Thus, 70010 = 2BC16 → (2)


From the equations (1) and (2), 10101111002 = 2BC16
Conversion of Binary to Octal
Since binary numbers are used in computers in the form of bits or bytes
and octal numbers are used in electronics, direct conversion from binary to
octal is not a method. There are two kinds of methods that are used in the
binary to octal conversion.
Method 1: Converting Binary to Decimal then from Decimal to Octal
Here are the steps that need to be followed for this method.
• Step 1: Identify the binary number
• Step 2: Convert binary to decimal by multiplying each digit by 2n-1 where 'n'
is the position of the digit from the right.
• Step 3: The derived answer is the decimal number for the given binary
number
• Step 4: Divide the decimal number by 8
• Step 5: Note the remainder
• Step 6: Continue the above two steps with the quotient till the quotient is
zero
• Step 7: Write the remainder in the reverse order
• Step 8: The answer is the required octal number for the binary number
For example: Convert the binary number (1011101)2(1011101)2 to an
octal number.
Solution: According to method 1, first convert the binary number to
decimal number.
(1011101)2(1011101)2 = ( 1 x 26) + (0 x 25) + (1 x 24) + (1 x 23) + (1 x 22) +
(0 x 21) + (1 x 20)
= 64 + 0 + 16 + 8 + 4 + 0 + 1
= 93
(1011101)2(1011101)2 = (93)10(93)10
The next step is to convert the decimal number to an octal number by
dividing 93 by 8.
93 divided by 8 will give 5 as remainder and 11 as the quotient
11 divided by 8 will give 3 as remainder and 1 as the quotient
1 divided by 8 will give 1 as remainder and 0 as the quotient
Collect the remainders in reverse order we get 1 3 5
Therefore, binary number \((1011101)_{2}\) = \((135)_{8}\)
Method 2: Converting Binary to Octal by grouping
Here are the steps that need to be followed for this method.
• Step 1: Identify the binary number i.e. the digits should be either 0 or 1 with
base 2.
• Step 2: Group all the 0 to 1 in a set of three starting from the right side.
• Step 3: Add 0's to the left if it does not form a group of three. Each group
must have three digits.
• Step 4: Look at the binary to octal conversion table to get the accurate
numbers.
• Step 5: Once obtained, that number is the octal number

For example: Convert the binary number (01110101)2(01110101)2 to an


octal number.
Solution: Using the grouping method, set the binary number into three
numbers in each group.
(01110101)2(01110101)2 = 001 110 101 = 1 6 5
(01110101)2(01110101)2 = (165)8
How to Convert Octal to Binary?

There are two ways to convert octal to binary, which are explained below:
• Convert octal to decimal and then decimal to binary
• The direct method of octal to binary conversion

Let us understand each method in detail one by one.


Method 1: Octal to decimal and then decimal to binary
In this method, we will first convert a number from octal to decimal (base 10),
and then we will convert that decimal number to binary. To convert a
number from octal to decimal, we multiply its digits starting from the right
with 8 raised to exponents starting from 0 and then add the values. So, the
first digit from the right will be multiplied by 80, which is equal to 1, the
second digit will be multiplied by 81 = 8, and so on.
Let us take an example of the number 568. The 8 written as the base
represents that this is a base-8 number. 568 can be converted to base 10
as,
568 = 6 × 80 + 5 × 81
568 = 6 × 1 + 5 × 8
= 6 + 40
= 46
Hence, 568 = 4610. Now, we will convert 46 which is a base 10 number to
its binary equivalent. To convert decimal to binary, divide the given number
by 2 and note down the quotient and reminder. Again divide the quotient
obtained by 2, and note down the remainder. Repeat this process till you
get 0 as the quotient. Write the remainders in order from right to left. Let us
convert 4610 to binary.
Divide 46 by 2 ⇒ 46 ÷ 2 = Quotient - 23, remainder - 0
23 ÷ 2 = Quotient - 11, remainder - 1
11 ÷ 2 = Quotient - 5, remainder - 1
5 ÷ 2 = Q - 2, R - 1
2 ÷ 2 = Q - 1, R - 0
1 ÷ 2 = Q - 0, R - 1
Arrange all the remainders from right to left. We will get,
4610 = 1011102
Therefore, we have converted an octal number 568 to its binary equivalent
1011102.
Method 2: Direct Method of Octal to Binary Conversion
Another method, surely an easier and less complicated one, is to directly
convert a number from octal to binary by referring to the octal to binary
table given above. In this method, we convert every digit of the given octal
number to its binary equivalent by referring to the above chart. For
example, using this method we can directly write 38 as 0112, 58 as 1012,
etc.
Let us convert the same number 568 from octal to binary using the direct
method. There are two digits in this number, 5 and 6. Referring to the
above octal to binary chart:
58 → 1012
68 → 1102
By combining these two, we will get, 568 = 1011102. Observe the image
given below for your reference.
How to Convert Decimal to Binary?

To convert numbers from decimal to binary, the given decimal number is


divided repeatedly by 2 and the remainders are noted down till we get 0 as
the final quotient. The following steps is considered as the decimal to binary
formula that shows the procedure of conversion.
• Step 1: Divide the given decimal number by 2 and note down the remainder.
• Step 2: Now, divide the obtained quotient by 2, and note the remainder
again.
• Step 3: Repeat the above steps until you get 0 as the quotient.
• Step 4: Now, write the remainders in such a way that the last remainder is
written first, followed by the rest in the reverse order.
• Step 5: This can also be understood in another way which states that the
Least Significant Bit (LSB) of the binary number is at the top and the Most
Significant Bit (MSB) is at the bottom. This number is the binary value of the
given decimal number.

Let us understand this with an example.


Example: Convert the decimal number 1310 to binary.
Solution: We will start dividing the given number (13) repeatedly by 2 until
we get the quotient as 0. We will note the remainders in order.

Binary to Decimal Conversion Methods

Binary to decimal conversion is done to help read large binary numbers


easily in a form that humans can understand. There are two methods to
convert a number from binary to decimal number system.
• Positional Notation Method
• Doubling Method
Binary to Decimal Conversion Using Positional Notation
Method

The positional notation method is one in which the value of a digit in a


number is determined by a weight based on its position. This is achieved
by multiplying each digit by the base (2) raised to the respective power
depending upon the position of that digit in the number. The sum of all
these values obtained for each digit gives the equivalent value of the given
binary number in the decimal system. Let us understand this with the help
of examples.
Example: Convert the binary number 1011012 to a decimal number.
Solution: Observe the following steps to understand the binary to decimal
conversion. In any binary number, the rightmost digit is called the 'Least
Significant Bit' (LSB) and the left-most digit is called the 'Most Significant
Bit' (MSB). For a binary number with 'n' digits, the least significant bit has a
weight of 20 and the most significant bit has a weight of 2n-1.

• Step 1: List out the powers of 2 for all the digits starting from the rightmost
position. The first power would be 20 and as we move on it will be 21, 22, 23,
24, 25,... In the given example, there are 6 digits, therefore, starting from the
rightmost digit, the weight of each position from the right is 20,21,22,23,24,25.

• Step 2: Now multiply each digit in the binary number starting from the right
with its respective weight based on its position and evaluate the product.
Observe the figure shown below to relate to the step. Finally, sum up all the
products obtained for all the digits in the binary number.
• Step 3: Now, express the binary number as a decimal number: 1011012 =
4510

Binary to Decimal Conversion Using Doubling Method

As the name suggests, the process of doubling or multiplying by 2 is done


to convert binary to decimal. Let us use the same example for converting
the binary number 1011012 to decimal.
Example: Convert the binary number 1011012 to decimal using doubling
method.
Solution: Observe the following steps given below to understand the
binary to decimal conversion using the doubling method.
• Step 1: Write the binary number and start from the left-most digit. Double
the previous number and add the current digit. Since we are starting from the
left-most digit and there is no previous digit to the left-most digit, we
consider the double of the previous digit as 0. For example, in 1011012, the
left-most digit is '1'. The double of the previous number is 0. Therefore, we
get ((0 × 2) + 1) which is 1.
• Step 2: Continue the same process for the next digit also. The second digit
from the left is 0. Now, double the previous digit and add it with the current
digit. Therefore, we get, [(1 × 2) + 0], which is 2.
• Step 3: Continue the same step in sequence for all the digits. The sum that is
achieved in the last step is the actual decimal value. Therefore, the result of
converting the binary number 1011012 to a decimal using the doubling
method is 4510

Binary to Decimal Formula

In the previous section, we understood the methods and their stepwise


process to convert a binary to a decimal. Let us learn the general formula
for converting a binary number to a decimal number now. Considering dn to
be the digits of a binary number consisting of 'n' digits, the formula to
convert binary to decimal is given as,
Binary to Decimal Conversion Formula:

(Decimal Number)10 = (d0 × 20 )+ (d1 × 21 )+ (d2 × 22 )+ ..... + dn-1 × 2n-1)


where, d0, d1, d2 are the individual digits of the binary number starting from
the right-most position.
Let us see the application of the above binary to decimal formula and learn
how to convert binary to decimal using the following example.
Example: Convert 11102, from binary to decimal using the binary to
decimal formula.
Solution: We start doing the conversion from the rightmost digit, which is
'0' here.
(Decimal Number)10 = (d0 × 20) + (d1 × 21 )+ (d2 × 22 )+ ..... (dn-1 × 2n-1),
= (0 × 20) + (1 × 21) + (1 × 22) + (1 × 23)
= (0 × 20) + (1 × 21) + (1 × 22) + (1 × 23)
=0+2+4+8
= 14
Therefore, 11102 = 1410

Division by 2 Quotient Remainder

13 ÷ 2 6 1 (LSB)

6÷2 3 0

3÷2 1 1

1÷2 0 1 (MSB)

After noting the remainders, we will write them in such a way that the Most
Significant Bit (MSB) of the binary number is written first, followed by the
rest. Therefore, the binary equivalent for the given decimal number 1310 is
11012. This means that 1310 = 11012.
How to Convert Decimal to Hexadecimal?

In order to convert decimal to hexadecimal, we need to do some basic


mathematical calculations using the following steps.
• Step 1: Divide the given decimal number system value by 16 and note
the remainder.
• Step 2: Divide the quotient by 16. Repeat this until you get a quotient equal to
zero.
• Step 3: Use the characters A, B, C, D, E, F in place of 10, 11, 12, 13, 14, 15 in
the remainders respectively, wherever needed.
• Step 4: Follow the reverse order pattern to arrange all the values of the
remainder.
• Step 5: The obtained number is the required hexadecimal number.

The Decimal to hexadecimal conversion formula of given numbers can be


expressed as,
P10 = Q16
where P is a decimal number and Q is a hexadecimal number.
Let us understand how to convert a decimal number to a hexadecimal
number with the help of the following example.
Example: Convert 5386 to a hexadecimal number.
Solution: We will use the following steps to convert 5386 to hexadecimal.
• Step 1: Divide 5386 by 16 to get 336 as the quotient and note the remainder
10.
• Step 2: Divide the quotient 336 obtained from the previous step by 16 to get
21 as the next quotient and note the remainder 0.
• Step 3: Divide the quotient 21 by 16 to get 1 as the new quotient and note the
remainder 5.
• Step 4: Divide the quotient 1 by 16 to get 0 as the new quotient and note the
remainder 1. Since we get 0 as the quotient, we stop here.
• Step 5: Now, reverse the remainders and note the combined number that it
forms. We need to keep in mind that 10 is written as A in the hexadecimal
number system.
• Step 6: After writing the remainders in the reverse order we get, 150A.
Therefore, 5386 is expressed as 150A in the hexadecimal number system.
This can be written as (5386)10(5386)10 is equal to (150A)16(150�)16.
Convert Decimal to Hexadecimal With Decimal Point

In order to convert any fractional number to a hexadecimal number, we


convert the integer part in the usual way as shown above and we multiply
the fractional part (decimal part) by 16. Since the base of a hexadecimal
number is 16 we multiply the fractional part by 16 until it becomes 0. We
need to note down the integer part of these products after every step. The
obtained result is the hexadecimal number of the given fractional number.
Let us understand this with the help of an example.
Example: Convert the fractional decimal number 18.765625 into a
hexadecimal number.
Solution: We will solve the integer part and fractional part individually.
• Step 1: First let us work on the integer part. After we divide 18 by 16, we get
the quotient as, 18 ÷ 16 = 1 and the remainder as 2.
• Step 2: Now, when we divide 1 by 16, we get the quotient as, 16 ÷ 1 = 0, and
the remainder as 1.
• Step 3: Now, let us note the combined form of the remainders by reversing
them, which makes it 12. This will be written as the integer part of the
hexadecimal value.
• Step 4: After this step, we will work on the fractional part which is 0.765625
• Step 5: We need to multiply 0.765625 by 16 which will give 0.765625 × 16 =
12.25 in which we will note the integer part 12. This 12 is expressed as C in
the hexadecimal number system.
• Step 6: Now, we will multiply the fractional part of this product by 16 again.
After multiplying the fractional part 0.25 by 16 we get, 0.25 × 16 = 4
• Step 7: Now, after we combine the integer part and the fractional part of the
hexadecimal form we get, 12.C4. Therefore 18.765625 is equal to 12.C4 in the
hexadecimal number system. This means (18.765625)10(18.765625)10 is
equal to (12.C4)16(12.�4)16.

How to Convert Hexadecimal to Decimal?

The conversion of hexadecimal to decimal is done by using the base


number 16. The hexadecimal digit is expanded to multiply each digit with
the power of 16. The power starts at 0 from the right moving forward
towards the right with the increase in power. For the conversion to
complete, the multiplied numbers are added.
Deimal Number = dn-1 × 16r-1+....+ d2 × 162 + d1 × 161 + d0 × 160.
Where,
• n = number of digits.
• r = placement of the digit.

The steps to convert hexadecimal to decimal are:


• Obtain the decimal equivalent of hexadecimal from the conversion table.
(table mentioned above)
• Multiply each digit with the power of 16 starting at 0 from the right.
• Add all the numbers together.

Let us look at an example to understand this better.


For example: Convert hexadecimal number (25)16(25)16 to its decimal
form.
(25)16(25)16 = 2 × 161 + 5 × 160
= 2 × 16 + 5 × 1
= 32 + 5
= 37
Therefore, (25)16(25)16 = (37)10(37)10.
Hexadecimal to Decimal Formula

Hexadecimal to decimal formula conversion uses the following method:


• The base of the number to be converted here is 16.
• Multiply each digit of the given number, starting from the rightmost digit,
with the exponents of the base 16.
• The exponents should start with 0 and increase by 1 every time as we move
from right to left.
• We just simplify each of the products and add them.

The hex to decimal conversion formula is given as:


dn−1…d1d0(hex)=dn−1×16n−1+…+d1×161+d0×160(decimal)

Binary Addition
The binary number system uses only two digits 0 and 1 due to which
their addition is simple. There are four basic operations for binary
addition, as mentioned above.

0+0=0
0+1=1
1+0=1
1+1=10
The above first three equations are very identical to the binary digit
number. The column by column addition of binary is applied below in
details. Let us consider the addition of 11101 and 11011.

The above sum is carried out by following


step

1 + 1 = 10 = 0 with a carry of 1.

1+0+1 = 10 = 0 with a carry of 1

1+1+0 = 10 = 10 = 0 with a carry of 1

1+1+1= 10+1 = 11= 1 with a carry of 1

1 +1 +1 = 11

Note carefully that 10 + 1 = 11, which is equivalent to two + one =


three (the next binary number after 10)

Thus the required result is 111000.

Binary Subtraction
The subtraction of the binary digit depends on the four basic operations

0–0=0
1–0=1
1–1=0
10 – 1 = 1

The above first three operations are easy to understand as they are
identical to decimal subtraction. The fourth operation can be
understood with the logic two minus one is one.
For a binary number with two or more digits, the subtraction is carried
out column by column as in decimal subtraction. Also, sometimes one
has to borrow from the next higher column. Consider the following
example.

The above subtraction is carried out


through the following steps.

0–0=0

For 0 – 1 = 1, taking borrow 1 and then 10 – 1 = 1

For 1 – 0 , since 1 has already been given, it becomes 0 – 0 = 0

1–1=0

Therefore the result is 0010.


Types of Logic Gates

AND Gate

OR Gate

NOT Gate

NAND Gate
The NAND gate is a digital logic gate with ‘n’ i/ps and one o/p, that performs
the operation of the AND gate followed by the operation of the NOT
gate.NAND gate is designed by combining the AND and NOT gates. If the
input of the NAND gate high, then the output of the gate will be low.The
symbol and truth table of the NAND gate with two inputs is shown below.
NOR Gate
The NOR gate is a digital logic gate with n inputs and one output, that
performs the operation of the OR gate followed by the NOT gate. NOR gate
is designed by combining the OR and NOT gate. When any one of the i/ps
of the NOR gate is true, then the output of the NOR gate will be false. The
symbol and truth table of the NOR gate with the truth table is shown below.

Exclusive-OR Gate
The Exclusive-OR gate is a digital logic gate with two inputs and one output.
The short form of this gate is Ex-OR. It performs based on the operation of
the OR gate. . If any one of the inputs of this gate is high, then the output of
the EX-OR gate will be high. The symbol and truth table of the EX-OR are
shown below.

Exclusive-NOR Gate
The Exclusive-NOR gate is a digital logic gate with two inputs and one
output. The short form of this gate is Ex-NOR. It performs based on the
operation of the NOR gate. When both the inputs of this gate are high, then
the output of the EX-NOR gate will be high. But, if any one of the inputs is
high (but not both), then the output will be low. The symbol and truth table of
the EX-NOR are shown below.
The applications of logic gates are mainly determined based upon their truth
table, i.e., their mode of operations. The basic logic gates are used in many
circuits like a push-button lock, light-activated burglar alarm, safety
thermostat, an automatic watering system, etc.
Truth Table to Express Logic Gate Circuit
Gate circuit can be expressed using a common method is known as a truth
table. This table includes all the input logic state combinations either high
(1) or low (0) for every input terminal of the logic gate through the
equivalent output logic level like high or low. The NOT logic gate circuit is
shown above and its truth table is extremely easy indeed

The truth tables of logic gates are very complex but larger than the NOT
gate. The truth table of each gate must include many rows like there are
possibilities for exclusive combinations for inputs. For instance, for the NOT
gate, there are two possibilities of inputs either 0 or 1, whereas, for the two-
input logic gate, there are four possibilities like 00, 01, 10 & 11. Therefore,
it includes four rows for the equivalent truth table.

For a 3-input logic gate, there are 8 possible inputs like 000, 001, 010, 011,
100, 101, 110 & 111. Therefore, a truth table including 8 rows is required.
Mathematically, the required number of rows in the truth table is equivalent
to 2 increased to the power of the no. of i/p terminals.

Analysis
The voltage signals in the digital circuits are represented with binary values
like 0’s & 1’s calculated in reference to ground. The deficiency of voltage
mainly signifies a “0” whereas the existence of full DC supply voltage
signifies a “1”.

A logic gate is a special type of amplifier circuit that is mainly designed for
input as well as output logic level voltages. Logic gate circuits are most
frequently symbolized with a schematic diagram through their own
exclusive symbols Instead of their essential resistors and transistors.

Just like with Op-Amps (operational amplifiers), the connections of power


supply to logic gates are frequently misplaced in schematic diagrams for
the benefit of simplicity. It includes the probable input logic level
combinations through their particular output logic levels.
What is the Easiest Way to Learn Logic Gates?
The easiest way to learn the function of basic logic gates is explained
below.

• For AND Gate – If both the inputs are high then the output is also
high
• For OR Gate – If a minimum of one input is high then the output is
High
• For XOR Gate – If the minimum one input is high then only the
output is high
• NAND Gate – If the minimum one input is low then the output is
high
• NOR Gate – If both the inputs are low then the output is high.
De Morgan’s Theorem
The first theorem of DeMorgan states that the logic gate like NAND is equal
to an OR gate with a bubble. The logic function of the NAND gate is

A’B = A’+B’
The second theorem of DeMorgan states that the NOR logic gate is equal
to an AND gate with a bubble. The logic function of NOR gate is

(A+B)’= A’. B’
The Conversion of NAND Gate
The NAND gate can be formed using AND gate & NOT gate. The Boolean
expression & truth table is shown below.

Y= (A⋅ B)’
B Y′=A⋅ B
A Y
0 0 1
0
1 0 1
0
1 0 0
1
1 1 1
0
NOR Gate Conversion
The NOR gate can be formed using OR gate & NOT gate. The Boolean
expression & truth table is shown below.

Y = (A+B)’
B Y′ = A+B Y
A
0 0 1
0
0 1 1
0
1 0 1
0
1 1 1
0
Ex-OR Gate Conversion
The Ex-OR gate can be formed using NOT, AND & OR gate. The Boolean
expression & truth table is shown below. This logic gate can be defined as
the gate that gives high output once any input of this is high. If both the
inputs of this gate are high then the output will be low.
Y=A⊕B or A’B+AB’
A B
Y
0
0 0

0 1
1

1
1 0

0
1 1

Ex-NOR Gate Conversion


The Ex-NOR gate can be formed using EX-OR gate & NOT gate. The
Boolean expression & truth table is shown below. In this logic gate, when
the output is high “1” then both the inputs will be either “0” or “1”.

Y = (A’B + AB’)’
B
A Y
0
0 1

0
1 0

0
1 0

1
1 1

Basic Logic Gates using Universal Gates


Universal gates like NAND gate and NOR gate can be implemented
through any boolean expression without using any other type of logic gate.
And, they can also be used for designing any basic logic gate. Additionally,
these are extensively utilized in integrated circuits as they are simple as
well as cost-effective to make. The basic logic gates design using universal
gates are discussed below.

The basic logic gates can be designed with the help of universal gates. It
uses an error, a bit of test otherwise you can utilize Boolean logic for
attaining these through the logic gates equations for a NAND gate as well
as a NOR gate. Here, Boolean logic is used to solve the output you require.
It takes some time but it is needed to perform this to obtain a hang of
Boolean logic as well as basic logic gates.

Basic Logic Gates Using NAND Gate


The designing of basic logic gates using NAND gate is discussed below.

NOT Gate Design using NAND


The designing of the NOT gate is very simple by simply connecting both
the inputs as one.

AND Gate Design using NAND


The designing of AND gate using NAND gate can be done at the NAND
gate’s output to reverse it & obtain AND logic.

OR Gate Design using NAND


The designing of OR gate using NAND gate can be done by connecting
two NOT gates using NAND gates at the NAND’s inputs to obtain OR logic.

NOR Gate Design using NAND


The designing of NOR gate using NAND gate can be done by simply
connecting another NOT gate through NAND gate to the o/p of an OR gate
through NAND.

EXOR Gate Design using NAND


This one’s a bit tricky. You share the two inputs with three gates. The
output of the first NAND is the second input to the other two. Finally,
another NAND takes the outputs of these two NAND gates to give the final
output.

Basic Logic Gates using NOR Gate


The designing of basic logic gates using NOR gate is discussed below.

NOT Gate using NOR


The designing of NOT gate with NOR gate is simple by connecting both the
inputs as one.
OR Gate using NOR
The designing of OR Gate with NOR gate is simple by connecting at the
o/p of the NOR gate to reverse it & obtain OR logic.

AND Gate using NOR


The designing of AND gate using NOR gate can be done by connecting
two NOT with NOR gates at the NOR inputs to obtain AND logic.

NAND Gate using NOR


The designing of NAND Gate using NOR gate can be done by simply
connecting another NOT gate through NOR gate to the AND gate’s output
with NOR.

EX-NOR Gate using NOR


This type of connection is a bit difficult because the two inputs can be
shared with three logic gates. The first NOR gate output is the next input to
the remaining two gates. Finally, another NOR gate uses the two NOR gate
outputs to provide the last output.

Applications
The applications of basic logic gates are so many however they mostly
depend on their truth tables otherwise form of operations. Basic logic gates
are frequently used in circuits like a lock with push-button, the watering
system automatically, burglar alarm activated through light, safety
thermostat & other types of electronic devices.
The main advantage of basic logic gates is, these can be used in a different
combination circuit. In addition, there is no boundary to the number of logic
gates that can be utilized in a single electronic device. But, it can be limited
because of the specified physical gap within the device. In digital ICs
(integrated circuits) we will discover a collection of the logic gate region
unit.

By using mixtures of basic logic gates, advanced operations are often


performed. In theory, there’s no limit to the number of gates that may be clad
along during a single device. However, in the application, there’s a limit to
the number of gates that may be packed into a given physical area. Arrays
of the logic gate area unit are found in digital integrated circuits (ICs). As IC
technology advances, the desired physical volume for every individual gate
decreases, and digital devices of an equivalent or smaller size become
capable of acting with more complicated operations at ever-increasing
speeds.
Boolean Algebra
Boolean algebra is the category of algebra in which the variable’s values are the truth
values, true and false, ordinarily denoted 1 and 0 respectively. It is used to analyze and
simplify digital circuits or digital gates. It is also called Binary Algebra or logical
Algebra. It has been fundamental in the development of digital electronics and is provided
for in all modern programming languages. It is also used in set theory and statistics.
The important operations performed in Boolean algebra are – conjunction (∧), disjunction
(∨) and negation (¬). Hence, this algebra is far way different from elementary algebra where
the values of variables are numerical and arithmetic operations like addition, subtraction is
been performed on them.
Table of contents:

• Operations
• Terminologies
• Truth Table
• Rules
• Laws
• Theorems
• Example
• FAQs

Boolean Algebra Operations


The basic operations of Boolean algebra are as follows:

• Conjunction or AND operation


• Disjunction or OR operation
• Negation or Not operation

Below is the table defining the symbols for all three basic operations.
Operator Symbol Precedence

NOT ‘ (or) ¬ Highest

AND . (or) ∧ Middle

OR + (or) ∨ Lowest

Suppose A and B are two Boolean variables, then we can define the three operations as;

• A conjunction B or A AND B, satisfies A ∧ B = True, if A = B = True or else A ∧ B = False.


• A disjunction B or A OR B, satisfies A ∨ B = False, if A = B = False, else A ∨ B = True.
• Negation A or ¬A satisfies ¬A = False, if A = True and ¬A = True if A = False

Boolean Expression
A logical statement that results in a Boolean value, either be True or False, is a Boolean
expression. Sometimes, synonyms are used to express the statement such as ‘Yes’ for ‘True’
and ‘No’ for ‘False’. Also, 1 and 0 are used for digital circuits for True and False,
respectively.
Boolean expressions are the statements that use logical operators, i.e., AND, OR, XOR and
NOT. Thus, if we write X AND Y = True, then it is a Boolean expression.

Boolean Algebra Terminologies


Now, let us discuss the important terminologies covered in Boolean algebra.
Boolean Algebra: Boolean algebra is the branch of algebra that deals with logical operations
and binary variables.
Boolean Variables: A Boolean variable is defined as a variable or a symbol defined as a
variable or a symbol, generally an alphabet that represents the logical quantities such as 0 or
1.
Boolean Function: A Boolean function consists of binary variables, logical operators,
constants such as 0 and 1, equal to the operator, and the parenthesis symbols.
Literal: A literal may be a variable or a complement of a variable.
Complement: The complement is defined as the inverse of a variable, which is represented
by a bar over the variable.
Truth Table: The truth table is a table that gives all the possible values of logical variables
and the combination of the variables. It is possible to convert the Boolean equation into a
truth table. The number of rows in the truth table should be equal to 2n, where “n” is the
number of variables in the equation. For example, if a Boolean equation consists of 3
variables, then the number of rows in the truth table is 8. (i.e.,) 23 = 8.

Boolean Algebra Truth Table


Now, if we express the above operations in a truth table, we get;

A B A∧B A∨B

True True True True

True False False True

False True False True

False False False False

A ¬A

True False

False True

Boolean Algebra Rules


Following are the important rules used in Boolean algebra.

• Variable used can have only two values. Binary 1 for HIGH and Binary 0 for LOW.
• The complement of a variable is represented by an overbar.

�ℎ��, ���������� �� �������� � �� ����������


� �� �¯. �ℎ�� �� �=0 �ℎ�� �¯=1 ��� � =1 �ℎ�� �¯=0.

• OR-ing of the variables is represented by a plus (+) sign between them. For example, the OR-
ing of A, B, and C is represented as A + B + C.
• Logical AND-ing of the two or more variables is represented by writing a dot between them,
such as A.B.C. Sometimes, the dot may be omitted like ABC.
Laws of Boolean Algebra
There are six types of Boolean algebra laws. They are:

• Commutative law
• Associative law
• Distributive law
• AND law
• OR law
• Inversion law
Those six laws are explained in detail here.

Commutative Law
Any binary operation which satisfies the following expression is referred to as a commutative
operation. Commutative law states that changing the sequence of the variables does not have
any effect on the output of a logic circuit.

• A. B = B. A
• A+B=B+A

Associative Law
It states that the order in which the logic operations are performed is irrelevant as their effect
is the same.

• ( A. B ). C = A . ( B . C )
• ( A + B ) + C = A + ( B + C)

Distributive Law
Distributive law states the following conditions:

• A. ( B + C) = (A. B) + (A. C)
• A + (B. C) = (A + B) . ( A + C)

AND Law
These laws use the AND operation. Therefore they are called AND laws.

• A .0 = 0
• A.1=A
• A. A = A
• �.�¯=0

OR Law
These laws use the OR operation. Therefore they are called OR laws.
• A +0=A
• A+1=1
• A+A=A
• �+�¯=1

Inversion Law
In Boolean algebra, the inversion law states that double inversion of variable results in the
original variable itself.

• �¯¯=�

Boolean Algebra Theorems


The two important theorems which are extremely used in Boolean algebra are De Morgan’s
First law and De Morgan’s second law. These two theorems are used to change the Boolean
expression. This theorem basically helps to reduce the given Boolean expression in the
simplified form. These two De Morgan’s laws are used to change the expression from one
form to another form. Now, let us discuss these two theorems in detail.
De Morgan’s First Law:
De Morgan’s First Law states that (A.B)’ = A’+B’.
The first law states that the complement of the product of the variables is equal to the sum of
their individual complements of a variable.
The truth table that shows the verification of De Morgan’s First law is given as follows:

A B A’ B’ (A.B)’ A’+B’

0 0 1 1 1 1

0 1 1 0 1 1

1 0 0 1 1 1

1 1 0 0 0 0

The last two columns show that (A.B)’ = A’+B’.


Hence, De Morgan’s First Law is proved.
De Morgan’s Second Law:
De Morgan’s Second law states that (A+B)’ = A’. B’.
The second law states that the complement of the sum of variables is equal to the product of
their individual complements of a variable.
The following truth table shows the proof for De Morgan’s second law.

A B A’ B’ (A+B)’ A’. B’

0 0 1 1 1 1

0 1 1 0 0 0

1 0 0 1 0 0

1 1 0 0 0 0

The last two columns show that (A+B)’ = A’. B’.


Hence, De Morgan’s second law is proved.
The other theorems in Boolean algebra are complementary theorem, duality theorem,
transposition theorem, redundancy theorem and so on. All these theorems are used to
simplify the given Boolean expression. The reduced Boolean expression should be equivalent
to the given Boolean expression.
Single-stage Transistor Amplifier
When only one transistor with associated circuitry is used for amplifying a weak signal, the circuit is
known as single-stage amplifier.

Analyzing the working of a Single-stage amplifier circuit, makes us easy to understand the formation
and working of Multi-stage amplifier circuits. A Single stage transistor amplifier has one transistor,
bias circuit and other auxiliary components. The following circuit diagram shows how a single stage
transistor amplifier looks like.

Single Stage
When a weak input signal is given to the base of the transistor as shown in the figure, a small amount
of base current flows. Due to the transistor action, a larger current flows in the collector of the
transistor. (As the collector current is β times of the base current which means IC = βIB). Now, as the
collector current increases, the voltage drop across the resistor RC also increases, which is collected
as the output.

Hence a small input at the base gets amplified as the signal of larger magnitude and strength at the
collector output. Hence this transistor acts as an amplifier.

Practical Circuit of a Transistor Amplifier


The circuit of a practical transistor amplifier is as shown below, which represents a voltage divider
biasing circuit.

Practical Circuit
The various prominent circuit elements and their functions are as described below.

Biasing Circuit
The resistors R1, R2 and RE form the biasing and stabilization circuit, which helps in establishing a
proper operating point.

Input Capacitor Cin


This capacitor couples the input signal to the base of the transistor. The input capacitor Cin allows AC
signal, but isolates the signal source from R2. If this capacitor is not present, the input signal gets
directly applied, which changes the bias at R2.

Coupling Capacitor CC
This capacitor is present at the end of one stage and connects it to the other stage. As it couples two
stages it is called as coupling capacitor. This capacitor blocks DC of one stage to enter the other but
allows AC to pass. Hence it is also called as blocking capacitor.

Due to the presence of coupling capacitor CC, the output across the resistor RL is free from the
collector’s DC voltage. If this is not present, the bias conditions of the next stage will be drastically
changed due to the shunting effect of RC, as it would come in parallel to R2 of the next stage.

Emitter by-pass capacitor CE


This capacitor is employed in parallel to the emitter resistor RE. The amplified AC signal is by passed
through this. If this is not present, that signal will pass through RE which produces a voltage drop
across RE that will feedback the input signal reducing the output voltage.

The Load resistor RL


The resistance RL connected at the output is known as Load resistor. When a number of stages are
used, then RL represents the input resistance of the next stage.

Various Circuit currents


Let us go through various circuit currents in the complete amplifier circuit. These are already
mentioned in the above figure.

Base Current
When no signal is applied in the base circuit, DC base current IB flows due to biasing circuit. When
AC signal is applied, AC base current ib also flows. Therefore, with the application of signal, total
base current iB is given by

iB=IB+ib
Collector Current
When no signal is applied, a DC collector current IC flows due to biasing circuit. When AC signal is
applied, AC collector current ic also flows. Therefore, the total collector current iC is given by

iC=IC+ic
Where

IC=βIB
= zero signal collecor current
ic=βib
= collecor current due to signal

Emitter Current
When no signal is applied, a DC emitter current IE flows. With the application of signal, total emitter
current iE is given by

iE=IE+ie
It should be remembered that

IE=IB+IC
ie=ib+ic
As base current is usually small, it is to be noted that

IE≅IC
and ie≅ic

What is an LED Driver


An LED driver is an electronic circuit specially designed to drive or illuminate a
set of LEDs safely through controlled current and voltage output, as per the
specifications of the LEDs.

Since LEDs are vulnerable semiconductors devices, they must be driven using a
regulated current and voltage power supply. Thus, we can also say that LED
drivers are basically power supplies, specially designed to operate or illuminate
LEDs through controlled parameters, so that the LEDs illuminate optimally
without the risk of an over voltage or an over current.

This implies that an LED driver must feature a constant voltage and a constant
current, ensuring that the LEDs are never subjected to abnormal voltage or
current conditions, and they never burn or deteriorate overtime.

The biggest enemy of LED is overheating, which can cause a thermal runaway
situation in LEDs. Overheating may be caused due to over current or over
voltage, and this is exactly why these two parameters must be strictly regulated
in any given LED driver circuit.

LED Parameters
Before we start learning LED driver circuits, it would be important to understand
a few of the LED specifications which are crucial to designing drivers for them.
These are, LED forward voltage rating or the VF rating, and LED forward current
rating or the IF rating.

LED Forward Voltage Rating (VF): It is basically an optimal voltage rating of the
LED which is supposed to be supplied by the driver or the power supply to
illuminate the LED with optimal brightness. This voltage must never be
increased to ensure proper safety to the LED.

LED Forward Current Rating (IF): It is the maximum operating current of the LED,
exceeding which can cause a deterioration or even permanent damage to the
LED.

For example a standard 1 watt LED has a forward voltage rating of 3.3 V, and a
forward current of 0.303 Ampere. Exceeding the forward voltage of 3.3 V can
cause an increase in the current consumption exceeding its maximum tolerable
IF rating of 0.303 amps. This may result in overheating of the LED so that it
ultimately burns and gets permanently damaged.

The forward current can be calculated by dividing the LED wattage by its
forward voltage. For the above example, this is IF = 1 / 3.3 = 0.303 Amps

While designing an LED driver it must be ensured that it provides the LEDs with
the correct amount of VF and the IF parameters, so that that the LEDs are able to
illuminate optimally without any risks of damage.

Now we will see how the VF and IF parameters, as explained above, can be
correctly implemented using the right LED configuration and by calculating the
LED resistor correctly.

LED Configuration
While designing LED drivers the LED configuration must be correctly matched
with the voltage output of the driver, such that the driver voltage is equal to the
forward voltage spec of the LED configuration.
This ensures that the correct amount of forward current passes through the
LEDs. However it is always not possible to match the driver output with the
available LED configuration.

In case the driver output does not exactly match with the forward voltage spec
of the LED then we use series current limiting resistor to adjust the voltage and
current of the driver with the LED.

Example#1
For example, let's say, the output voltage of the driver is 12 V DC (with 1 Amp
current), and we want to connect a 3 watt LED with this DC output. Assume we
have 3nos of 1 watt LEDs with forward voltage specification of 3.3 V each.

We want the forward voltage of the LEDs to match as closely as possible with
the 12 V spec of the driver.

Therefore we add the 3 LEDs in series, so that the total forward voltage of the
LED string becomes 3.3 + 3.3 + 3.3 = 9.9 V. This is close to 12 V but still not
precisely equal.

If we connect this 3 LED string directly with the 12 V supply of the driver, that
would cause each LED to be subjected to a forward voltage of 12 / 3 = 4 V. This
looks too high for each of the LEDs, and this would instantly burn the entire 3
LED string.
To prevent the above issue, and to ensure that the 3 LED string works correctly
with the 12 V from the driver, we add a series resistor with the LED string. The
resistor value is calculated by considering the total forward voltage of the LED
string, the maximum current spec of the LED string, and the supply input voltage
from the driver.

R = Supply Voltage - Total LED forward Voltage / LED Current.

R = 12 - 9.9 / 0.303 (All the 3 LEDs will have 0.303 amp current since they are
connected in series.)

R = 6.93 Ohms or 7 Ohms.

Therefore, we would need a 7 Ohm series resistor to ensure that 12 V can be


safely used with the 3 LED string.

The wattage of the resistor can be calculated using the formula:

W = (Supply Voltage - Total LED forward Voltage) x LED Current.

W = (12 - 9.9) x 0.303 = 0.63 watts, or simply a 1 watt will do.

Example#2
Let's consider another scenario where we want to configure a 6 watt LED to a 12
V, 1 Amp driver output. Assuming we have 6 nos of 1 watt LEDs, we want to
make sure that the total forward voltage of the LEDs is as close as possible to
the 12 V DC output.
Just as the previous example, putting 3 LEDs in series provides a total forward
voltage of 3.3 + 3.3 + 3.3 = 9.9 V. Since we have 6 LEDs, means we have to create
two such strings having 3 series LEDs on each string.

Once the two strings are created, the next step is to calculate the current
limiting resistor for the two LED strings. As calculated in the previous example,
we have to connect a 7 ohm 1 watt resistor in series with each of the two LED
strings, and then simply join the two LED strings in parallel.

This parallel combination then finally could be attached to the 12 V supply for
getting a matching configuration with the supply.

Example#3
In the above two examples the calculations were pretty easy since the LED
numbers were even. Now let's consider an LED combination which is not even.

Let's imagine we want to connect a 7 watt LED to the driver's 12 V supply.

Let's assume we have 7 nos of 1 watt LEDs for the 7 watt LED configuration.

We implement the same procedures as above.

We first create two strings of LEDs having 3nos of 1 watt LEDs each, along with
a 7 ohm 1 watt series resistor on the each of the strings.

We connect the above two strings in parallel, as before.


For the above configuration we use 6 LEDs , and find that we have still have one
LED left with us, which also needs to be included in the design.

We have no other option but to connect this single LED parallel to the two
strings.

However, this single LED will also need a resistor so that its 3.3 V forward
voltage could be matched with the 12 V supply.

We use the same formula as above to calculate the limiting resistor for this
single LED string:

R = Supply Voltage - Total LED forward Voltage / LED Current.

R = 12 - 3.3 / 0.303 = 28 .71 Ohms, or simply a 30 Ohm will do.

Wattage = 12 - 3.3 x 0.303 = 2.63 watts or simply a 3 watt will do.

Using the above methods, it is possible to configure any number of LEDs in


series/parallel combination to suit any specific power supply output.
Now coming back to our LED driver subject, in this post we will discuss two
simple methods of designing LED drivers, 1) SMPS method, 2) capacitive power
supply method.

Warning: Circuits explained below are not isolated from mains AC, and therefore
are extremely dangerous to touch in the powered and open condition. You
should be extremely careful while building and testing these circuits, and make
sure to take the necessary safety precautions. The author cannot be held
responsible for any mishap due to any negligence by the user.

SMPS LED Drivers


SMPS LED drivers are built using SMPS technology or switch mode power supply
technology, which are by far the most efficient type of power supplies due to
their low dissipation and reduced wastage of power.

However, designing SMPS power supplies is not easy and requires a lot of
calculations, so new hobbyists can find this aspect of an SMPS undesirable, and
inefficient.

Therefore it may seem that designing SMPS LED drivers can be indeed a
complex affair, and most electronic enthusiasts or professionals may find this
not so preferable.

That said, there is an easy workaround through which cheap and quick SMPS
LED drivers could be created.

It is by procuring ready-made, cheap SMPS power supplies from the market, and
then configuring an LED stage at its output, through a current control circuit.

A cheap 12 V 1 amp SMPS board example can be seen in the following image:
These modules will produce 12 V DC 1 amp output, with a capacity of 12 watts.
We can easily attach appropriately configured LEDs strings at the output through
a current controller stage for converting these SMPS boards into easy and safe
LED drivers.

IR Transmitter and IR Receiver are commonly used to control


electronic devices wirelessly, mainly through a remote. TV remotes and AC
remotes are the best example of IR transmitters. TV generally consists of
TSOP1738 as the IR receiver, which senses modulated IR pulses and convert
them into electrical signal. Here in our circuit we are building IR remote and its
receiver. We are using IR LED as transmitter and TSOP1738 as IR receiver.

How does IR LED Work?


IR LED emits infrared light, means it emits light in the range of Infrared
frequency. We cannot see Infrared light through our eyes, they are invisible to
human eyes. The wavelength of Infrared (700nm – 1mm) is just beyond the
normal visible light. Everything which produce heat, emits infrared like our
human body. Infrared have the same properties as visible light, like it can be
focused, reflected and polarised like visible light.

Other than emitting invisible infrared light, IR LED looks like a normal LED and
also operates like a normal LED, means it consumes 20mA current and 3vots
power. IR LEDs have light-emitting angle of approx. 20-60 degree and range of
approx. few centimetres to several feets, it depends upon the type of IR
transmitter and the manufacturer. Some transmitters have a range in kilometers.
IR Receiver (TSOP17XX)
TSOP17XX receives the modulated Infrared waves and changes its output.
TSOP is available in many frequency ranges like TSOP1730, TSOP1738,
TSOP1740 etc. Last two digits represent the frequency (in Khz) of modulated IR
rays, on which TSOP responds. Like for example TSOP1738 reacts when it
receives the IR radiation modulated at 38Khz. Means it detects the IR which is
switching On and Off at the rate of 38Khz. TSOP’s output is active low, means
its output is remains HIGH when there is no IR, and becomes low when it detects
IR radiation. TSOP operates on particular frequency so that other IRs in the
environment can’t interfere, except the modulated IR of particular frequency. It
has three pins, Ground, Vs (power), and OUTPUT PIN.

IR Transmitter Circuit Diagram


We are using TSOP1738 as IR receiver, so we need to generate the modulated
IR of 38 kHz. You can use any TSOP, but you need to generate IR of respective
frequency as TSOP. So we are using 555 timer in Astable mode to oscillate the
IR at 38KHz frequency. As we know oscillation frequency of 555 timer is
decided by resistor R1, R2 and capacitor C1. As you can see in the blow IR
Transmitter Circuit We have used 1k R1, 20K R2 and 1nF capacitor to generate
the frequency of approx. 38 KHz. It can be calculated using this formula:
1.44/((R1+2*R2)*C1).
Output Pin 3 of the 555 Timer IC has been connected to IR LED using 470
resistor and a push button switch. Whenever we press the button, circuit emits
modulated IR at 38 KHz. A 100uF capacitor is connected across the supply to
provide the constant supply to the circuit, without any ripple.

IR Receiver Circuit Diagram


IR Receiver circuit is very simple we just need to connect a LED to the output of
the TSOP1738, to test the receiver. We have use BC557 PNP transistor here,
to reverse the effect of TSOP, means whenever the output is HIGH LED will be
OFF and whenever it detects IR and output is low, LED will be ON. PNP
transistor behaves opposite to the NPN transistor, it acts as open switch when
a voltage applied to its base and acts as closed switch when there is no voltage
at its base. So normally TSOP output remains HIGH and Transistor behaves as
open switch and LED will be OFF. As soon as TSOP detects Infrared, its output
becomes low and transistor behaves as closed switch and LED will be ON. As
you can see in the below IR receiver circuit A 10k resistor is used for provide
proper biasing to transistor and a 470ohm resistor is used at LED for limiting the
current. So whenever we press the Button at IR transmitter, it is detected by
TSOP1738 and LED will glow.
We have further modified this circuit by using a relay to operate the AC mains
appliances by an IR remote, in this remote controlled switch circuit. Check out
our electronic circuits section to learn and build more interesting circuits and
simple projects.

LDR Circuit Diagram

November 1, 2013 By Øyvind Nydal Dahl 309 Comments


This LDR circuit diagram shows how you can make a light
detector. An LDR or “Light Dependent Resistor” is a resistor
where the resistance decreases with the strength of the
light.

Here is the schematic for the circuit:

Light Dependent Resistors

Light Dependent Resistors (LDR) are also called


photoresistors. They are made of high resistance
semiconductor material. When light hits the device, the
photons give electrons energy. This makes them jump into
the conductive band and thereby conduct electricity.
Check out Wikipedia for the physics stuff ;)

How The LDR Circuit Diagram Works

The LDR circuit diagram works like this:

When it’s dark, the LDR has high resistance. This makes the
voltage at the base of the transistor too low to turn the
transistor ON.

Therefore, no current will go from the collector to the emitter


of the transistor. All the current will instead pass through
the LDR and the potentiometer.
When it’s light, the LDR has low resistance. This makes the
voltage at the base of the transistor higher. High enough to
turn the transistor ON.

Because the transistor is turned on, current flows through


the transistor. It flows from the positive battery terminal,
through R1, the LED, and the transistor down to the negative
battery terminal.

This makes the LED light up.

The Components Used In The Light Detector


Circuit

The resistor R1 controls the amount of current going through


the LED. It’s simple to calculate. I have written an article
on how to calculate the resistor value for an LED.

If you are using an LED with 2V voltage drop, you will have a
7V voltage drop over the resistor when the transistor is ON.
By using Ohm’s law we can find the current:

And 18 mA is usually a good current value for common


LEDs.

What if you want to power the circuit with something other


than a 9V battery? Then you need to change the resistor
value to get the right amount of current flowing through the
LED.

The variable resistor R2 is used to change the trigger point


for the LED. That is, how much light that is needed for the
LED to turn ON and OFF.

You can probably get away with a 10k potentiometer. It


depends on the resistance of your LDR. But with a 100k
potentiometer you will have room for a wider range of LDR
values.

Making The LED Turn ON When it’s Dark

You can also make the LED turn ON when it is dark instead
of when it is light. To do this, replace the NPN transistor with
a PNP transistor like this:
What is the Relay Drive?

Briefly, a relay is a switch with an electric operation. A relay driver circuit is a circuit
type that runs a relay, therefore, contributing to an appropriate circuit function. In
turn, the relay switch opens or closes, as per the circuit requirement and functioning.
Example of a relay driver circuit

Source: Wikimedia

How does DRIVE work?

Working principle

Let us go through the points below to understand the working principle of a relay
drive.

• A relay structure comprises a spring-loaded contact and coil that move undisturbed
across a pivoted axis.
• The central pole ensures that as the relay coil receives voltage, it joins the N/C
contact (Normally Closed). The connection happens because the relay coil has an
electromagnetic pull that attracts the pole iron.
• Later, when you switch OFF the relay coil, the central pole disconnects from the
Normally Open (N/O) terminal. It then joins the N/C switch contact terminal hence
being in a default contact position.
Generally, the switch OFF and switch ON operations in a relay drive alternately
switches N/C to N/O. And it majorly depends on the state of the relay coil.
Circuit diagram of a functional drive

Design the Calculation Formula for Relay


Driver Circuit

The expression below gives the formula for calculating a transistor’s base resistor.
R = (Us – 0.6) hFE/Relay coil current

Whereby;

R is transistor’s base resistor,

Us is trigger voltage/source to the base resistor, and

have is forward current gain.

Use another Ohm’s law formula to get the relay current: I = Us/R. Here;

I = required relay current

Us = supply voltage

How to Build a Relay Driver Circuit

A few points to note on the relay drive circuitry are;

• Use 2N4401 for low-power relays.


• Then, a Darlington driver is an ideal choice for less base current or high-power
relays.
• In addition, ULN2003 suits several relays or loads to drive.
• Lastly, enhancement mode MOSFET fits the relay driving by a CMOS logic.

A power MOSFET
Source: Wikiwand

Pin arrangement of a relay drive

The pin configuration of relay driver circuits depends on the manufacturer. Therefore,
it is advisable to check the datasheet for accurate information.

But generally, most have the arrangement below;

NO = When the relay coil gets energized, it connects to the common terminal and
remains open throughout.

NC = When the relay coil gets de-energized, it comes in contact with a common
terminal. It’s also always connected.

The third contact pinout is the central pole.

An AC Relay Driver Circuit

A relay driver circuit runs on AC power. For that reason, we’ll only need a transient
suppressor and sufficient AC voltage as rated for the relay.

And instead of diodes in eliminating voltage spikes, we’ll use them to alternate half-
cycles. Also, we won’t connect diodes in reverse parallel to create a
functional transient voltage suppressor. Instead, we’ll use an RC series network and
secure it parallel across the coil. Moreover, the resistors regulate the discharge as
the capacitor absorbs excess charge.

Components needed for preparation

• 0.05µF capacitor
• AC voltage source
• AC relay
• 100Ω resistor
Precaution; Handle with great care the AC power that comes directly from a wall
outlet to prevent shock.

Circuit Diagram

The diagram below is the final product we’ll have after our AC relay driver circuit
assembly.
Circuit diagram of an AC relay driver circuit

We only feed the AC relay with an AC voltage of its rating. For example, for a rated
relay voltage of 110VAC, we’ll need 110V from the AC power source.

The resistor and capacitor in series suppress voltage spikes by acting as the
transient voltage suppressors. Therefore, that side of the circuit operates as our
relay driver. Finally, when the relay receives enough power, it turns on then powers
the load it’s in connection with instantaneously.

A DC relay driver circuit

You’ll use components like the Zener diode for DC relay circuits to eliminate voltage
spikes as the drive closes/opens. In other words, the diode acts as a transient
voltage suppressor. The relay coils function as inductors.

Component to prepare

• Zener diode
• DC voltage source/ DC power source such as wall-wart power and batteries.

A Wall-wart adapter
Source: Wikipedia

• DC relay with its rated DC voltage value.

Circuit diagram

Circuit diagram of a DC relay driver circuit

The relay we’re using today has a 9V rating. Therefore, a 9-volt DC voltage source is
suitable for feeding the resistor. We also place a reverse-biased Zener diode in
parallel to our drive. In that way, once the voltage reaches a specific threshold, the
circuit will shunt excess power to the ground. Contrarily, if it gets to the breakdown
voltage, it will permit electric flow by conducting.

Ultimately, when there’s sufficient power, the relay closes and drives the output
loads.

Using NPN transistor to build a relay switch circuit

Electronic projects on relay driver circuits often use MOSFETs and NPN
transistors as their primary switching devices. It’s because transistors can swiftly
provide DC switching (OFF/ON) control of relay coils from several input sources.
Components needed

• Resistor – 1K
• Capacitor – 470µF
• NPN transistor – BC 548
• LED indicators
• IN4007 diode

Circuit diagram

A relay circuit diagram with an NPN transistor

Advantages and Applications of Relay Drive

The pros of a relay drive include;

• First, it uses inexpensive NPN drive transistors that are also commonly available.
• It has fewer components.
• Further, you can easily interface it to a low voltage logic circuitry and a relay
economy feature.
• Also, its manufacture has an industry-standard technique.
• In addition, it has several interface options, such as the ULN2003 driver.
• Lastly, you can source the relay power by a higher, unregulated voltage. In that way,
there’s load reduction on the voltage regulator.
Applications include:

• Heaters,
• Motors, and
• Lamps.

Conclusion

All in all, relay driver circuits help in switching connected loads in electronic systems
with ease. YoYou’llostly applies the drive when you need to control several courses
by a single signal. Also, you can use a relay to regulate one circuit by one low-power
signal. Hence, knowing how to make the relay circuit on your own can be lifesaving
for your operations. The examples we’ve given should broadly help you.

How to Build an Adjustable Square Wave Generator


Circuit with a 555 Timer

In this project, we will show how to build a square wave generator circuit that allows for adjustable
frequency and amplitude of the output square wave signal.
This square wave generator circuit can be built simply a 555 timer chip and a few resistors,
capacitors, and potentiometers.

The circuit is very basic. It simply uses one chip, a 555 timer.

A 555 timer is a very versatile chip. It can easily create square waves when in astable mode of
operation. This circuit utilizes that principle, that 555 timers can easily generate square wave signals.

The potentiometers allow us to vary the frequency of the output signal as well as the amplitude.

This circuit can function well simply if you need square waves or if you need to use it for an IC that
requires clock pulses.

So below we'll explain in detail how to build this circuit as well as how it operates.

Components Needed

• 555 Timer Chip


• 200Ω potentiometer
• 1MΩ potentiometer
• 39KΩ resistor
• 1nF ceramic capacitor
• 100nF ceramic capacitor

The 555 timer can be obtained very cheaply from pretty much any electronic retailer.

The 555 timer can be obtained very cheaply from pretty much any electronic retailer.

The 555 timer is an 8-pin chip.

The pinout of the 555 timer is shown below.

The 555 timer requires a power supply voltage of 4.5-16V. We connect this voltage to the VCC pin, pin
8, and we connect GND, pin 1, to ground.
The only other pins we use are the trigger pin, the output pin, the reset pin, and the threshold pin.
Pin 2 is the trigger pin. It works like a starter pistol to start the 555 timer running. The trigger is an
active low trigger, which means that the timer starts when voltage on pin 2 drops to below 1/3 of the
supply voltage. When the 555 is triggered via pin 2, the ouptut on pin 3 goes high.

Pin 3 is the output pin. 555 timer's output is digital in nature. It is either high or low. The output is
either low, which is very close to 0V, or high, which is close to the supply voltage that's placed on pin
8. The output pin is where you would connect the load that you want the 555 timer to power. This may
be an LED, for instance.

Pin 4 is the reset pin. This pin can be used to restart the 555 timer's timing operation. This is an active
low input, just like the trigger input. Thus, pin 4 must be connected to the supply voltage of the 555
timer to operate. If it is momentarily grounded, the 555 timer's operation is interrupted and won't start
again until it's triggered again via pin 2.

Pin 6 is the threshold pin. The purpose of this pin is to monitor the voltage across the capacitor that's
discharged by pin 7. When this voltage reaches 2/3 of the supply voltage (V CC), the timing cycle ends,
and the output on pin 3 goes low.

Adjustable Square Wave Generator Circuit Built with a 555 Timer


The adjustable square wave generator circuit we will build with a 555 timer chip is shown below.
The breadboard circuit of the circuit above is shown below.

So this is our adjustable square wave generator circuit shown above.

So the first thing of concern for this circuit is power- what power the circuit will run off from.

Being that we are using a 555 timer chip, the maximum voltage that a 555 timer can withstand is 18V.
Therefore, we use 18V for the supply DC voltage for this circuit. By attaching a potentiometer to the
18V, we create an adjustable power source, so that we can alter the amplitude of the output signal. If
the potentiometer is turned so that it is offering full resistance, the voltage fed to the 555 timer is about
18V. This gives the maximum amplitude that the output signal can be. If we lower the resistance of
the potentiometer, the voltage fed to the 555 timer decreases. This decreases the amplitude of the
output signal.

For this circuit, we use a 200Ω potentiometer to allow for amplitude adjustment. You don't want to use
a smaller potentiometer than this such a00s a 100Ω potentiometer, because most aren't rated to
handle the amount of current that using a potentiometer this low will be. For example, with a 100Ω
potentiometer, current will be 18V/100Ω= 180mA. Many potentiometers can't handle such high current
and will burn out. 200Ω is a much safer bet lowering the current to 90mA (18V/200Ω). You can only
use a 500Ω potentiometer. But it's best not to go higher than 500Ω. If you use a very large
potentiometer value, amplitude adjustment will not work properly. Using low-ohm potentiometers
allows for small changes to resistances, so that the amplitude changes slowly. Using large-ohm
resistors causes abrupt changes to the amplitude, not giving good amplitude adjustment. If you use a
100KΩ potentiometer, for instance, slightly adjusting the potentiometer leads to abrupt changes in
amplitude, which makes for poor amplitude adjustment.

This voltage is fed into the V+ pin of the 555 timer, which is pin 8.
So again, if the potentiometer is offering full resistance, the amplitude is at its maximum amplitude. As
we lower the resistance of the potentiometer, the amplitude decreases and decreases until the
voltage feeding into pin 8 is so low, that no signal is output.

18V is, fed into pin 4 of the 555 timer. Pin 4 is the reset pin of the 555 timer. This pin is active low,
which means it is triggered when fed a voltage near ground or 0V. Therefore, this pin must remain
connected to a positive voltage source in order for the circuit to work.

So, this fulfills the power for the circuit.

Now we get more into the other facets of the circuit.

Besides the amplitude, which we have covered, we now get into the frequency aspect of the circuit,
how the frequency of the signal. And the frequency of the output is determined by the potentiometer
R1 and capacitor C1. These form an RC network that determine the frequency of the output signal.
The product of RC is equal to the time period of the output signal. By decreasing the value of the
resistor, we decrease the time period, which creates a signal with a higher frequency. By increasing
the value of the resistor, we increase the time period, which creates a signal with a lower frequency.
The potentiometer allows us to change the frequency by changing the value of the RC network.

The value of the capacitor C1 that we have chosen is 1nF. If you want even a greater frequency that
can go lower, you cna choose a lower value capacitor such as in the picofarads range. This extends
the frequency range of the circuit, at the high end. The smaller of a capacitor you use, the higher the
frequency. For example, a 330pF capacitor causes even a faster frequency.

The potentiometer value that we use for the RC network is a 1MΩ potentiometer. You can also use a
10MΩ potentiometer if you want to extend the frequency range of the circuit, at the low end. The
greater of a resistance value you use, the lower frequency can extend. For example, with a 10MΩ
potentiometer, the frequency will be just a few hertz on the lower end of the frequency range when the
potentiometer is offering its full resistance.

The 555 timer is a very good chip that is able to produce and output very good, high-quality square
wave signals. And depending on the values you use, you should be able to get any square wave of
any frequency you desire. The 555 timer chip does have a ceiling of frequency but it is several
megahertz. So until you exceed this, the circuit should be able to do what you want it to accomplish.

So this is an adjustable square wave generator circuit.

You might also like