Bachelor of Technology: HP Education Services
Bachelor of Technology: HP Education Services
Bachelor of Technology: HP Education Services
HP Education Services
Submitted for partial fulfillment of award of
BACHELOR OF TECHNOLOGY
Degree
In
Electronics & Instrumentation
By
Abhinav Pratap singh
MORADABAD INSTITUTE OF
TECHNOLOGY,MORADABAD, INDIA
June 2010
1|Page
CONTENTS
2|Page
2.4 I/O Ports 21
2.4.1 DDRX (Data Direction Register) 21
2.4.2 PORTX Data Register 21
2.4.2.1 O/P Pin 22
2.4.2.2 I/P Pin 22
2.4.3 PINX (Data Read Register) 22
REFERANCES 35
3|Page
CHAPTER1
BASIC ELECTRONICS
In most general terms, this system’s behavior is sufficiently explained by using only two of its
states can be Voltage(more than x volts or less?).
Note that although in every case, the all the intermediate states ARE POSSIBLE AND DO
EXIST. In electronic systems we mostly deal with Voltage levels as digital entities.
There is no specific fixed definition of logic levels in electronics. Most commonly used level
designation is the one used in CMOS and TTL (transistor transistor logic) families:
Where high and low are actually ‘higher’ and ‘lower’ with respect to a reference voltage level
(ideally taken as 2.5V)
4|Page
1.2 Types of Digital Circuits
Combinatorial Circuits: In these circuits, the past states are immaterial and the output depends
only upon the present state. Example logic gates Sequential circuits: In these circuits, the next
state is completely determined by the past states. Hence these follow a predictable structure and
essentially require a timing device. Ex. counters, flip flops.
A clock is simply alternate high and low states of voltage with time i.e. essentially a square
wave. Important terms related to clock are its duty cycle and its frequency. Duty cycle is the
ratio of Th and Th+Tl.
5|Page
1.2.2 Logic Gates: Building block of a combinatorial circuitry
These are essentially combinatorial circuits used to implement logical Boolean operations like
AND, NAND, OR, XOR and NOT. NOT and NAND are called universal gates as any other gate
can be formed using either of them.
6|Page
1.3 Practical Circuiting Elements
1.3.1 Resistor:
A color scheme is followed to give the specifications of a resistor. The table for color code is
shown below:
The 1st two bands specify the 2 digits of the resistor value whereas the 3rd band specifies the
multiplier in terms of the power to which 10 is raised and multiplied to the 2 digits. The
tolerance tells the possible % variation of the resistor value about the value indicated by bands.
1.3.2 Capacitor:
The 2 types of capacitors we frequently use in circuits are ceramic and electrolytic capacitors.
While ceramic capacitors do not have a fixed polarity; electrolytic capacitors should be
connected in their specified polarities only else they might blow off! This polarity is usually
provided on the side of the capacitors corresponding leg.
7|Page
1.3.3 Breadboard:
This is the base used for setting up the circuit. This has embedded metal strips in it that form a
grid of connections inside its body. This allows us to take multiple connections from a single
point without any need of soldering/disordering as in PCBs. It is always a good habit to test the
circuit on breadboard before making it on a PCB.
ICs or Integrated Circuits are packaged circuits designed for some fixed purpose. An IC has its
fixed IC name/number that can be used to get catalog of its functions and pin configuration. ICs
come in various sizes and packages depending upon the purpose.
8|Page
9|Page
1.3.5 LED
It glows only in fwd bias mode i.e. with p junction connected to +ve voltage and n junction to
negative. Diodes are essentially low power devices. The current through the LED should be less
than 20mA. Hence always put a 220 ohm resistor in series with the LED.
10 | P a g e
11 | P a g e
1.4 Some Integrated Circuits and Implementation
555 is an IC used to generate a clock .The two attributes of a clock are Frequency & Duty cycle.
Both of these can be changed using this IC, however the duty cycle is always <50%. There are
two modes in which 555 can run.
12 | P a g e
13 | P a g e
1.4.1.2 Astable mode
In this mode; the output is stable neither in ‘high’ state nor in ‘low ’ state. Hence it oscillates
from one state to another giving us a square wave or clock. We can set the clock frequency and
Duty cycle D by the formulae:
F= 1.44/(R1+2R2)C1
D=(R1+R2)/(R1+2R2)
NOTE: Capacitor C2 is just to filter the noise and its value can be suitably chosen to be 0.01µF.
It can also be neglected.
14 | P a g e
15 | P a g e
1.4.2 4029 counter
With the clock made, we are ready to count the number of pulses passed into the circuit. Note
that any kind of counting requires a memory (you got to know that you have just counted ‘3’ to
go to ‘4’!). Hence 4029 can also be used as a memory element that remembers its immediate
previous state.
For displaying the number in the counter output on a seven segment display (i.e. 7 LED making
up a figure of ‘8’ as in a general calculator. See fig.) we need to decode the 4 bits and match
them to the 7 pins for lighting the LEDs corresponding to the number. This work is done by
7447.
17 | P a g e
Light Dependent Resistor (LDR) or photo resistor is a device that acts like a resistance and its
resistance varies with the intensity of light incident on it. In this device, if photons of sufficient
energy fall on it, the resistance drops drastically as the electrons in the semiconductor are able to
jump from the valence band to the conduction band and are available for conduction. The LDRs
used are mostly responsive to visible light. The resistance might drop from as high as 1MΩ in
the dark to 1 kΩ in bright light.
Opamp is a very important device used in everyday electronics .It is essentially a differential
amplifier with a very high gain of the order of 105!By differential amplifier I mean that it
amplifies the difference of 2 signals and gives the output.
Opamp equation:
Vout= A (V+ - V- )
18 | P a g e
where A is the gain of the order 105. Ironically, this high gain in open loop makes it impossible
to use it as a general purpose differential amplifier directly.
Simplest use of Opamp is as a comparator. It can be used to convert an analog signal to a digital
signal defined by a fixed threshold. Set V- as the threshold voltage say 2.5 V and apply the
analog signal to be digitized at V+ .What will be the output?
7805 voltage regulator is used to get +5 V output out of a higher voltage supply (7.5V-20V).We
use adapter’s supply to generate +5V here. Connect the gnd and +12V of adapter to the pins as
shown and get +5V directly as an output out of the 3rd pin. Current up to 0.5 A can be obtained
from this regulator without any significant fall in voltage level.
19 | P a g e
20 | P a g e
Chapter 2 Introduction to Microcontroller
Introduction
There are AND, XOR, NAND, NOR, OR logic gate ICs, Counters, Timers, Seven Segment
Display Drivers and much more. Just check out 7400 Series and 4000 Series of Integrated
Circuits. Now let’s take Quad 2 input AND gate IC. It has 4 AND gates, each having 2 pins for
input and 1 pin for output.
Similarly all the Integrated circuits have their function tables and input and output pins fixed.
You cannot change the function and no input pin act as output and vice versa. So whenever you
want to design some circuit you first have to get the output as a function of inputs and then
design it using gates or whatever the requirement is. So once a circuit is built we cannot change
its function. Even if you want to make some changes again you have to consider all the gates and
components involved. Now if you are designing any circuit which involves change of the
function table every now and then you are in trouble! Here comes the use of Microcontrollers!
Now if I give you an Integrated Circuit with 20 pins and tell you that you can make any pin as
output or input also you can change the function table by programming the IC using your
computer. That’s what the most basic function of a microcontroller is. It has set of pins called as
PORT and you can make any pin either as output or input. After configuring pins you can
program it to perform according to any function table you want. You can change the
configuration or the function table as many times you wants. There are many Semiconductor
Companies which manufactures microcontrollers. Some of them are:
Intel
Atmel
Microchip
Motorola
Well I cannot go into lot of details about the working because it is a vast topic in itself.
Microcontroller consists of an Microprocessor (CPU that is Central processing Unit) which is
interfaced to RAM (Random Access Memory) and Flash Memory (one your pen drive has!).You
feed your program in the Flash Memory on the microcontroller. Now when you turn on the
microcontroller, CPU accesses the instruction from RAM which access your code from Flash. It
sets the configuration of pins and start performing according to your program.
Basically the program is written on computer in any of the high level languages like C, C++,
JAVA etc. Then the code is compiled to generate the machine file. All the machines understand
only one language, 0 & 1 that is on and off. Now this 0 & 1 both corresponds to 2 different
voltage levels for example 0 volt for 0 logic and +5 volt for 1 logic. Actually the code has to be
21 | P a g e
written in this 0, 1 language and then saved in the memory of the microcontroller. But this will
be very difficult for us! So we write the code in the language we understand (C) and then
compile and make the machine file (.hex). After we make this machine file we feed this to the
memory of the microcontroller.
The voltage levels of our microcontroller are based on CMOS (Complementary Metal Oxide
Semiconductor) technology which has 0 volt for 0 logic and +5 volt for 1 logic. Two different
machines with 2 different ways to define 0 & 1 and we want to exchange information between
them. If they want to exchange information we basically need a mediator which knows both the
language. Similarly we need a circuit which converts CMOS (microcontroller) to UART (serial
port) and vice versa. This circuit is called as programmer. Using this circuit we can connect
computer to the microcontroller and feed the machine file to the flash.
Atmel Microcontrollers are very famous as they are very easy to use. There are many
development tools available for them. First of all we need an easy IDE for developing code.
Some famous compilers/development tools supporting Windows for Atmel Microcontrollers are:
2.2.1 Programmer
Hardware depends on the communication port you are using on the computer (Serial, Parallel or
USB). I suggest beginners to use Serial Programmer as it is very easy to build. Software for that
is Pony Prog. Some famous Windows (XP, Vista) programmers are:
22 | P a g e
2.2.2 Code Vision AVR (CAVR)
Preprocessing
Compilation
Assembly
Linking
Object Translation
Text Editor
23 | P a g e
2.2.2.1 Chip
Select the chip for which you are going to write the program. Then select the frequency at which
Chip is running. By default all chips are set on Internal Oscillator of 1 MHz so select 1MHz if
that is the case.
2.2.2.2 Port
PORT is usually a collection of 8 pins. From this tab you can select which pin you want to
configure as output and which as input. It basically writes the DDR and PORT register 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.
For Atmega-16 which has 4 Ports we can see 4 tabs each corresponding to one Port.
Now for generating code go to File- ---> Generate, Save and Exit (of the code wizard).
24 | P a g e
Now it will ask you name and location for saving three files. Two being project files and one
being the .C file which is your program. Try to keep same names of all three files to avoid
confusion. By default these files are generated in C:\ CVAVR\ bin.
The generated program will open in the text editor. Have a look it has some declarations like
PORT, DDR, TCCR0 and many more. These are all registers which configures various functions
of Atmega and by changing these value we make different functions.
while
(1)
{// Place your code here
};
}
Now we want to generate the hex file, so first compile the program. Either press F9 or go
to Project ---> Compile. It will show compilation errors if any. If program is error free we can
proceed to making of hex file. So either press Shift+F9 or go to Project----> Make. A pop up
window will come with information about code size and flash usage etc.
So the machine file is ready now. It is in the same folder where we saved those 3 files.
2.3.1 Features
25 | P a g e
2.3.2 Pin Configuration
26 | P a g e
2.3.3 Block Diagram
27 | P a g e
2.3.4 Pin Descriptions
RESET: 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.
AVCC: AVCC is the supply voltage pin for Port A and the A/D Converter. 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.
AREF: AREF is the analog reference pin for the A/D Converter.
It has 32 I/O (Input/Output) pins grouped as A, B, C & D with 8 pins in each group. This group
is called as PORT.
28 | P a g e
PC0 - PC7 (PORTC)
PD0 - PD7 (PORTD)
Notice that all these pins have some function written in bracket. These are additional function
that pin can perform other than I/O. Some of them are.
2.3.6 Registers
All the configurations in microcontroller is set through 8 bit (1 byte) locations in RAM (RAM is
a bank of memory bytes) of the microcontroller called as Registers. There are total 32 x 8bit
registers in Atmega-16. As Register size of this microcontroller is 8 bit, it called as 8 bit
microcontroller.
Input Output functions are set by Three Registers for each PORT.
First of all we need to set whether we want a pin to act as output or input. DDRX register sets
this. Every bit corresponds to one pin of PORTX. Let’s have a look on DDRA register.
Bit 7 6 6 5 4 3 2 1 0
Pin PA7 PA6 PA5 PA4 PA3 PA2 PA1 PA0
Now to make a pin act as I/O we set its corresponding bit in its DDR register.
This register sets the value to the corresponding PORT. Now a pin can be Output or Input. So
let’s discuss both the cases.
29 | P a g e
2.4.2.1 Output Pin
If a pin is set to be output, then by setting bit 1 we make output High that is +5V and by setting
bit 0 we make output Low that is 0V.
If a pin is set to be input, then by setting its corresponding bit in PORTX register will make it as
follows,
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,
30 | P a g e
CHAPTER 3 INTERFACING WITH uC
Now we need to interface an LCD to our microcontroller so that we can display messages,
outputs, etc. Sometimes using an LCD becomes almost inevitable for debugging and calibrating
the sensors. We will use the 16x2 LCD, which means it has two rows of 16 characters each.
Hence in total we can display 32 characters
There are 16 pins in an LCD; See reverse side of the LCD for the PIN configuration.
The connections have to be made as shown below:
When we connect an LCD to Atmega16, one full PORT is dedicated to it, denoted by PORT-X
in the figure. To enable LCD interfacing in the microcontroller, just click on the LCD tab in the
31 | P a g e
Code Wizard and select the PORT at which you want to connect the LCD. We will select
PORTC. Also select the number of characters per line in your LCD. There are some special
connections other than those to uC, Vcc and gnd. These are general LCD settings.Pin 3 (VO) is
for the LCD contrast, ground it through a <1kΩ resistance potentiometer for optimum contrast.
Pin 15 & 16 (LEDA and LEDK) are for LCD backlight, give them permanent +5V and GND
respectively as we need to glow it continuously.
Now once the connections have been made, we are ready to display something on our screen.
Displaying our name would be great to start with. Some of the general LCD functions which you
must know are:
1. lcd_clear()
Clears the lcd.
2. 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.
3. lcd_putchar(char c)
To display a single character. E.g., lcd_putchar(‘H’);
4. lcd_putsf(constant string)
To display a constant string. Eg, lcd_putsf(“IIT Kanpur”);
5. lcd_puts(char arr)
To display a variable string, which is nothing but an array of characters.
32 | P a g e
3.2.1UART: Theory of Operation
Figure illustrates a basic UART data packet. While no data is being transmitted, logic 1 must be
placed in the Tx line. A data packet is composed of 1 start bit, which is always a logic 0,
followed by a programmable number of data bits (typically between 6 to 8), an optional parity
bit, and a programmable number of stop bits (typically 1). The stop bit must always be logic 1.
Most UART uses 8bits for data, no parity and 1 stop bit. Thus, it takes 10 bits to transmit a byte
of Data.
BAUD Rate: This parameter specifies the desired baud rate (bits per second) of the UART. This
parameter affects both the receiver and the transmitter. The default is 2400 (bauds).
Once the baud rate has been established (prior to initial communication), both the transmitter and
the receiver’s internal clock is set to the same frequency (though not the same phase). The
receiver "synchronizes" its internal clock to that of the transmitter’s at the beginning of every
data packet received. This allows the receiver to sample the data bit at the bit-cell center.
A key concept in UART design is that UART’s internal clock runs at much faster rate than the
baud rate. This allows the UART receiver to sample the incoming data with granularity of 1/16
the baud-rate period.
The receiver detects the start bit by detecting the transition from logic 1 to logic 0 (note that
while the data line is idle, the logic level is high).
We will be using Serial Port for communication between the uC and the
computer. A serial port has 9 pins as shown. The advantage is that serial port needs only one
wire to transmit the 8 bits.
33 | P a g e
Pin 3 is the Transmit (TX) pin, pin 2 is the Receive (RX) pin and pin 5 is Ground pin. Other pins
are used for controlling data communication in case of a modem. For the purpose of data
transmission only the pins 3 and 5 are required.
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.
Now we know that this is not the voltage level at which our microcontroller works. This task is
carried out by an IC MAX 232, which is always used with four 10uF capacitors. The circuit is
shown:
34 | P a g e
3.2.3 Setting up UART in microcontroller
To enable UART mode in Atmega16, click on the USART tab in Code Wizard. Now depending
upon your requirement, you can either check receiver, transmitter or both.
Once you generate and save the code, all the register values are set by CVAVR and you only
need to know some of the C functions to transfer data. Some of them are:
1. putchar( )
To send one character to the buffer, which will be received by the device (uC or computer)?
E.g., putchar(‘A’);//sends character ‘A’ to the buffer putchar(c); // sends a variable character c
2. getchar( )
To receive one character from the buffer, which might have been sent by the other uC or the
computer, E.g., if we have already defined a variable char c,
Then
c = getchar(); // receives the character from buffer and save it in variable c
3. putsf( )
To send a constant string, Eg, putsf(“Robocon Team”);
3.3 Docklight
To communicate with the computer, you need a terminal where you can send data through
keyboard and the received data can be displayed on the screen. There are many softwares which
provide such terminal, but we will be using Docklight.
3.4 Timers
1.System Clock (fs): This is the clock frequency at which Atmega is running. By default it is 1
MHz which can be changed by setting fuse bits.
2. Timer Clock (ft): This is the clock frequency at which timer module is running. Each timer
module has different clocks.
35 | P a g e
4.Output: Depending upon the mode we have chosen there are options for output pulse.
The Serial Peripheral Interface Bus or SPI bus is a synchronous serial data link used to
communicate between two or more microcontroller and devices supporting SPI mode data
transfer. Devices communicate in master/slave mode where the master device initiates the data
frame.
ADC is available at PORTA of Atmega16. Thus we have 8 pins available where we can apply
analog voltage and get corresponding digital values. The ADC register is a 10 bit register, i.e.,
the digital value ranges from 0 to 1023. Reference voltage is the voltage to which the ADC
assigns the maximum value (255 in case of 8bit and 1023 for 10 bit).
To enable ADC in Atmega16, click on the ADC tab in Code Wizard and enable the checkbox.
You can also check “use 8 bits” as that is sufficient for our purpose then apply that voltage at
AREF (pin 32) and select the Volt. Ref. as AREF pin. Now when you generate and save the
code, all the register values are set automatically along with a function:
3.7 Interrupts
An interrupt is a signal that stops the current program forcing it to execute another program
immediately. The interrupt does this without waiting for the current program to finish. It is
unconditional and immediate which is why it is called an interrupt.
3.7.1 Polling
Polling is simply reading the button input regularly. Usually you need to do some other tasks as
well e.g. read an RS232 input so there will be a delay between reads of the button.
36 | P a g e
3.7.2 Hardware interrupt
By using a hardware interrupt driven button reader the calculation could proceed with all button
presses captured. With the interrupt running in the background you would not have to alter the
calculation function to give up processing time for button reading.
1. Low Level: In this mode interrupt occurs whenever it detects a ‘0’ logic at INT pin. To use
this, you should put an external pull up resistance to avoid interrupt every time.
2. Falling Edge: In this mode interrupt occurs whenever it detects a falling edge that is ‘1’ to ‘0’
logic change at INT pin.
3. Rising Edge: In this mode interrupt occurs whenever it detects a falling edge that is ‘0’ to ‘1’
logic change at INT pin.
37 | P a g e
CHAPTER 4 ROBOTICS
Introduction
Any Autonomous Robot consists of following essential parts.
1.Robot Chassis and actuators, includes wheeled or any type of chassis with all the necessary
actuators fitted on the chassis to achieve desired goal. We mostly use DC geared motors as
actuators.
2. Electronics
Electronics includes Sensors, motion control circuits, power management system etc.
3. Power Source
Usually battery pack consisting of Lead acid, Nickel cadmium, Nickel metal hydride or Lithium
batteries is used.
4. Intelligence
This is the most important part of the autonomous robots. Usually intelligence is achieved by
using Microcontroller.
First step in making an autonomous robot is to chalk out what tasks we are expecting the robot to
perform. After gauging these we get a vague idea about the design and appearance of the robot.
Power for motion is provided by back wheels and turning is achieved using front wheels. This
scheme is similar to that of cars.
38 | P a g e
Advantages:
1.When path to be followed is straight in nature with curved turns this configuration gives fastest
speed and graceful path following.
2.Don’t need to modify left or right wheels velocity to follow the path. This is very advantageous
when we want precision velocity control. In this case back wheels take care of velocity control
and front wheels take care of direction control.
Disadvantages:
1.It will not able to take very sharp turns. Hence it is difficult to move robot on the grid of lines.
2.Somewhat difficult and expensive to make.
3.Front wheels will need position feedback to control turning control.
A method of controlling a robot where the left and right wheels are powered independently.
39 | P a g e
The Three Wheel Differential drive uses two motors and a caster or an omni-directional wheel
easiest to design and program. The radius and centre of rotation can be varied by the varying the
relative speed of rotation between the two motors. Rotating the wheels in different directions
provides a sharp turn. For a smooth turn, rotate the wheels in the same direction but with
different speeds. Greater the difference in speeds, smaller the radius of rotation.
Advantages:
Disadvantages:
1.If we want to move along curved path we have to control left and right motor’s velocity
independently. Hence precision velocity control becomes difficult as actual velocity of the robot
will be average of the both wheels.
4.2.1 H- Bridge:
It is an electronic circuit which enables a voltage to be applied across a load in either direction. It
allows a circuit full control over a standard electric DC motor. That is, with an H-bridge, a
microcontroller, logic chip, or remote control can electronically command the motor to go
forward, reverse, brake, and coast. H-bridge would be preferable where a smaller physical size is
needed, high speed switching, low driving voltage, or where the wearing out of mechanical parts
is undesirable.
The current provided by the MCU is of the order of 5mA and that required by a motor is
~500mA. Hence, motor can’t be controlled directly by MCU and we need an interface between
the MCU and the motor.
40 | P a g e
A Motor Driver IC like L293D or L298 is used for this purpose which has two H-bridge drivers.
Hence, each IC can drive two motors.
Note that a motor driver does not amplify the current; it only acts as a switch (An H bridge is
nothing but 4 switches).
Drivers are enabled in pairs, with drivers 1 and 2 being enabled by the Enable pin. When an
enable input is high (logic 1 or +5V), the associated drivers are enabled and their outputs are
active and in phase with their inputs.
When the enable pin is low, the output is neither high nor low (disconnected), irrespective of the
input.
Direction of the motor is controlled by asserting one of the inputs to motor to be high (logic 1)
and the other to be low (logic 0). To move the motor in opposite direction just interchange the
logic applied to the two inputs of the motors. Asserting both inputs to logic high or logic low will
stop the motor. Resistance of our motors is about 26 ohms i.e. its short circuit current will be
around. 0.46 Amp which is below the maximum current limit.
It is always better to use high capacitance (~1000µF) in the output line of a motor driver which
acts as a small battery at times of current surges and hence improves battery life.
L293 is quadruple half-H driver while L298 is dual full-H driver, i.e, in L293 all four input-
output lines are independent while in L298, a half H driver cannot be used independently, only
full H driver has to be used.
41 | P a g e
Output current per channel = 1A for L293 and 2A for L298. Hence, heat sink is provided in
L298. Protective Diodes against back EMF are provided internally in L293D but must be
provided externally in L298.
To control motor speed we can use pulse width modulation (PWM), applied to the enable pins of
L293 driver. PWM is the scheme in which the duty cycle of a square wave output from the
microcontroller is varied to provide a varying average DC output. What actually happens by
applying a PWM pulse is that the motor is switched ON and OFF at a given frequency. In this
way, the motor reacts to the time average of the power supply.
4.3 IR Sensors
It is better to keep R2 as a variac to vary the sensitivity. The output varies from 0V to 5V
depending upon the amount of IR it receives, hence the name analog. The output can be taken to
a microcontroller either to its ADC (Analog to Digital Converter) or LM 339 can be used as a
comparator.
TSOP 1738 Sensor is a digital IR Sensor; It is logic 1 (+5V) when IR below a threshold is falling
on it and logic 0 (0V) when it receives IR above threshold. It does not respond to any stray IR, it
only responds to IR falling on it at a pulse rate of 38 KHz. Hence we have a major advantage of
high immunity against ambient light. No comparator is required and the range of the sensor can
be varied by varying the intensity of the IR emitting diode (the variac in figure).
42 | P a g e
References
1 Atmega 16 Datasheet
2 www.wikipedia.org
3 http://www.cmosexod.com/micro_uart.htm
4 http://www.best-microcontroller-projects.com/hardware-interrupt.html
5 http://www.avrtutor.com/tutorial/interrupt/interrupts.php
6 http://www.scribd.com/doc/20069720/Embedded-systems-and-Robotics
43 | P a g e