Professional Documents
Culture Documents
P AGRAWAL
Dedicated to Mata Saraswati
3 G.P AGRAWAL
CONTENTS
TOPIC PAGE NO
Basics of Electronics Components and its Types 08
Logic Gates 11
Bread Board 13
Resistor,Colour coding,Types,potentiometer 14
LDR 19
Capacitor ,Types,Symbols 20
4
RELAYS, DIODE, Types ,Zener Diode and characteristics 25
basic concepts of
ELECTRONICS
7 G.P AGRAWAL 1
BASICS
ELECTRONIC COMPONENTS
8 G.P AGRAWAL
Digital System
Logic high = 1
Logic low = 0
Dec 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
Bin 00 00 00 00 01 01 01 01 10 10 10 10 11 11 11 1111
00 01 10 11 00 01 10 11 00 01 10 11 00 01 10
Hex 0 1 2 3 4 5 6 7 8 9 A B C D E F
9 G.P AGRAWAL
Types of Digital circuit
CLOCK
10 G.P AGRAWAL
LOGIC GATES
11 G.P AGRAWAL
12
G.P AGRAWAL
PRACTICAL CIRCUIT ELEMENTS
BREAD BOARD
13 G.P AGRAWAL
RESISTOR
Resistor is introduced in an electronic circuit to oppose the flow of current.
Types of resistors:
1.Carbon composited Resistor: It consists of finely ground carbon ,region binder
and compressed shape of resistor.The end connection is obtained by
soldering tinned metal copper wire.
2.Metal Film Resistor: It is obtained by putting a film of Nickel or Chromium on high
grade ceramic rod.
3.Carbon Film Resistor: A film of resistive material is depodited on insulating core.
4.Wire wound Resistor: The resistance wire is wound over insulating base and
assembly is covered in a protective insulating material.
14 G.P AGRAWAL
15
G.P AGRAWAL
16
G.P AGRAWAL
Resistor Symbol
Fixed Resistor Potentiometer Thermistor
___/\/\/\/\/\/\____ ___/\/\/\/\/\/\____ ____/\/\/\/\/\/\___
T
Potentiometer (POT):
17
G.P AGRAWAL
18 G.P AGRAWAL
LDR(Light Dependent Resistor)
19 G.P AGRAWAL
CAPACITORS(CONDENSERS)
20 G.P AGRAWAL
21 G.P AGRAWAL
Tantalum Capacitors
22 G.P AGRAWAL
Variable Capacitors
The variable capacitor has a stator and rotor and turning the the rotor from 0
degree to 180 degree varies the amount of plate surface exposed.
23
G.P AGRAWAL
Switches
24 G.P AGRAWAL
Relays
25 G.P AGRAWAL
DIODE
26 G.P AGRAWAL
27 G.P AGRAWAL
Diode as a Rectifier
ZENER DIODES
28 G.P AGRAWAL
29 G.P AGRAWAL
Characteristics of Diode
30 G.P AGRAWAL
LED
31 G.P AGRAWAL
32 G.P AGRAWAL
LED MATRIX
33 G.P AGRAWAL
SEVEN SEGMENT DISPLAY
34 G.P AGRAWAL
35 G.P AGRAWAL
Bipolar Junction Transistor(BJT)
Introduction to Transistors
36 G.P AGRAWAL
BJT STRUCTURE
37 G.P AGRAWAL
38 G.P AGRAWAL
39 G.P AGRAWAL
40 G.P AGRAWAL
41 G.P AGRAWAL
Electrons enter the emitter from the battery and
come out of the collector. A transistor can act as a
switch. A small voltage applied to the base will
switch the transistor on allowing the current to flow
in the rest of the transistor.
44 G.P AGRAWAL
SMALL SIGNAL TRANSISTORS
POWER TRANSISTORS
45 G.P AGRAWAL
Loudspeaker and Microphone
Types of Loudspeaker
46 G.P AGRAWAL
47 G.P AGRAWAL
GENERAL SPECIFICATIONS
Speaker or driver type (individual units only) Full-range, woofer,
tweeter, or mid-range.
Size of individual drivers. For cone drivers, the quoted size is generally
the outside diameter of the basket.
Rated Power Nominal (or even continuous) power, and peak (or
maximum short-term) power a loudspeaker can handle (i.e., maximum
input power before destroying the loudspeaker; it is never the sound
output the loudspeaker produces). A driver may be damaged at much
less than its rated power if driven past its mechanical limits at lower
frequencies. Tweeters can also be damaged by amplifier clipping
(amplifier circuits produce large amounts of energy at high frequencies
in such cases) or by music or sine wave input at high frequencies.
Impedance typically 4 (ohms), 8 , etc.
Baffle or enclosure type (enclosed systems only) Sealed, bass
reflex, etc.
Number of drivers (complete speaker systems only) two-way, threeway,
etc.
48 G.P AGRAWAL
Microphone
Microphone is a device which converts the variations of sound pressure in a sound wave
into corresponding electrical variation in an electrical circuit.
Types of Microphones
oCondenser microphone
oDynamic microphone
oCarbon microphone
oRibbon Microphone
oPiezoelectric microphone
oFibre optic microphone
49 G.P AGRAWAL
50 G.P AGRAWAL
51 G.P AGRAWAL
52 G.P AGRAWAL
Integrated circuits consists of a circuit made up of a number of transistors, diodes, resistors,
capacitors and their interconnection on a single semiconductor chip. Common types of ics are
Linear or Analogue ics and digital ics. The example of linear circuits are simple amplifiers,
operational amplifiers and analogue communication circuits.
Digital circuits are based on logic gates and include TTL,CMOS and high speed
SMOS.
Testing of ICs
Incircuit testing of ICs is simple,measure the d.c. voltage applied at the terminals with
power sources established,apply the correct i/p and then observe the o/p.For out of circuit
testing of IC,remove ic. supply the required power and i/p signal to get desired o/p.
Digital ICs are tested with IC tester which are mu-P based and programmed.
The ic to be tested is inserted in the test socket. The display indicates the status of IC
after testing.
53 G.P AGRAWAL
Manufacturers logo Year of manufacture
Date code 79
Production batch no
32
#$% 7932
SN 74LS74 N
55 G.P AGRAWAL
Mono stable Mode(one-shot timer )
56 G.P AGRAWAL
Astable Mode(oscillator)
Note: capacitor
C2 is used to
filter the noise
and its value
can be suitably
chosen to be
0.01uF.it can
also be
neglected.
57 G.P AGRAWAL
How IC 555 timer works?
Pin-1, GROUND: It is the GROUND PIN of the IC. The negative terminal of DC power supply or
battery is connected to this pin. Here note that IC555 works always on single rail power supply
and NEVER on dual power supply, unlike operational amplifiers. Also note that this pin should be
connected directly to ground and NOT through any resistor or capacitor. If done so, the IC will
not function properly and may heat up and get damaged. This happens because all the
semiconductor blocks inside the IC will be raised by certain amount of stray voltage and will
damage the IC
Pin-2, TRIGGER: It is known as TRIGGER PIN. As the name suggests in triggers i.e. starts
the timing cycle of the IC. It is connected to the inverting input terminal of trigger comparator
inside the IC. As this pin is connected to inverting input terminal, it accepts negative voltage
pulse to trigger the timing cycle. So it triggers when the voltage at this pin LESS THAN 1/3 of
the supply voltage (Vcc). In number of applications, the IC must be triggered by a pulse. The
amplitude and minimum pulse width required for triggering depend on supply voltage of the
IC. Generally the current required for triggering is about 0.5uA for a period of 0.1uS. The
triggering voltage may be in a range from minimum 1.67V whenVcc = 5V to maximum 5V
whenVcc = 15V. The triggering circuit inside the IC is very sensitive and may be
accidently activated due to surrounding noise. To avoid this, the pin is always connected
to a pull-up resistor (10k-ohm), if this pin is used separately
58 G.P AGRAWAL
Pin-3, OUTPUT :This is the OUTPUT PIN of the IC. It can SINK or SOURCE a maximum
current of 200mA. Sinking the current means, when the output of the IC is at logic-0 state i.e.
LOW and so it can absorb current into its output. Similarly sourcing the current means, when
the output of the IC is at logic-1 i.e. HIGH and so it can give out current from its output. Due
to this property of the IC, we can use it in number of typical digital applications also. Also
note that the output voltage of the IC is slightly greater than zero, when it is in logic-0 state.
Similarly it is slightly less than supply voltage (Vcc), when output of the IC is in logic-1 state.
Pin-4, RESET :It is the RESET PIN of the IC. When it is connected to positive terminal of
battery, the IC works normally. However, when it is grounded (either directly or through a
maximum of 100k-ohm resistor), the IC stops its working completely and its timing cycle
stops i.e. the charging or discharging of the external capacitor stops, so output of the IC is
locked in logic-0 state. It is interesting to note that the reset voltage required by this pin is
typically 0.7V at a reset current of 0.1mA. However in general applications, this pin is always
connected to positive terminal so that the IC works normally.
Pin-5, C. VOLTAGE :This is known as the CONTROL VOLTAGE pin. The 2/3 of supply
voltage point on the terminal voltage divider is brought out to pin-5, known as the control
terminal of the IC. The timing cycle can be modified by applying external DC control voltage
to this pin.
59 G.P AGRAWAL
This allows manual or electronic remote controlling of the time interval of the IC. The control
terminal is frequently used when the timer is operated in MMV mode. But if you are NOT
using this pin for any such purpose, then this pin MUST BE GROUNDED THROUGH A
CAPACITOR OF 0.01uF. This prevents the time interval from being affected by RF noise from
the surrounding.
Pin-6, THRESHOLD : This is known as the THRESHOLD PIN. It finalizes the timing cycle of
the IC, when its voltage is equal to or greater than 2/3Vcc, the output is at logic-0 state.
Since this pin is connected to non-inverting terminal of threshold comparator inside the IC, it
accepts positive going pulse to end up the timing cycle, also. Note that the typical value of
threshold current is 0.1mA, just like the RESET PIN. The time width of this pulse should be
greater than or equal to 0.1uS.
60 G.P AGRAWAL
Pin-8, +Vcc: It is known as the +ve supply terminal of the IC. The battery voltage
connected across this pin and ground pin SHOULD NOT EXCEED 18V. Generally the range
of operating voltage of the IC is 3V18V.
61 G.P AGRAWAL
The delay period, the time that the output is high, in seconds is given by:
1.1 x C x R, where R is in Mega ohm and C is in microfarads.
To obtain large delay in some practical applications, the value of timing resistor should not exceed
20 Mega ohm. If you use an electrolytic timing capacitor, select a unit for low leakage. The time
delay may have to be adjusted by varying PT to compensate for the wide tolerance of electrolytic.
An important feature to be noted here is that 555, unlike many RC timers, provide a timed interval
that is virtually independent of supply voltage Vcc.
62 G.P AGRAWAL
4029
With the clock made,we are ready to count the no of pulses passed into the circuit. Any kind of
counting requires a memory (you have to know that you have just counted 3 to go to 4).so
4029 can be used as a memory element that remembers its immediate previous state.
63 G.P AGRAWAL
7447:BCD to 7 SEGMENT DISPLAY DECODER
64 G.P AGRAWAL
65
G.P AGRAWAL
Operational Amplifier (OP-AMP)
66 G.P AGRAWAL
OPAMP as a COMPARATOR
UA741
67 G.P AGRAWAL
7805 Voltage Regulator
68 G.P AGRAWAL
69 G.P AGRAWAL
HCF4017B
70 G.P AGRAWAL
71 G.P AGRAWAL
7404 Hex inverting Gates (NOT GATE)
72 G.P AGRAWAL
7432 Quad 2-Input OR Gate
73 G.P AGRAWAL
7400 Quad 2-Input NAND Gate
74 G.P AGRAWAL
SENSORS
75 G.P AGRAWAL
76 G.P AGRAWAL
Analog Sensors
77 G.P AGRAWAL
LM35
LM35: LM35 is temperature sensor. It sense the surrounding
temperature and convert in to a particular voltage
(depending on surrounding temp). It is a three leg sensor.
It gives 10mV per degree centrigrate. Now, if V ref.
if temp is 31 degree centrigrate than my lm35 will give value
of 310mV and corresponding ADC value will be 63.
78 G.P AGRAWAL
Digital IR Sensor (TSOP Sensor)
79 G.P AGRAWAL
80 G.P AGRAWAL
SECTION-B
EMBEDDED SYSTEMS
81 G.P AGRAWAL
INTRODUCTION TO MICROCONTROLLER
What is a microcontroller?
A microcontroller is an integrated circuit that is programmed to do a
specific task.
Microcontrollers are really just mini -computers.
82 G.P AGRAWAL
If I give you an IC with 20 pins and tell you that you have to perform a specific task,
then you can make any pin as output or input also you can change the function by
programming that IC using your computer. It has a set of pins called as PORT and
you can program it to perform according to your choice whatever you want to see
output. You can change the configuration as many times you wants.
INTEL
ATMEL
MICROCHIP
MOTOROLA
TEXAS
83 G.P AGRAWAL
84 G.P AGRAWAL
A Microcontroller is a computer dedicated to a single task.
Fundamental components of a microcontroller :
Central processing unit
Memory
System Clock(Oscillator)
Peripherals
Microprocessor versus Microcontroller
85
G.P AGRAWAL
How do we code microcontrollers?
According to your desired output you can write program on your computer in any
high languages like C,C++ etc.Then you have to compile the code to generate machine
code file,becoz all the machines understand only 1 & 0 logics that means ON(+5 volts)
or OFF(GND or 0 v relatively) respectively.
so,we write the program in C language which we understand and then compile
and make the machine file (.hex file) and then the code is converted in to 0,1 language i.e
machine language and then we feed this to the memory of microcontroller.
86 G.P AGRAWAL
So, to exchange information between microcontroller and computers Serial Port ,we
have a circuit like mediator called PROGRAMMER which converts CMOS
(microcontroller) to UART (serial port) and vice versa. Now we can connect computer to
the microcontroller and feed the machine file to the flash memory of microcontroller.
Atmel Microcontrollers are very famous as they are very easy to use.There are many
development tools are available for them. First of all we need an easy IDE for developing
code.So we use CVAVR(code vision AVR). It has limitation of code size.
Programmer
87 G.P AGRAWAL
For the installation of Microcontroller (ATMEL),we need following softwares & hardwares:
Softwares:
1. Usbtiny
2. com0com
3. AvrStudio
4. CodeVisionAVR
5. usbtinyisp w64 driver
6. USB to Serial
7.Deso 13b application(to give test mode in window7)
8.Protieus(for simulation of circuit)
Hardwares:
1. USB-Boarduino Board
2. USBTiny ISP AVR Programmer
CodeVisionAVR
An IDE has following functions:
Preprocessing
Compilation
Assembly
Linking
Object Translation
88 G.P AGRAWAL Text Editor
If we just use compiler and linker independently we still need to get a text editor. So combining
everything will actually mess things up. So the best way is to get Software which has it all. Thats
called an Integrated Development Environment, in short IDE.
We will use CVAVR as the best IDE for getting started with AVR programming .It has a very good
code wizard which generates codes automatically. You need not mess with assembly words.
Select the chip and its frequency (at which it is running) for which you are going to write
program. PORT is usually a collection of 8 pins.
Now you will select pins which you want to configure as output or input. It basically writes DDR
and PORT registers through this setting. Registers are basically RAM locations which configure
various peripherals of microcontroller and by changing value of these registers we can change the
function it is performing. All the details are provided in its Datasheet.
For Atmega-8 which has 3 Ports(B,C,D). You can also set initial values of the pins you want to
assign or if you are using a pin as input then whether you want to make it as PULL-UP or
tristated.
Similarly using this code wizard you can very easily configure all the peripherals on the Atmega.
Now for generating code just go to FILE->GENERATE->,SAVE and then EXIT(code wizard).
Now give file name and location for saving three files.Two file will be project file and one will be .C
file (program file). Give same name to all files to avoid confusion. These files will be generated in
89
C:\CVAVR\bin.
G.P AGRAWAL
The generated program will open in the text editor.it will have some declarations like PORT,
DDR and many more . These are all registers which configures various configuration of Atmega
and by changing these value we can make different functions.We put our part of code in the
infinite while loop provided by the code wizard.
In this code wizard all registers will be configured automatically and now we have to generate
the hex file ,so first compile the program. Either press F9 or go to Project->Compile.
It will show compilation error if any.if program is free we can proceed to making of hex file. So
either press shift+F9 or go to Project->Make or simply you can BUILD the project. Now the
machine file will become ready and it will be in the same folder where we saved those three files.
90 G.P AGRAWAL
91 G.P AGRAWAL
92 G.P AGRAWAL
93 G.P AGRAWAL
94 G.P AGRAWAL
95 G.P AGRAWAL
96 G.P AGRAWAL
97 G.P AGRAWAL
98 G.P AGRAWAL
99 G.P AGRAWAL
100 G.P AGRAWAL
Now your program is ready .you
have created all three files. So now
you have to feed .HEX file in the
flash memory of Microcontroller.
Features
8-bit
Microcontroller
with 32KBytes
In-System
Programmable
Flash
PC6/RESET: If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin. Note that the
electrical characteristics of PC6 differ from those of the other pins of Port C.
If the RSTDISBL Fuse is unprogrammed, PC6 is used as a Reset input. A low level on this pin
for longer than the minimum pulse length will generate a Reset, even if the clock is not running.
Port D (PD7..PD0): Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for
each bit). The Port D output buffers have symmetrical drive characteristics with both high sink and
source capability. As inputs, Port D pins that are externally pulled low will source current if the pull-up
resistors are activated. The Port D pins are tri-stated when a reset condition becomes active,
even if the clock is not running.
AVCC : AVCC is the supply voltage pin for the A/D Converter, Port C (3..0), and ADC (7..6). It
should be externally connected to VCC, even if the ADC is not used. If the ADC is used, it should
be connected to VCC through a low-pass filter. Note that Port C (5..4) use digital supply voltage,
VCC.
AREF : AREF is the analog reference pin for the A/D Converter.
I/O PORTS
Input Output functions are set by Three Registers for each PORT :-
To set a pin to act as output or input , we use DDRX register . Every bit corresponds to one pin of
PORTX.
For example take DDRD register:
Bit 7 6 5 4 3 2 1 0
Now to make a pin act as I/O we set its corresponding bit in its DDR register.
To make Input set bit 0
To make Output set bit 1
If I write DDRD = 0xFF (0x for Hexadecimal number system) that is setting all the bits of
DDRD to be 1, will make all the pins of PORTD as Output.
Similarly by writing DDRD = 0x00 that is setting all the bits of DDRD to be 0, will make all
the pins of PORTD as Input.
DDRB 1 1 0 1 0 0 0 1
For this configuration we have to set DDRB as 11010001 which in hexadecimal is D1. So we
will write DDRB=0xD1
OUTPUT PIN
If a pin is set to be output, then by setting bit 1 we make output High and by setting bit
0 we make output Low .
Lets take an example. Consider I have set DDRB=0xFF, that is all the pins to be
Output. Now I want to set Outputs as shown in table,
VALUE H H L L L H H L
PORTB 1 1 0 0 0 1 1 0
Tristated means the input will hang (no specific value) if no input voltage is specified on
that pin.
Pull Up means input will go to +5V if no input voltage is given on that pin. It is basically
connecting PIN to +5V through a 10K Ohm resistance.
This register is used to read the value of a PORT. If a pin is set as input then
corresponding bit on PIN register is,
CIRCUIT CONNECTION
Printing Function
lcd_clear() : Clears the lcd. You should Call this function before the while(1)
loop, otherwise you will not be able to see anything.
lcd_gotoxy(x,y)
Place the cursor at coordinates (x,y) and start writing from there. The first
coordinate is (0,0). Hence, x ranges from 0 to 15 and y from 0 to 1 in our LCD. Suppose
you want to display something starting from the 5th character in second line, then the
function would be
lcd_gotoxy(5,1);
lcd_putchar(char c)
To display a single character. E.g.,
lcd_putchar(H);
121 G.P AGRAWAL
lcd_putsf(constant string)
To display a constant string. Eg,
lcd_putsf(My name is GP Agrawal);
lcd_puts(char arr)
To display a variable string, which is nothing but an array of characters (data type char) in
C language . e.g., You have an array char a[10] which keeps on changing. Then to display
it, the function would be called as
lcd_puts(a);
Now we have seen that only characters or strings (constant or variable) can be displayed
on the LCD. But if we have to display values of numeric variables, then it is not possible
directly. so we convert that numeric value to a string and then display it. For e.g., if we
have a variable of type integer, say int i, and we need to display the value of i .For this, we
use the C functions itoa() and ftoa(), but remember to include the header file stdlib.h to use
these C functions.
We will be using Serial Port for communication between the uC and the computer. A
serial port has 9 pins as shown. If you have a laptop, then most probably there wont be
a serial port. Then you can use a USB to serial Converter.
If you have to transmit one byte of data, the serial port will transmit 8 bits as one bit at a
time. The advantage is that a serial port needs only one wire to transmit the 8 bits.
The standard used for serial communication is RS-232 (Recommended Standard 232). The
RS-232 standard defines the voltage levels that correspond to logical one and logical zero
levels. Valid signals are plus or minus 3 to 15 volts. The range near zero volts is not a valid
RS-232 level; logic one is defined as a negative voltage, the signal condition is called
marking, and has the functional significance of OFF. Logic zero is positive; the signal
condition is spacing, and has the function ON.
Now we know that this is not the voltage level at which our microcontroller works. Hence, we
need a device which can convert this voltage level to that of CMOS, i.e., logic 1 = +5V and
logic 0 = 0V. This task is carried out by an IC MAX 232, which is always used with four 10uF
capacitors.
What we have seen till now that the input given to uC was digital, i.e., either +5 V (logic 1) or
0V (logic 0). But what if we have an analog input, i.e., value varies over a range, say 0V to
+5V? Then we require Analog to Digital Converter (ADC) to convert this analog voltage to
discrete values.
ADC pin is available in Atmega8. we can apply analog voltage and get corresponding digital
values. We use only 8 bit out of it (0 to 255) as too much precision is not required.
Reference voltage is the voltage to which the ADC assigns the maximum value (255 in case of
8 bit ). Hence, the ADC of Atmega8 divides the input analog voltage range (0V to Reference
Voltage) into 256 equal parts since8 bit ADC is used. For example, if the reference voltage is
5V and we use 8bit ADC, 0V has digital equivalent 0, +5V is digitally 255 and 2.5V is
approximately equal to 128.