You are on page 1of 48

1

A2Z INFRA RED


CONTROLLING
DEVICE

by

Er. Zatin Gupta

2
LIST OF FIGURES

Figure No. Caption Page No

3.1.1 Darlington Pair 14


3.2.1 Pin Diagram of SPDT Relays 15
3.3.1 Pin Diagram of AT89S52 19
3.4.1 Block Diagram of 16 TSOP 20
3.4.2 IR Receiver Module 21

3
ABSTRACT

It is basically an embedded system based project and in this project I am controlling an


electric appliances from remote location i.e. infrared. This idea is having a lot of
applications in daily life. It uses both the software as well as hardware part. The main
purpose of this project is to run equipment through the remote location without use of
wires i.e. through wireless media. User can switch on/off his home appliances by remote
as per user requirement and user is far apart from the device.

Features of the project:

• Send command from remote location to the device


• It will act according to the commands
• Relays are used to switch on/off the appliance
• IR Receiver is used to receive the signal

Technology Involved

Embedded system designing

Hardware Used:
8-bit microcontroller (AT89S52),
Darlington pair,
Relays SPDT,

Software Used:
Keil Compiler

4
CONTENTS

List of Figures 3

Abstract 4

Contents 5

CHAPTER 1: INTRODUCTION
1.1. Hardware used 7
1.2. Brief overview of peripherals attached 7
1.3. Description 7
1.4 Features 8

CHAPTER 2: LITERATURE: A REVIEW


2.1. Embedded System 9
2.1.1. Components 9
2.1.2. Input Devices 9
2.1.3. Output Devices 9
2.1.4. Software’s & Hardware’s 10
2.1.5. Characteristics 10
2.1.6. Cell Phone 10
2.1.7. Applications 10
2.1.8. Difference-Embedded System & Computing platform 11
2.2. Microcontroller 11
2.2.1. Types of Microcontroller 11
2.2.1.1. 4-bit microcontroller 11
2.2.1.2. 8-bit microcontroller 11
2.2.1.3. 16-bit microcontroller 12
2.2.1.4. 32-bit microcontroller 12
2.2.2 Comparison of 8051 Family members 12
2.2.3 Versions of 8051 microcontroller 13
2.2.3.1 8751 microcontroller
13
2.2.3.2 AT89C51 from ATMEL Corp. 13
2.2.3.3 OTP 13

CHAPTER 3: TECHNOLOGY INVOLVED


3.1. Darlington Pair
14
3.2. Relays 15
3.2.1. SPDT Relays 15

5
3.2.2. Uses of Relays
15
3.3. AT89S52 Microcontroller 16

3.3.1. Pin Description 16


3.3.2. Pin Diagram
19
3.4. TSOP 20

3.4.1. Description 20
3.4.2. Available types
20
3.4.3. Features 20
3.4.4. Block Diagram 20

CHAPTER 4: TESTING
4.1. Hardware Testing 22
4.1.1. Without IC 22
4.1.2. With IC 22
4.2. Software Testing 23
4.2.1. Relay Testing 23
4.2.2. Remote Testing 24

CHAPTER 5: SNAPSHOTS
5.1. Block Diagram 29
5.2. Circuit Diagram 30
5.2.1 Circuit Diagram of Controller 30
5.2.2 Circuit Diagram of Darlington Pair 31
5.2.3 Circuit Diagram of TSOP 31
5.3 Snapshots
5.3.1. Project at ON state 32
5.3.2. When Relay 1 is ON 33
5.3.3. When Relay 2 is ON 34
5.3.4. When Relay 3 is ON 35
5.3.5. When Relay 4 is ON 36
5.3.6. When all relays are OFF 37
5.3.7. Remote used 37

CHAPTER 6: APPLICATIONS AND FUTURE WORK


6.1 Application of the Project 38
6.2 Further Work 38

CHAPTER 7: REFERNECES 39

APPENDIX I: SOURCE CODE 40

6
Chapter-1
Introduction to Project

1.1 Hardware used


To design the specified project I require the following main hardware components.
• IR Remote (Transmitter)
• TSOP (Receiver)
• One AT89S52 microcontroller
• Darlington Pair
• Keys
• Relays
• 7805 IC
• 9-0-9 V transformer for power supply
• A PCB on which all the hardware is mounted

1.2Brief overview of peripherals attached


• IR Remote (Transmitter) is used to transmit an IR signal when a key is pressed.
• TSOP (Receiver) is used to receive the IR signal and send it to microcontroller.
• Relays are used to switch on/off the appliances.
• Darlington pair is used to operate relays.
• 7805 IC is used for controlling the power supply.
1.3 Description

7
It is basically an embedded system based project and in this project I am controlling an
electronic device from remote location i.e. infrared. This idea is having a lot of
applications in daily life. It uses both the software as well as hardware part. The main
purpose of this project is to run equipment through the remote location without use of
wires i.e. through wireless media. User can switch on/off his home appliances by remote
as per user requirement and user is far apart from the device.

1.4 Features:

• Send command from remote location to the device


• It will act according to the commands
• Relays are used to switch on/off the appliance
• IR Receiver is used to receive the signal

8
CHAPTER 2
LITERATURE: A REVIEW

2.1 Embedded system


A hardware system which is designed to perform a specific task in a particular time
period e.g. mobile phones

2.1.1 Components
Components in an Embedded System are as:-
• Hardware
• Input & Output
• Software

2.1.2 Input Devices


Input devices are as follow:-
• Sensors
• Keys
• Analog signals
• Pulses

2.1.3 Output Devices


• LED’s

9
• LCD
• Motors
• Serial data

2.1.4 Software’s Hardware’s


• Machine language Digital IC’s (driver, decoder, MUX)
• Assembly language Linear IC’s (op amp, ADC, DAC)
• High level language Passive components (L, C, R’s)
• C, C++, java PCB, Relays, Motors

2.1.5 Characteristics
Characteristics of Embedded System are:-
• Perform a single set of functions.
• It works in a time constraint environment.
• Most of the embedded system avoids mechanical moving parts because of friction
& due to friction losses are their & hence probability of accuracy decreases.
• Embedded systems have low cost due to mars production.

2.1.6 Cell-phone: very common example of embedded system

Basis components are:


• Keys
• LCD
• Memory Backup
• Some control unit

2.1.7 Applications of Embedded Systems

10
• Consumer electronics, e.g., cameras, camcorders,
• Consumer products, e.g., washers, microwave ovens, ...
• Automobiles (anti-lock braking, engine control...)
• Industrial process controllers & avionics/defense
• Computer/Communication products, e.g. printers, FAX Machine
• Emerging multimedia applications e.g. cell phones, personal digital assistants…
2.1.8 Difference between Embedded System & General Computing
Platform
• An embedded system will have very few resources compared to general purpose
computing systems like a desktop computer.
• The memory capacity and processing power in an embedded system is limited
where as it is more challenging to develop an application in embedded system due
to its constricted environment as compared to developing the same for a desktop
system.

2.2 Micro-Controller

2.2.1 Types of Micro-controllers


• 4 – Bit microcontroller
• 8 – Bit microcontroller
• 16 – Bit microcontroller
• 32 – Bit microcontroller

2.2.1.1 4 – Bit Microcontrollers


• Most popular microcontroller made in terms of production numbers
• Application: appliances and toys
• Economical

11
2.2.1.2 8 – Bit Microcontrollers
• Represent a transition zone between dedicated, high-volume, 4-bit micro-
controllers and the high performance 16 bit microcontroller
• 8 – Bit word size adequate for many computing tasks and control or monitoring
applications.
• Application: simple appliance control, high-speed machine control, data
collection
2.2.1.3 16 – Bit Microcontrollers
• Provide faster response and more sophisticated calculations
• Applications: control of servomechanism like robot arm

2.2.1.4 32 – Bit Microcontrollers


• Design emphasis is more on high speed computation features and not on chip
features like RAM, ROM, Timers, etc
• Applications: robotics, highly intelligent instrumentation, avionics, image
processing.
• Processing, telecommunications, automobiles, etc

Let’s focus on 8051 family of


• Introduced by Intel Corporation in 1981 as MCS– 51
• Intel allowed other manufacturers to make and market any version of 8051
depending upon the speed and on chip ROM
• All versions code compatible
• Other members of the 8051 family: 8052, 8031

2.2.2 COMPARISON OF 8051 FAMILY MEMBERS


Feature 8051 8031 8052
ROM 4K 0K 8K

12
RAM(bytes) 128 128 256
Timers 2 2 3
I/O Pins 32 32 32
Serial Port 1 1 1
Interrupt Sources 6 6 8

2.2.3 VERSIONS OF 8051 μC


2.2.3.1 8751 microcontroller
4K bytes of on chip UV-EPROM require PROM burner, as Ill as UV-EPROM to erase its
contents and takes 20 min erase cycle.

2.2.3.2 AT89C51 from Atmel Corporation


On chip ROM flash memory, erase cycle in seconds, furnish fast development.

2.2.3.3 OTP (one time programmable) version of the 8051


For mass production, low cost. 8051 family from Philips One of the largest selections of
8051 microcontrollers, various features like ADC, DAC, extended I/O, both OTP and
flash.

13
CHAPTER 3
TECHNOLOGY INVOLVED

3.1 Darlington Pair


A Darlington pair is two transistors that act as a single transistor but with a much higher
current gain. Transistors have a characteristic called current gain. This is referred to as
its hFE. The amount of current that can pass through the load when connectedto a
transistor that is turned on equals the input current x the gain of the transistor (hFE).
The current gain varies for different transistor and can be looked up in the data sheet for
the device. Typically it may be 100. This would mean that the current available to drive
the load would be 100 times larger than the input to the transistor.

In some application the amount of input current available to switch on a transistor is very
low. This may mean that a single transistor may not be able to pass sufficient current
required by the load. As stated earlier this equals the input current x the gain of the
transistor (hFE). If it is not be possible to increase the input current then we need to
increase the gain of the transistor. This can be achieved by using a Darlington Pair.
A Darlington Pair acts as one transistor but with a current gain that equals:
Total current gain (hFE total) = current gain of transistor 1 (hFE t1) x current gain of
transistor 2 (hFE t2)
So for example if you had two transistors with a current gain (hFE) = 100:
(hFE total) = 100 x 100
(hFE total) = 10,000
You can see that this gives a vastly increased current gain when compared to a single
transistor. Therefore this will allow a very low input current to switch a much bigger load
current.

Base Activation Voltage


Normally to turn on a transistor the base input voltage of the transistor will need to be
greater that 0.7V. As two transistors are used in a Darlington Pair this value is doubled.
Therefore the base voltage will need to be greater than 0.7V x 2 = 1.4V.

14
It is also worth noting that the voltage drop across collector and emitter pins of the
Darlington Pair when the turn on will be around 0.9V Therefore if the supply voltage is
5V (as above) the voltage across the load will be will be around 4.1V (5V – 0.9V)

Fig 3.1.1: Diagram of Darlington Pair

3.2 RELAYS
3.2.1 SPDT Relays:
(Single Pole Double Throw Relay) an electromagnetic switch, consist of a coil (terminals
85 & 86), 1 common terminal (30), 1 normally closed terminal (87a), and one normally
open terminal (87) (Figure 1).

When the coil of an SPDT relay (Figure 1) is at rest (not energized), the common
terminal (30) and the normally closed terminal (87a) have continuity. When the coil is
energized, the common terminal (30) and the normally open terminal (87) have
continuity.

The diagram below center (Figure 2) shows an SPDT relay at rest, with the coil not
energized. The diagram below right (Figure 3) shows the relay with the coil energized.
As you can see, the coil is an electromagnet that causes the arm that is always connected
to the common (30) to pivot when energized whereby contact is broken from the
normally closed terminal (87a) and made with the normally open terminal (87).

When energizing the coil of a relay, polarity of the coil does not matter unless there is a
diode across the coil. If a diode is not present, you may attach positive voltage to either
terminal of the coil and negative voltage to the other, otherwise you must connect
positive to the side of the coil that the cathode side (side with stripe) of the diode is
connected and negative to side of the coil that the anode side of the diode is connected.

15
Fig 3.2.1: Pin Diagram of SPDT Relays

3.2.2 Use of Relays

Anytime you want to switch a device which draws more current than is provided by an
output of a switch or component you'll need to use a relay. The coil of an SPDT or an
SPST relay that we most commonly use draws very little current (less than 200
milliamps) and the amount of current that you can pass through a relay's common,
normally closed, and normally open contacts will handle up to 30 or 40 amps.

This allows you to switch devices such as headlights, parking lights, horns, etc., with low
amperage outputs such as those found on keyless entry and alarm systems, and other
components. In some cases you may need to switch multiple things at the same time
using one output. A single output connected to multiple relays will allow you to open
continuity and/or close continuity simultaneously on multiple wires.

3.3 AT89S52 Microcontroller

3.3.1 Pin Description

VCC
Supply voltage.

GND
Ground

Port 0

Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink
eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high
impedance inputs. Port 0 can also be configured to be the multiplexed low order
Address/data bus during accesses to external Program and data memory in this mode, P0
has internal Pull ups. Port 0 also receives the code bytes during Flash programming and
outputs the code bytes during program verification. External pull-ups are required during
program verification.

Port 1

Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1 output buffers
can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high
by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are

16
externally being pulled low will source current (IIL) because of the internal pull-ups. In
addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input
(P1.0/T2) and the Timer/counter 2 trigger input (P1.1/T2EX), respectively, as shown in
the following table. Port 1 also receives the low-order address bytes during Flash
programming and verification.

Port Pin Alternate Functions

• P1.0 T2 (external count input to Timer/Counter 2), clock-out


• P1.1 T2EX (Timer/Counter 2 capture/reload trigger and direction control)
• P1.5 MOSI (used for In-System Programming)
• P1.6 MISO (used for In-System Programming)
• P1.7 SCK (used for In-System Programming)

Port 2

Port 2 is an 8-bit bidirectional I/O port with internal pull ups. The Port 2 output buffers
can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high
by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are
externally being pulled low will source Current (IIL) because of the internal pull-ups Port
2 emits the high-order address byte during fetches from external program memory and
during accesses to external data memory that use 16-bit addresses (MOVX @ DPTR). In
this application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to
external data memory that uses 8-bit addresses (MOVX @ RI); Port 2 emits the contents
of the P2 Special Function Register. Port 2 also receives the high-order address bits and
some control signals during Flash programming and verification.

Port 3

Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3 output buffers
can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high
by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are
externally being pulled low will source current (IIL) because of the pull-ups. Port 3 also
serves the functions of various special features of the AT89S52, as shown in the
following table. Port 3 also receives some control signals for Flash programming and
verification

Port Pin Alternate Functions

• P3.0 RXD (serial input port)


• P3.1 TXD (serial output port)
• P3.2 INT0 (external interrupt 0)
• P3.3 INT1 (external interrupt 1)
• P3.4 T0 (timer 0 external input)

17
• P3.5 T1 (timer 1 external input)
• P3.6 WR (external data memory write strobe)
• P3.7 RD (external data memory read strobe)

RST

Reset input. A high on this pin for two machine cycles while the oscillator is running
resets the device. This pin drives High for 96 oscillator periods after the Watchdog times
out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In
the default state of bit DISRTO, the RESET HIGH out feature is enabled.

ALE/PROG

Address Latch Enable (ALE) is an output pulse for latching the low byte of the address
during accesses to external memory. This pin is also the program pulse input (PROG)
during Flash programming. In normal operation, ALE is emitted at a constant rate of 1/6
the oscillator frequency and may be used for external timing or clocking purposes. Note,
however, that one ALE pulse is skipped during each access to external data memory. If
desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit
set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is
weakly pulled high. Setting the ALE-disable bit has no Effect if the microcontroller is in
external execution mode.

PSEN

Program Store Enable (PSEN) is the read strobe to external program memory. When the
AT89S52 is executing code from external program memory, PSEN is activated twice
each machine cycle, except that two PSEN activations are skipped during each access to
external data memory.

EA/VPP

External Access Enable EA must be strapped to GND in order to enable the device to
fetch code from external program memory locations starting at 0000H up to FFFFH.
Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset.
EA should be strapped to VCC for internal program executions. This pin also receives the
12-volt programming enable voltage (VPP) during Flash Programming.

XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.

XTAL2
Output from the inverting oscillator amplifier.

18
3.3.2 PIN DIAGRAM

19
Fig 3.3.1: Pin Diagram of AT89S52

3.4 TSOP
3.4.1. Description

20
The TSOP17.. – series are miniaturized receivers for infrared remote control systems.
PIN diode and preamplifier are assembled on lead frame, the epoxy package is designed
as IR filter. The demodulated output signal can directly be decoded by a microprocessor.
TSOP17.. is the standard IR remote control receiver series, supporting all major
transmission codes.

3.4.2 Available types for different carrier frequencies

Type fo Type fo
TSOP1730 30 kHz TSOP1733 33 kHz
TSOP1736 36 kHz TSOP1737 36.7kHz
TSOP1738 38 kHz TSOP1740 40 kHz
TSOP1756 56 kHz

3.4.3 Features

• Photo detector and preamplifier in one package


• Internal filter for PCM frequency
• Improved shielding against electrical field disturbance
• TTL and CMOS compatibility
• Output active low
• Low power consumption
• High immunity against ambient light
• Continuous data transmission possible (up to 2400 bps)
• Suitable burst length .10 cycles/burst

3.4.4 Block Diagram

Fig: 3.4.1. Block Diagram of TSOP

21
Fig 3.4.2: IR Receiver Module

22
CHAPTER-4
TESTING
4.1 HARDWARE TESTING

4.1.1 WITHOUT IC

Power off testing: in this testing module I have checked continuity to all the peripherals
mounted on the PCB i.e. if there is any loose connection or breakage in between
connections then it must be repaired.

Continuity in between:
• Controller & L293D
• Controller & HT12D
• Controller and LCD
• Controller with Buzzer
• All the components connected to IC’s
• Keys must be short on pressing
• When key pressed then it short with encoder pin
• Signal goes from encoder to decoder also non distorted
• Output of decoder in BCD form supplied to LED’s so, that connection also tight

Power on testing: in this module all the frequencies, voltages, ground, +ve, -ve points
checked i.e. is all the requirements are fulfilled or not i.e. voltages & frequencies supplied
or generated by supply is right or not. In this:
Vcc=5v
Gnd=0v
Reset=0v initial & 5v pressed

4.1.2 WITH IC

With IC testing, power on testing type, in which IC also mounted on its base & supply
connected to main. In this some parameters are observed which are mentioned as below:
Vcc=5v
Gnd=0v
Reset= low-high-low

Crystal Oscillator: in this there are 2 parameters as below Voltage & Frequency.
Voltage at 18 & 19 pin <=2v
Frequency=11.0592MHz

23
4.2 SOFTWARE TESTING

This is that testing module in which the hardware components are tested by running
software on them to check only the connections and hardware. The different hardware
tested in this module is given as with their software’s:

4.2.1 Relay Testing


Relays are used to drive the appliances. To check this hardware, software is as follows:

RELAY TESTING

#include <reg51.h>
sbit relay1=P2^3;
sbit relay2=P2^2;
sbit relay3=P2^1;
sbit relay4=P2^0;
sbit ir=P3^2;
//-------------------------
void delay_us(unsigned int);
//-----------------------------
//---------------------

void main()
{
relay1=0;
relay2=0;
relay3=0;
relay4=0;
while(1)
{
relay1=~relay1;
delay_us(50000);

}
}
void delay_us(unsigned int us)
{
TMOD=0x01;
us=65535-us;
TH0=us/255;
TL0=us%255;
TR0=1;
while(TF0==0);
TF0=0;
TR0=0;
}

24
4.2.2. Remote Testing
We are using an IR Remote. To decode the IR signal we use CRO connected with TSOP
and testing phenomenon is as follows:

LO

L1

M0

M1

R1

R0

25
U0

U1

D0

D1

P0

P1

T10

26
T11

T20

T21

T30

T31

Total pulse code duration of each switch is 24ms.


No of pulse are 14.
So each pulse period is 24000/14=1714.25uS.

27
In this remote, it is using Biphase-S line coding.

So for decoding of same line coding we have to check the middle of each half pulse if
both are same than consider as “1” logic other wise “0” logic.
Half pulse is 857us.
Middle of each half pulses is 857/2=428uS.
It means we have to check the first signal at 428-430uS duration.
Than every 857uS

If switch is continuously press than duration of pulse coding is 85mS.


Middle 0xx0000 1101110
Upper 0xx0000 1100001
Lower 0xx0000 1100010
Right 0xx0000 0110001
Left 0xx0000 0110010
Power 0xx0000 0010101
T0 0xx0000 0010110
T1 0xx0000 1001001
T2 0xx0000 1001100

28
Middle 01 x x 10 10 10 10 11 00 10 11 00 11 01
Upper 01 x x 10 10 10 10 11 00 10 10 10 10 11
Lower 01 x x 10 10 10 10 11 00 10 10 10 11 01
Right 01 x x 10 10 10 10 10 11 00 10 10 10 11
Left 01 x x 10 10 10 10 10 11 00 10 10 11 01
Power 01 x x 10 10 10 10 10 10 11 01 00 10 11
T0 01 x x 10 10 10 10 10 10 11 01 00 11 01
T1 01 x x 10 10 10 10 11 01 01 00 10 10 11
T2 01 x x 10 10 10 10 11 01 01 00 11 01 01

Middl e 1011 0011 0100 1101 0101 01xx xx10 B34D500


Upper 1101 0101 0100 1101 0101 01xx xx10 D54D500
Lower 1011 0101 0100 1101 0101 01xx xx10 B54D500
Left 1011 0101 0011 0101 0101 01xx xx10 B535500
Right 1101 0101 0011 0101 0101 01xx xx10 D535500
Power 1101 0010 1101 0101 0101 01xx xx10 D2D5500
T0 1011 0010 1101 0101 0101 01xx xx10 B2D5500
T1 1101 0100 1010 1101 0101 01xx xx10 D4AD500
T2 1010 1100 1010 1101 0101 01xx xx10 ACAD500

29
CHAPTER-5
SNAPSHOTS

5.1 BLOCK DIAGRAM

POWER SENSOR
REGULATOR

A
T
8
9
S
5 RELAY 3
RELAY 1
2

RELAY 2

30
5.2 CIRCUIT DIAGRAM OF THE PROJECT

5.2.1 Circuit Diagram of Controller

31
5.2.2 Circuit Diagram of Darlington Pair

5.2.3 Circuit Diagram of TSOP

5.3 SNAPSHOTS

32
5.3.1 Project at ON State

5.3.2 When Relay 1 is ON

33
5.3.3 When Relay 2 is ON

34
5.3.4 When Relay 3 is ON

35
5.3.5 When Relay 4 is ON

36
5.3.6 When Relays are OFF

37
5.3.7 Remote Used

CHAPTER-6

6.1 APPLICATIONS OF PROJECT

38
As stated above that I have made a project on remote control this controls home
appliances. This project has many applications in today life as mentioned below:

• Controlling home appliances for power saving operations.


• It creates automatic controlling the power in the field of switching the appliances.
• This project can be used as a domestic robot for small kind of work.
• This is very useful for handicapped and aged people.

6.2 FURTHER WORK

There is another 3 steps which are applicable over this project they are as mentioned as
below:

• It can be wireless by using Bluetooth


• It can also be connect with the mobile phone to make it completely wireless i.e.
now it connects with home telephone line and when ever there is call happening
by a particular mobile then the mobile no. traces by controller if it is right then the
procedure further proceeds and got the instructions by mobile.
• It can also be connect with the computer to receive the signals from system and
hence the project will work according to them.

CHAPTER-7
REFERENCE

39
To complete this project successfully I need to refer with many websites and books some
of them are as mentioned below:

Web links:

• http://www.google.com/

• http://www.alldatasheet.com/

• http://www.alldatasheet.com/view.jsp?Searchword=at89s52

• http://pdf1.alldatasheet.com/datasheet-pdf/view/82390/ATMEL/AT89S52.html

• http://www.the12volt.com/relays/relays.asp

• http://www.google.co.in/images?
hl=en&resnum=0&q=darlington+pair&um=1&ie=UTF-
8&source=univ&ei=Ui4GTNqWE46wrAfb39jDDA&sa=X&oi=image_result_gro
up&ct=title&resnum=4&ved=0CDAQsAQwAw

• http://www.kitronik.co.uk/pdf/darlingtonpair.pdf

• http://en.wikipedia.org/wiki/Darlington_transistor

• http://www.alldatasheet.com/view.jsp?Searchword=TSOP1738

• http://pdf1.alldatasheet.com/datasheet-
pdf/view/127448/VISHAY/TSOP1738KA1.html

• http://www.google.co.in/search?
hl=en&q=ir+receiver+tsop1738&btnG=Search&aq=3&aqi=g-e2g3g-
s1g4&aql=&oq=ir+receiver+&gs_rfai=

• http://www.physicsforums.com/showthread.php?t=230079

• http://pdf1.alldatasheet.com/datasheet-pdf/view/257587/WINGS/7805A.html

• http://www.alldatasheet.com/datasheet-pdf/pdf/257587/WINGS/7805A.html

APPENDIX -I
CODING OF THE PROJECT

40
//=========================================================
#include <reg51.h>
//---------------------
#define left_key 0x1B535500UL
#define right_key 0x1D535500UL
#define upper_key 0x1D54D500UL
#define lower_key 0x1B54D500UL
#define middle_key 0x1B34D500UL
#define power_key 0x1D2D5500UL
#define t1_key 0x1B2D5500UL
#define t2_key 0x1D4AD500UL
#define t3_key 0x1ACAD500UL
//-----------------------------
//#define ircheck RA0
sbit relay1=P2^3;
sbit relay2=P2^2;
sbit relay3=P2^1;
sbit relay4=P2^0;
sbit ir=P3^2;
//---------------------------
void inti(void);
void delay_us(unsigned int);
void ir_sence(void);
void remote_ok(void);
void remote_inc(void);
void remote_dec(void);
void remote_left(void);
void remote_right(void);
void remoteelse(void);
//---------------------------
unsigned long data_ir=0;
unsigned char relay1_status=0;
unsigned char relay2_status=0;
unsigned char relay3_status=0;
unsigned char relay4_status=0;
//-------------------------
void main()
{
inti();
while(1)
{
while(ir);
ir_sence();
}
}

41
//-----------------------initialisation---------------
void inti(void)
{ //make i/o lines accordingly,
relay1=0;
relay2=0;
relay3=0;
relay4=0;
}
//-------------------------------------------------------
void remote_inc()
{
if(relay1_status==0)
{ relay1=1; relay1_status=1;}
else
{ relay1=0; relay1_status=0;}
}
//-----------------------------------------------
void remote_dec()
{
if(relay2_status==0)
{ relay2=1; relay2_status=1;}
else
{ relay2=0; relay2_status=0;}
}
//----------------------------------------------
void remote_left()
{
if(relay3_status==0)
{ relay3=1; relay3_status=1;}
else
{ relay3=0; relay3_status=0;}
}
//-----------------------------------------------
void remote_right()
{
if(relay4_status==0)
{ relay4=1; relay4_status=1;}
else
{ relay4=0; relay4_status=0;}
}
//-----------------------------------------------
void remote_ok()
{
relay1=0;
relay2=0;
relay3=0;

42
relay4=0;
}
//------------------------------------------------
void remoteelse()
{
delay_us(50000);
delay_us(50000);
delay_us(50000);
}
//-----------------------------------
void delay_us(unsigned int us)
{
TMOD=0x01;
us=65535-us;
TH0=us/256;
TL0=us%256;
TR0=1;
while(!TF0);
TF0=0;
TR0=0;
}
////---------------------------------------------------
//void isr(void) interrupt
void ir_sence(void)
{
// if(INTF==1)
// {
// GIE=0;// intruppt diable
//INTE=0;
data_ir=0;
delay_us(400); //data1
// ircheck=1;
if(ir) data_ir|=0x01;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(700);//data2
// ircheck=1;
if(ir) data_ir|=0x02;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(700);//data3
// ircheck=1;

43
if(ir) data_ir|=0x04;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(700);//data4
// ircheck=1;
if(ir) data_ir|=0x08;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(700);//data5
// ircheck=1;
if(ir) data_ir|=0x010;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(700);//data6
// ircheck=1;
if(ir) data_ir|=0x020;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(700);//data7
// ircheck=1;
if(ir) data_ir|=0x040;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(700);//data8
// ircheck=1;
if(ir) data_ir|=0x080;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(700);//data9
// ircheck=1;
if(ir) data_ir|=0x0100;
else data_ir|=0;
delay_us(10);
// ircheck=0;

44
delay_us(700);//data10
// ircheck=1;
if(ir) data_ir|=0x0200;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(700);//data11
// ircheck=1;
if(ir) data_ir|=0x0400;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(700);//data12
// ircheck=1;
if(ir) data_ir|=0x0800;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(700);//data13
// ircheck=1;
if(ir) data_ir|=0x01000;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(700);//data14
// ircheck=1;
if(ir) data_ir|=0x02000;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(700);//data15
// ircheck=1;
if(ir) data_ir|=0x04000;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(700);//data16
// ircheck=1;
if(ir) data_ir|=0x08000;

45
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(700);//data17
// ircheck=1;
if(ir) data_ir|=0x010000;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(700);//data18
// ircheck=1;
if(ir) data_ir|=0x020000;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(700);//data19
// ircheck=1;
if(ir) data_ir|=0x040000;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(700);//data20
// ircheck=1;
if(ir) data_ir|=0x080000;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(700);//data21
// ircheck=1;
if(ir) data_ir|=0x0100000;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(700);//data22
// ircheck=1;
if(ir) data_ir|=0x0200000;
else data_ir|=0;
delay_us(10);
// ircheck=0;

46
delay_us(700);//data23
// ircheck=1;
if(ir) data_ir|=0x0400000;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(700);//data24
// ircheck=1;
if(ir) data_ir|=0x0800000;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(700);//data25
// ircheck=1;
if(ir) data_ir|=0x01000000;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(700);//data26
// ircheck=1;
if(ir) data_ir|=0x02000000;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(700);//data27
// ircheck=1;
if(ir) data_ir|=0x04000000;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(710);//data28
// ircheck=1;
if(ir) data_ir|=0x08000000;
else data_ir|=0;
delay_us(10);
// ircheck=0;

delay_us(750);//data29
// ircheck=1;
if(ir) data_ir|=0x10000000;
else data_ir|=0;

47
delay_us(10);
// ircheck=0;

delay_us(50000);
delay_us(50000);
delay_us(50000);
delay_us(50000);

if((data_ir & 0xFFFFFF00)==upper_key) remote_inc(); //1


else if((data_ir & 0xFFFFFF00)==lower_key) remote_dec(); //2
else if((data_ir & 0xFFFFFF00)==right_key) remote_right();
//3
else if((data_ir & 0xFFFFFF00)==left_key) remote_left(); //4
else if((data_ir & 0xFFFFFF00)==middle_key) remote_ok(); //5
//else if((data_ir & 0xFFFFFF00)==power_key) remote_power();
//6
//else if((data_ir & 0xFFFFFF00)==t1_key) remote_line1(); //7
//else if((data_ir & 0xFFFFFF00)==t2_key) remote_line2(); //8
//else if((data_ir & 0xFFFFFF00)==t3_key) remote_line2(); //9
else remoteelse();
delay_us(50000);
delay_us(50000);
delay_us(50000);
delay_us(50000);

// INTF=0;
// GIE=1;
data_ir=0;
//}
}

48

You might also like