Professional Documents
Culture Documents
IR Remote Reciever To Operate 8 Different Electrical Appliances
IR Remote Reciever To Operate 8 Different Electrical Appliances
INTRODUCTION
IR remote controls use IR LEDs to emit radiation that's focused by a plastic lens into a
narrow beam. Data is encoded by modulating the beam to provide immunity from other
IR sources such as fluorescent lights.
Thus, the Infrared refers to the energy radiations having frequency below visible
range. These radiations are invisible to human eye but may be perceived as heat signals.
Similarly, these radiations can be easily detected through readily available sensor
modules.
1
Figure 1.1: Electromagnetic spectrum
The sun is an example, since it emits a wide spectrum or radiation. The adventure
of using lots of infra-red in TV/VCR remote controls and other applications, brought
infra-red diodes (emitter and receivers) at very low cost at the market.
This infrared light can mean something to the receiver, the "on or off" radiation
can transmit different meanings. Lot of things can generate infrared, anything that radiate
heat do it, including out body, lamps, stove, oven, friction your hands together, even the
hot water at the faucet.
To allow a good communication using infra-red, and avoid those "fake" signals, it
is imperative to use a "key" that can tell the receiver what is the real data transmitted and
what is fake. As an analogy, looking eye naked to the night sky you can see hundreds of
stars, but you can spot easily a far away airplane just by its flashing strobe light. That
strobe light is the "key", the "coding" element that alerts us.
Similar to the airplane at the night sky, our TV room may have hundreds of tinny
IR sources, our body, and the lamps around, even the hot cup of tea. A way to avoid all
those other sources, is generating a key, like the flashing airplane.
So, remote controls use the 36 kHz (or around) to transmit information. Infrared
light emitted by IR Diodes is pulsated at 36 thousand times per second, when transmitting
logic level "1" and silence for "0". To generate a 36 kHz pulsating infrared is quite easy,
more difficult is to receive and identify this frequency.
2
This is why some companies produce infrared receives, that contains the filters,
decoding circuits and the output shaper, that delivers a square wave, meaning the
existence or not of the 36kHz incoming pulsating infrared.
It means that those 3 dollars small units, have an output pin that goes high (+5V)
when there is a pulsating 36kHz infrared in front of it, and zero volts when there is not
this radiation.
To avoid a Philips remote control to change channels in a Panasonic TV, they use
different codification at the infrared, even that all of them use basically the same
transmitted frequency, from 36 to 50 kHz.
So, all of them use a different combination of bits or how to code the transmitted
data to avoid interference. Some standards were created. In this project we will only
show one of them, the one used by Philips.
Philips adopted or created the RC5 standard that uses fixed bit length and fixed
quantity of bits. In this application RC5 pulse protocol used by Philips TV is decoded
using a microcontroller. In other words, this project develops the IR receiver for the
Philips RC5 protocol and the output has been shown on the hardware through relay
controlled devices corresponding to various channels switched with remote. Also, LEDs
glow corresponding to each output.
In this project we will make a TV receiver for Philips remote control. This remote
control is based on RC5 protocol. This receiver will be an embedded system which can be
used in television sets. The decoding of the RC5 pulse protocol has been done in
assembly level language although we can also use embedded C or Basscom for writing
the program for the microcontroller (We will be using Atmel’s AT89C51 8-bit
microcontroller). The project also involves the design and development of the Printed
3
Circuit Board (PCB). This provides the additional benefit that no or minimum wiring has
been done, and hence there are less chances of wear and tear. We have on our part tried to
solder the components as finely as possible.
The further chapters clearly explain the RC5 protocol and our efforts towards its
decoding.
The RC-5 code from Philips is possibly the most used protocol by hobbyists. The
protocol is well defined for different device types ensuring compatibility with your whole
entertainment system.
Features:
• 5 bit address and 6 bit command length (7 command bits for RC5X)
• Manufacturer Philips
Modulation:
The protocol uses bi-phase modulation (or so-called Manchester coding) of a 36
kHz IR carrier frequency. All bits are of equal length of 1.778ms in this protocol, with
half of the bit time filled with a burst of the 36 kHz carrier and the other half being idle.
A logical zero is represented by a burst in the first half of the bit time. A logical
one is represented by a burst in the second half of the bit time. The pulse/pause ratio of
the 36 kHz carrier frequency is 1/3 or 1/4 which reduces power consumption.
4
889µs 889µs 889µs 889µs
Figure 1.2: Modulation
Protocol:
The figure 3 below shows a typical pulse train of an RC-5 message. This example
transmits command $35 to address $05.
1 1 0 0 0 1 0 1 1 1 0 1 0 1
S S
1 2 Address Command
Start bit (Always “1”)
Figure 1.3
The first two pulses are the start pulses, and are both logical "1". Please note that
half a bit time is elapsed before the receiver will notice the real start of the message.
Extended RC-5 uses only one start bit. Bit S2 is transformed to command bit 6,
providing for a total of 7 command bits. The value of S2 must be inverted to get the
7th command bit though!
The 3rd bit is a toggle bit. This bit is inverted every time a key is released and
pressed again. This way the receiver can distinguish between a key that remains
down, or is pressed repeatedly. The next 5 bits represent the IR device address, which
is sent with MSB first.
5
The address is followed by a 6 bit command, again sent with MSB first.
A message consists of a total of 14 bits, which adds up to a total duration of 25 m sec.
Sometimes a message may appear to be shorter because the first half of the start bit S1
remains idle.
And if the last bit of the message is logic "0" the last half bit of the message is
idle too. As long as a key remains down the message will be repeated every 114ms.
The toggle bit will retain the same logical level during all of these repeated messages.
It is up to the receiver software to interpret this auto repeat feature.
Pre-defined Commands:
Philips has created a beautiful list of "standardized" commands. This ensures the
compatibility between devices from the same brand. A very nice feature, often to be
missed with other brands, is the fact that most devices are available twice in the table
allowing one to have 2 VCRs stacked on top of each other without having trouble
addressing only one of them with the remote control.
The addresses for various devices may be seen in the Table 1.1.
The TV and VCR commands corresponding to the RC5 command may be seen in
the Table 1.2.
6
$0D-13 Camcorder
$0E-14
$0F-15
$10-16 Pre-amp
$11-17 Tuner
$12-18 Recorder1
$13-19 Pre-amp
$14-20 CD Player
$15-21 Phono
$16-22 SatA
$17-23 Recorder2
$18-24
$19-25
$1A-26 CDR
$1B-27
$1C-28
$1D-29 Lighting
$1E-30 Lighting
$1F-31 Phone
$00-0 0 0
$01-1 1 1
$02-2 2 2
$03-3 3 3
$04-4 4 4
$05-5 5 5
$06-6 6 6
$07-7 7 7
$08-8 8 8
$09-9 9 9
$0D-13 Mute
7
$10-16 Volume+
$11-17 Volume-
$12-18 Brightness+
$13-19 Brightness-
$32-50 Fastrewind
$34-52 Fastforward
$35-53 Play
$36-54 Stop
$37-55 Recording
Chapter-2
The past two decades have seen the introduction of a technology that has radically
changed the way in which we analyze and control the world around us. Born of parallel
development in computer architecture and integrated circuit fabrication, the
microprocessor, or “computer on a chip,” first become a commercial reality in 1971 with
the introduction of 4-bit 4004 by a small, unknown company by the name of Intel
Corporation. Other better established, semiconductor firms soon follow Intel’s pioneering
technology so that by the late 1970s one could choose from a half dozen or so
microprocessor types.
The microprocessor[1] has been with us for some 15-years now growing from an
awkward 4-bit chip to a robust 32-bit adult. Soon 64 and 128-bit wizards will appear to
8
crunch numbers, spreadsheets, and CAD CAM. The engineering community became
aware of, enamored with, the 8-bit microprocessor of the middle to late 1970’s.
The 1970s also saw the growth of the number of personal computer users from a
handful of hobbyists and “hackers” to millions of business, industrial, governmental,
defense, educational, and private users now enjoying the advantages of inexpensive
computing.
Microcontrollers are not as well known to the general public, or even the technical
community, as are the more glamorous microprocessor. The public is, however, very well
aware that “something” is responsible for all of the smart VCRs, clock radios washers,
and dryers, video games, telephones, microwaves, TVs, automobiles, toys, Vending
machines, copiers, elevators, irons, and a myriad of other articles that have suddenly
become intelligent and “programmable.” Companies are also aware that being
competitive in this age of microchip requires their products, or the machinery they use to
make those products, to have some “smarts.”
Microprocessor:
9
Figure 1 shows a block diagram of a microprocessor CPU, which contains
arithmetic and logic unit (ALU), a program counter (PC), a stack pointer (SP), some
working registers, a clock timing circuit and interrupt circuits. The microprocessor
contains no RAM, no ROM, and no I/O ports on the chip itself.
The key term in describing the design of microprocessor is “general purpose.” The
hardware design of a microprocessor CPU is arrange so that a small or very large system
can be configured around the CPU as the application demands. The internal CPU
architecture, as well as the resultant machine level code that operates that architecture, is
comprehensive but as flexible as possible.
Although the addition of external RAM, ROM, and I/O ports make these systems
bulkier and much more expensive, they have the advantage of versatility such that the
designer can decide on the amount of RAM, ROM, and I/O ports needed to fit the task at
hand
Arithmetic
and
logic unit
Accumulator
Working Register(s)
Clock Interrupt
Circuit 10 Circuit
Figure 2.1: A Block Diagram of a Microprocessor
Microcontroller:
Accumulator I/O
Ports
Registers
Interrupt
Internal RAM Circuits
Internal ROM
Clock
Stack Pointer Circuit
11
Program Counter
Figure 2.2: A block diagram of a Microcontroller
Features
12
• Compatible with MCS-51™ Products
The AT89C51 provides the following standard features: 4K bytes of Flash, 128
bytes of RAM, 32 I/O lines, two 16-bit timer/counters, a five vector two-level interrupt
architecture, full duplex serial port, on-chip oscillator and clock circuitry. In addition, the
AT89C51 is designed with static logic for operation down to zero frequency and supports
two software selectable power saving modes. The Idle Mode stops the CPU while
allowing the RAM, timer/counters, serial port and interrupt system to continue
13
functioning. The Power-down Mode saves the RAM contents but freezes the oscillator
disabling all other chip functions until the next hardware reset.
14
Figure 2.3: Block Diagram of AT89C51
2.4 PIN DESCRIPTION OF AT89C51:
P1.0 VCC
P1.1 PO.O(AD 0)
P1.2
P1.3
GND
PO.1(AD 1)
PO.2(AD 2)
P1.4 PO.3(AD 3)
PO.4(AD 4)
P1.5
PO.5(AD 5)
P1.6
PO.6(AD 6)
P1.7
PO.7(AD 7)
RST
EA/VPP
(RXD) P3.O
(TXD) P3.O ALE/PROG
PSEN
(INT0) P3.2
P2.7(AD 15)
(INT1) P3.3
P2.6(AD 14)
(T0) P3.4
XTAL1 P2.1(AD 9)
GND P2.0(AD 8)
15
Figure 2.4: Pin diagram of AT89C51
Pin description:
In the AT89C51 there are a total of four ports for I/O operations.
Examining Figure 5, note that of the 40 pins, a total of 32 pins are set aside for the
four ports P0, P1, P2, and P3, where each port takes 8 pins. The rest of the pins are
designated as Vcc, GND, XTAL1, XTAL2, RST, EA, ALE/PEOG, and PSEN.
VCC:
Supply voltage.
GND:
Ground.
The four ports P0, P1, P2, and P3 each use 8 pins, making them 8 bit ports.
All the ports upon RESET are configured as inputs, ready to be used as input
ports. When the first 0 is written to a port, it becomes an output. To reconfigure it
as an input, a 1 must be sent to the port.
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 may 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 pullups. Port 0 also receives the code
16
bytes during Flash programming, and outputs the code bytes during program
verification. External pullups are required during program verification.
Port 1:
Port 1 is an 8-bit bidirectional I/O port with internal pullups. 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 pullups and can be used as inputs. As inputs, Port 1
pins that are externally being pulled low will source current (IIL) because of the
internal pullups. Port 1 also receives the low-order address bytes during Flash
programming and program verification.
Port 2:
Port 2 is an 8-bit bi-directional I/O port with internal pullups. 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 pullups 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 pullups. 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, it uses strong internal
pull-ups when emitting 1s. During accesses to external data memory that use 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:
17
Port 3 is an 8-bit bi-directional I/O port with internal pullups. 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 pullups and can be used as inputs. As inputs,
Port 3 pins that are externally being pulled low will source current (IIL) because
of the pullups. Port 3 also serves the functions of various special features of the
AT89C51 as listed below:
Table 2.1
Port 3 also receives some control signals for Flash programming and verification.
RST:
Reset input. A high on this pin for two machine cycles while the oscillator
is running resets the device.
ALE/PROG:
Address Latch Enable 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.
18
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:
When the AT89C51 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:
XTAL1:
Input to the inverting oscillator amplifier and input to the internal clock
operating circuit.
19
XTAL2:
Oscillator Characteristics:
XTAL1 and XTAL2 are the input and output, respectively, of an inverting
amplifier which can be configured for use as an on-chip oscillator, as shown in
Figure 6. Either a quartz crystal or ceramic resonator may be used. To drive the
device from an external clock source, XTAL2 should be left unconnected while
XTAL1 is driven as shown in Figure 7.
There are no requirements on the duty cycle of the external clock signal,
since the input to the internal clocking circuitry is through a divide-by-two flip
flop, but minimum and maximum voltage high and low time specifications must
be observed.
Figure 2.5: Oscillator Connections Figure 2.6: External Clock Drive Configurations
Idle Mode:
In idle mode, the CPU puts itself to sleep while all the on-chip peripherals
remain active. The mode is invoked by software. The content of the on-chip RAM
and all the special functions registers remain unchanged during this mode.
20
reset, the device normally resumes program execution, from where it left off, up to
two machine cycles before the internal reset algorithm takes control.
On-chip hardware inhibits access to internal RAM in this event, but access
to the port pins is not inhibited. To eliminate the possibility of an unexpected write
to a port pin when Idle is terminated by reset, the instruction following the one
that invokes Idle should not be one that writes to a port pin or to external memory.
Power-down Mode:
In the power-down mode, the oscillator is stopped, and the instruction that
invokes power-down is the last instruction executed. The on-chip RAM and
Special Function Registers retain their values until the power-down mode is
terminated. The only exit from power-down is a hardware reset. Reset redefines
the SFRs but does not change the on-chip RAM. The reset should not be activated
before VCC is restored to its normal operating level and must be held active long
enough to allow the oscillator to restart and stabilize.
Table 2.2
PQFP/TQFP:
Immediate Addressing:
MOV A, #20h
Direct Addressing:
22
MOV A, 30h
This instruction will read the date out of Internal RAM address30
(hexadecimal) and store it in the Accumulator. Direct addressing is generally fast
since, although the value to be loaded isn’t included in the instruction, it is quickly
accessible since it is stored in the 8051’s Internal RAM. It is also much more
flexible than Immediate Addressing since the value to be loaded is whatever is
found at the given address-which may be variable.
The obvious question that may arise is, “If direct addressing an address
from 80h through FFh refers to SFRs, how can I access the upper 128 bytes of
Internal RAM that are available on the 8052?” The answer is:
You can’t access them using direct addressing. As stated, if you directly refer to
an address of 80h through FFh you will be referring to an SFR. However, you may
access the 8052’s upper 128 bytes of RAM by using the next addressing mode,
“indirect addressing.”
Indirect Addressing:
MOV A,@R0
This instructing causes the 8051 to analyze the value of the R0 register.
The 8051 will then load the accumulator with the value from Internal RAM which
is found at address indicated by R0. For example, let’s say R0 holds the value 40h
and Internal RAM address 40h holds the value 67h. When the above instruction is
executed the 8051 will check the value of R0. Since R0 holds 40h the 8051 will
get the value out of Internal RAM address 40h (which holds 67h) and store it in
the Accumulator. Thus, the Accumulator ends up holding 67h. Indirect never
refers to Internal RAM; it never refers to an SFR. Thus, in a prior example we
mentioned that SFr 99h can be used to write a value to the serial port. Thus one
23
may think that the following would be a valid solution to write the value’1’ to the
serial port:
This is not valid. Since indirect addressing always refers to Internal RAM
these two instructions would write the value 01h to Internal RAM address 99h on
an 8052. On an 8051 these two instructions would produce an undefined result
since the 8051 only has 128 btes of Internal RAM.
External Direct:
MOVXA,@DPTR
MOVX@DPTR,A
As you can see, both commands utilize DPTR. In these instructions, DPTR
must first be loaded with the address of external memory that you wish to read or
write. Once DPTR holds the correct external memory address, the first command
will move the contents of the external memory address into the Accumulator. The
second command will do the opposite: it will allow you to write the value of the
Accumulator to the external memory address pointed to by DPTR.
External Indirect:
MOVX@R0,A
24
Once again, the value of R0 is first read and the value of the Accumulator
is written to that address in External RAM. Since the value of @R0 can only be
00h through FFh the project would effectively be limited to 256 bytes of External
RAM.
Chapter-3
TECHNICAL ASPECTS
25
3.1 FUNCTIONAL DESCRIPTION OF THE RECEIVER MODEL
IR rays
Comman
Toggle Address Schmit
Output control
IR Sensor d Relay Output
check RC5 Decoder
checkingModule t module
Module checking Driver Module
module module Trigger
module
Control module
This block represents the Infra-red sensor which receives the modulated infra-
red rays coming from the remote control transmitter and demodulates and converts
it into an electrical signal for further processing of the information being
transmitted. The IR sensor used for this project is TSOP1738 from VISHAY
Semiconductors.
The Toggle checking module checks whether a key has been pressed on the
remote or not. The Address checking module and Command checking module
check for the valid addresses and command statements i.e. they collect the
decoded data into a 5-bit address and a 6-bit command format. The control
module ensures correct functionality among all the components.
The output control module is responsible for proper presentation of the output.
It comprises of the Schmitt trigger and Relay driver. For Schmitt trigger IC
74HC14 when the input is higher than a certain chosen threshold, the output is
high; when the input is below another (lower) chosen threshold, the output is low;
when the input is between the two, the output retains its value. The trigger is so
named because the output retains its value until the input changes sufficiently to
trigger a change. This dual threshold action is called hysteresis, and implies that
the Schmitt trigger has some memory.
The benefit of a Schmitt trigger over a circuit with only a single input
threshold is greater stability (noise immunity). With only one input threshold, a
noisy input signal near that threshold could cause the output to switch rapidly back
and forth from noise alone. A noisy Schmitt Trigger input signal near one
threshold can cause only one switch in output value, after which it would have to
move beyond the other threshold in order to cause another switch. A ULN2803 is
an Integrated Circuit (IC) chip with a High Voltage/High Current Darlington
Transistor Array which is ideally suited for interfacing between low-level logic
circuitry and multiple peripheral power loads. This relay driver IC is used to
switch different relays.
27
3.1.4 Output module:
28
29
30
3.2 OPERATION/WORKING:
The RC5 code set was developed by Phillips and allows 2048 commands to be
transmitted divided into 32 addressable groups of 64 commands each. The
transmitted code consists of a 14 bit data word of the following structure.
1 check bit
6 command bits.
The basic timing is derived from a 36KHZ oscillator. The code is transmitted in
bi-phase format. In this system, logic 1 is transmitted as a half bit time without signal,
followed by a half bit time with signal. Logic 0 has exactly the opposite structure. Each
half bit consists of 32 shorter pulses. Each transmitted bit has a length of 1.778 m sec; the
shorter pulses have a pulse width of 6.9444 u sec on time and 20.8332 u sec off time. A
complete data word has a length of 24.889 m sec, and is always transmitted completely. If
the key is held pressed the code is repeated in intervals of 64 bit times (i.e. 113.778 m
sec). The RC5 code thus, makes use of a fixed bit length and fixed quantity of bits. Each
bit is sliced in two halves. The left and right half has opposed levels. If the bit to be
transmitted is one (1), its left side is zero while its right side is one. If the bit to be
transmitted is zero (0), its left side is one while the right side is zero. This can be seen in
the Figure 3
|---+ |
| | |
| | |
| +---|
<----->
1.7778ms
Logic 0
| +---|
| | |
| | |
|---+ |
<----->
1.7778ms
Logic 1
31
OF OF OF
ON ON ON
F F F
Bit
time
Figure 3.3(b): (This is the right logic, reversed from what you can see at the IR
receiver output.)
It means that the second half of the bit is actually the same meaning of the bit to
be transmitted, as you can see at the shaded blue right side of the bit as on, means bit
transmitted = 1.To measure the correct logic level directly from the Receiver Output, one
should measure at the first half of the bit. The correct interpretation is that it changes level
exactly at the middle of bit time. At the IR Receiver output a bit Zero changes level from
Low to up, while a bit one changes level from Up to Low.
105
ms
ON ON FLIP OFF OFF OFF OFF OFF OFF OFF OFF OFF OFF OFF
Address Command
CHK 32
Figure 3.4: The 14 bits of the RC-5 system above.
The first two bits, #1 and #2, are called ACG calibration. They are "ON" level, and
serve to calibrate the IR Receivers Auto Gain Control.
In the Philips remotes, the bit #3 is the CHECK bit, every time a key is pressed at
the remote, even pressing repeatedly the same key, this bit flips state. This is an
interesting feature. Suppose number "1" is pressed at the remote (trying to select channel
15 at TV) and holding it for 2 seconds, and then the Infrared signal is blocked with the
hand. The TV would receive two trains of pulses, generated by hand breaking a long
train in two. Other systems would understand transmission of two keys "1" selecting
channel "11", but this do not happens in the Philips system. This bit flips state every
time a key is pressed, so blocking the signal with hand doesn't change this bit, so the TV
will understand that still the same key pressed. To select channel "11" key "1" needs to
be pressed really twice.
The next 5 bits, #4 to #8, are used for SYSTEM ADDRESS, or to identify which
kind of device should execute the COMMAND bits. For example, TV set uses
ADDRESS ZERO. Bit #8 is the Less Significant Bit.
The next 6 bits, #9 to #14, are used for COMMAND information to the device
selected at the ADDRESS bits. Bit #14 is the LESS SIGNIFICANT BIT, and it is last
transmitted.
The project uses Atmel micro-controller AT89C51 to receive the infrared signal
from the Philips remote. It is interesting to note that the Infrared Receiver inverts the bit
signal, low level means bit ON. During inactivity (no Infrared present) the output of the
Infrared receiver is UP (bit zero).
33
The output of the infrared sensor module may be connected to any port pin of the
microcontroller or interrupt pin of the microcontroller, and keep polling it or prepare the
interrupt routine to trigger your reading after the first low level sensed.
When a key is pressed at the remote, it transmits the train of pulses, and
microcontroller receives bit #1 first. It will be sensed right after the middle of the bit
when it changes from high to low level to means bit "1". This is the first time that the
microcontroller will "see" the incoming IR signal.
Upon sensing the first low level, indicating the presence of a bit the
microcontroller needs to be programmed so as to wait for 3.024 ms so as to detect the flip
bit. To read the address and command bits which happen to be the next 11 bits of the
received signal shift them left into a register and store the old and new commands. In this
application the microcontroller has been programmed in assembly language. However,
the microcontroller may even be programmed using embedded C and Basscom which
reduces the size of the code so that it can be well accommodated in the limited on-chip
memory of the microcontroller.
The address is decoded to determine the equipment type. The address for Philips
remote should correspond to ‘00’. However, that is a code 10 at the universal
programmable remote, because of the detection circuit waiting for a falling edge. There
are addresses associated with other devices as shown in the table.
Addre Equipment
ss
0 Television
2 Tele text
5 Vedeo recorder
7 Experimantal
16 Preamplifier
17 Receiver/tuner
18 Tape/cassette
recorder
19 experimental
34
The infrared receiver unit contains 8 relays that can be controlled by wireless. This
makes the unit very easy to operate and integrate with existing systems. Keys 1 to 8 on
the remote control operate the corresponding relay on the receiver printed circuit board,
i.e. button 1 operates relay 1, button 2 operates relay 2, etc. Relay contact can control any
equipment in momentary mode (On till key pressed) or Latch Mode (Toggle on each key
press). Each relay has indicator LED showing current status.
The entire working of the infrared remote control receiver printed circuit board
designed and developed for decoding RC5 pulse protocol used in Philips television may
be summarized as stated below:
STEP 1: START
STEP 5: Reset all relays i.e. turn all output switches off initially
STEP 6: CHECK if Infrared signal is received i.e. check if key is pressed on the
remote
STEP 12: Rotate left through C and store the result in accumulator
STEP 36: Check command for all switches, IF true reset all switches
START
Define variables
IS
P3.3
=0
Generate delay
Move P3.3 to C
Copy C to Flip
Clear C
37
Clear ACC.
X
X
Move 5 to count
Generate delay
RLC A
Count= count - 1
Is
coun
t= 0
Copy A to ADDR
Clear A
38
Y
Y
Move 6 to count
Generate delay
Read P3.3 to C
RLC A
Count= count - 1
Is
cou
nt =
0
YES
Z
40
Z
Move ADDR to A
Is
A= NO START
0
YES
Set A = TEMP
Is
A= Invalid
comman START
CM
d
DD
Clear A
Set C=FLIP
RLC A
41
P
P
Set TEMP=A
Clear A
Set C=TOG
RLC A
Is A!
=TE NO START
MP
YES
TOG=FLIP
Is
A= Set SW1
START
CM high/low
DD
42
Q
43
Q
Is
A= Set SW2
START
CM high/low
DD
Is
A= Set SW3
START
CM high/low
DD
Is
A= Set SW4
START
CM high/low
DD
Is
A= Set SW5
START
CM high/low
DD
Is
A= Set SW6
START
CM high/low
DD
R
44
R
Is
A= Set SW7
START
CM high/low
DD
Is
A= Set SW8
START
CM high/low
DD
STOP 45
Figure 3.5: Flowchart
Chapter-4
46
DESIGN AND DEVELOPMENT
4.1 INTRODUCTION:
The designing of the project forms the major portion of the project. In the
designing of the project we had to pass through many macro phases. The designing part
broadly consists of writing the program, burning the program in the microcontroller and
the fabrication of the chip. The program is given in the appendix.
The hardware projects often require the use of strip boards or other pre-fabricated
boards for the implementation of the circuit. However, solder less breadboards are the
fastest and most flexible way to design and experiment. The printed circuit boards
provide for efficient and effective solution to the complexities encountered while using
other boards for circuit realization.
The following steps were used for developing the printed circuit board for this
application:
1) Designing the artwork: The first thing to do is to make the schematic of the circuit
to be realized. This is also known as the artwork. The schematic may be drawn
using PCB CAD layout programs. The Orcad 9.1 suite may be used for drawing
the schematic but it is expensive. The freely available and easy to use software
ExpressPCB was used for designing the schematic.
The ExpressPCB online help is written with beginners in mind, the internet
ordering option is convenient, and its regular updated features was the motivation
behind using this software though it has limited component library. The layout of
the circuit as drawn using ExpressPCB is as shown in Figure 1.
47
Figure 4.1: PCB layout
2) Print out the layout on transparency film. The printer must be of Laser type that
uses toner as the printing method.
3) Cut a blank copper plate to the same dimensions as the artwork. The plate is
polished properly so that the toner is transferred effectively onto it.
4) Now, the paper with the artwork is placed face down onto the copper plate and put
tape over it and place again A4 size paper over the transparency film.
5) Put the pcb into lamination machine around 240 c temp for transfer of toner image
from transparency film into pcb.
48
6) The copper plate with design stuck onto it is now immersed in soap solution for
almost 20 minutes to loosen the paper.
7) Carefully remove the paper. Be sure not to remove any of the black ink traces
because these are what stop the acid in the etching process. A kind of rubbing
motion was used to remove the paper. Keep the paper wet all the time so that it
separates easily from the copper board.
8) Etch the board using a solution of Ammonium Per sulphate. Proper instructions
for the dilution level should be followed. A normal ceramic or glass bowl can be
used as a tank for carrying out the etching.
9) Slowly swirl or rock the bowl around. The liquid must be always moving over the
copper board to get it to etch properly.
10) Remove the board from the etchant and wash any residue from the board.
13) Mount the components at their respective positions and solder them properly.
Following the above mentioned steps the Printed circuit board for this application was
developed.
49
Chapter-5
COMPONENT DETAILS
5.1 INTRODUCTION:
50
The most common device used for detecting light energy is a photodiode. A
photodiode is similar in many ways to a standard diode, with the exception of its
packaging. A photodiode is packaged in such a way as to allow light to strike the PN
junction.
The TSOP 17 series are miniaturized receivers for infrared remote control systems. PIN
diode and preamplifiers are assembled on lead frame. The epoxy package is designed as
IR filter.
Features
51
• Output active low.
Crystal oscillators are usually, fixed frequency oscillators where stability and
accuracy are the primary considerations. For example it is almost impossible to design a
stable and accurate LC oscillator for the upper HF and higher frequencies without
resorting to some sort of crystal control. Hence, the reason for using crystal oscillators.
Operation
A crystal is a solid in which the constituent atoms, molecules, or ions are packed
in a regularly ordered, repeating pattern extending in all three spatial dimensions.
Almost any object made of an elastic material could be used like a crystal, with
appropriate transducers, since all objects have natural resonant frequencies of vibration.
The resonant frequency depends on size, shape, elasticity, and the speed of sound in the
material.
52
When a crystal of quartz is properly cut and mounted, it can be made to distort in
an electric field by applying a voltage to an electrode near or on the crystal. This property
is known as piezoelectricity. When the field is removed, the quartz will generate an
electric field as it returns to its previous shape, and this can generate a voltage. The result
is that a quartz crystal behaves like a circuit composed of an inductor, capacitor and
resistor, with a precise resonant frequency.
Quartz has the further advantage that its elastic constants and its size change in
such a way that the frequency dependence on temperature can be very low. The specific
characteristics will depend on the mode of vibration and the angle at which the quartz is
cut (relative to its crystallographic axes).[5] Therefore, the resonant frequency of the plate,
which depends on its size, will not change much, either. This means that a quartz clock,
filter or oscillator will remain accurate. For critical applications the quartz oscillator is
mounted in a temperature-controlled container, called a crystal oven, and can also be
mounted on shock absorbers to prevent perturbation by external mechanical vibrations.
Quartz timing crystals are manufactured for frequencies from a few tens of
kilohertz to tens of megahertz. More than two billion (2×109) crystals are manufactured
annually. Most are small devices for consumer devices such as wristwatches, clocks,
radios, computers, and cell phones. Quartz crystals are also found inside test and
measurement equipment, such as counters, signal generators, and oscilloscopes.
Voltage regulators are very robust. These can withstand over-current draw due to
short circuits and also over-heating. In both cases, the regulator will cut off before any
damage occurs. The only way to destroy a regulator is to apply reverse voltage to its
input. Reverse polarity destroys the regulator almost instantly.
53
2. Shunt regulator (switching regulator)
Series regulator
Shunt regulator
IC Voltage Regulator
54
IC voltage regulators are versatile and relatively inexpensive and are available
with features such as programmable output, current/voltage boosting, internal short circuit
current limiting, thermal shutdown and floating operation for high voltage applications.
Characteristics:
The IC regulators not only keep the output voltage constant but also reduce the
amount of ripple voltage.
5.2.4 Relays:
A relay is an electrical switch that opens and closes under the control of another
electrical circuit. In the original form, the switch is operated by an electromagnet to open
or close one or many sets of contacts. It was invented by Joseph Henry in 1835. Because a
relay is able to control an output circuit of higher power than the input circuit, it can be
considered to be, in a broad sense, a form of an electrical amplifier.
Relays allow one circuit to switch a second circuit which can be completely
separate from the first. For example a low voltage battery circuit can use a relay to switch
a 230V AC mains circuit. There is no electrical connection inside the relay between the
two circuits; the link is magnetic and mechanical.
The coil of a relay passes a relatively large current, typically 30mA for a 12V
relay, but it can be as much as 100mA for relays designed to operate from lower voltages.
56
Most ICs (chips) cannot provide this current and a transistor is usually used to amplify the
small IC current to the larger value required for the relay coil. The maximum output
current for the popular 555 timer IC is 200mA so these devices can supply relay coils
directly without amplification.
The relay's switch connections are usually labeled COM, NC and NO:
• COM = Common, always connect to this; it is the moving part of the switch.
• NC = Normally Closed, COM is connected to this when the relay coil is off.
• NO = Normally Open, COM is connected to this when the relay coil is on.
• Connect to COM and NO if you want the switched circuit to be on when the
relay coil is on.
• Connect to COM and NC if you want the switched circuit to be on when the
relay coil is off.
A simple electromagnetic relay, such as the one taken from a car in the figure, is
an adaptation of an electromagnet. It consists of a coil of wire surrounding a soft iron
core, an iron yoke, which provides a low reluctance path for magnetic flux, a moveable
iron armature, and a set, or sets, of contacts; two in the relay pictured. The armature is
hinged to the yoke and mechanically linked to a moving contact or contacts. It is held in
place by a spring so that when the relay is de-energized there is an air gap in the magnetic
circuit. In this condition, one of the two sets of contacts in the relay pictured is closed,
57
and the other set is open. Other relays may have more or fewer sets of contacts depending
on their function. The relay in the picture also has a wire connecting the armature to the
yoke. This ensures continuity of the circuit between the moving contacts on the armature,
and the circuit track on the Printed Circuit Board (PCB) via the yoke, which is soldered to
the PCB.
When an electric current is passed through the coil, the resulting magnetic field
attracts the armature and the consequent movement of the movable contact or contacts
either makes or breaks a connection with a fixed contact. If the set of contacts was closed
when the relay was de-energized, then the movement opens the contacts and breaks the
connection, and vice versa if the contacts were open. When the current to the coil is
switched off, the armature is returned by a force, approximately half as strong as the
magnetic force, to its relaxed position. Usually this force is provided by a spring, but
gravity is also used commonly in industrial motor starters. Most relays are manufactured
to operate quickly. In a low voltage application, this is to reduce noise. In a high voltage
or high current application, this is to reduce arcing.
If the coil is energized with DC, a diode is frequently installed across the coil, to
dissipate the energy from the collapsing magnetic field at deactivation, which would
otherwise generate a voltage spike dangerous to circuit components. Some automotive
relays already include that diode inside the relay case. Alternatively a contact protection
network, consisting of a capacitor and resistor in series, may absorb the surge. If the coil
is designed to be energized with AC, a small copper ring can be crimped to the end of the
solenoid. This "shading ring" creates a small out-of-phase current, which increases the
minimum pull on the armature during the AC cycle. By analogy with the functions of the
original electromagnetic device, a solid-state relay is made with a thyristor or other solid-
state switching device. To achieve electrical isolation an optocoupler can be used which is
a light-emitting diode (LED) coupled with a photo transistor.
When the input is higher than a certain chosen threshold, the output is high; when
the input is below another (lower) chosen threshold, the output is low; when the input is
58
between the two, the output retains its value. The trigger is so named because the output
retains its value until the input changes sufficiently to trigger a change. This dual
threshold action is called hysteresis, and implies that the Schmitt trigger has some
memory.
The benefit of a Schmitt trigger over a circuit with only a single input threshold is
greater stability (noise immunity). With only one input threshold, a noisy input signal
near that threshold could cause the output to switch rapidly back and forth from noise
alone. A noisy Schmitt Trigger input signal near one threshold can cause only one switch
in output value, after which it would have to move beyond the other threshold in order to
cause another switch.
The Schmitt trigger was invented by US scientist Otto H. Schmitt in 1934 while
he was still a graduate student, later described in his doctoral dissertation (1937) as a
"thermionic trigger". It was a direct result of Schmitt's study of nerve propagation in squid
nerves.
The symbol for Schmitt triggers in circuit diagrams is a triangle with a hysteresis
symbol. The symbol depicts a typical hysteresis curve.
When the Schmitt trigger is inverting (i.e., when very negative inputs lead to
positive outputs and vice versa), the hysteresis symbol is top–bottom mirrored.
Schmitt triggers are typically built around comparators, connected to have positive
feedback instead of the usual negative feedback. For this circuit the switching occurs near
ground, with the amount of hysteresis controlled by the resistances of R1 and R2:
59
Figure 5.7 Circuit diagram of Schmitt Trigger
The comparator gives out the highest voltage it can, +VS, when the non-inverting
(+) input is at a higher voltage than the inverting (-) input, and then switches to the lowest
output voltage it can, −VS, when the positive input drops below the negative input. For
very negative inputs, the output will be low, and for very positive inputs, the output will
be high, and so this is an implementation of a "non-inverting" Schmitt trigger.
For instance, if the Schmitt trigger is currently in the high state, the output will be
at the positive power supply rail (+VS). V+ is then a voltage divider between Vin and +VS.
The comparator will switch when V+=0 (ground). Current conservation shows that this
requires
Vin/R1 = −VS/R2,
And so Vin must drop below −(R1/R2)VS to get the output to switch. Once the
comparator output has switched to −VS, the threshold becomes +(R1/R2)VS to switch back
to high.
60
So this circuit creates a switching band centred around zero, with trigger levels ±
(R1/R2)VS. The input voltage must rise above the top of the band, and then below the
bottom of the band, for the output to switch on and then back off. If R1 is zero or R2 is
infinity (i.e., an open circuit), the band collapses to zero width, and it behaves as a
standard comparator. The output characteristic is shown in the picture on the right. The
value of the threshold T is given by (R1/R2)VS and the maximum value of the output M is
the power supply rail.
Each circuit functions as an inverter, but because of the Schmitt action, it has
different input threshold levels for positive-going (VT+) and negative-going (VT–)
signals.
These circuits are temperature compensated and can be triggered from the slowest
of input ramps and still give clean, jitter-free output signals.
The M74HC14 is an high speed CMOS HEX Schmitt inverter fabricated with
silicon gate C2mos technology. All inputs have 20% Vcc hysteresis level. This, together
with its Schmitt trigger function, allows it to be used on line receivers with slow rise/fall
input signals.
All inputs are equipped with protection circuits against static discharge and
transient excess voltage.
Light emitting diodes are small but powerful devices in terms of their diverse
applications. LED lights assume greater significance in the context of need for electrical
energy conservation and pollution control world over. These are used as indicators in
various equipments for lighting and decorations at homes, and in flashlights, signboards
and car lights.
LED lights differ from traditional light sources in the way these produce light. In
incandescent bulbs, a tungsten filament is heated by electric current until it glows or emits
light.
On the other hand, LEDs are diodes made from semiconductor materials. This is
why these are referred to as solid state devices. They rely on indium-gallium nitride to
convert electricity into photons when current flows through it.
An LED is basically a small area source, often with extra optics added to the chip
that shapes its radiation pattern. The specific wavelength or color emitted by the LED
depends on the materials used to make the diode. It depends on the composition and
62
condition of the semiconducting material used, and can be infrared, visible or near-
ultraviolet.
Light generates inside the semiconductor chip when current flows across the
junction of different material compositions. An LED consists of two elements of
processed semiconductor material called p-type and n-type semiconductors. These two
elements form a p-n junction when placed in contact with each other. The material
composition of the p- and n-type semiconductors determines the color of light generated.
LED structure
To achieve a high radiance and high quantum efficiency, the LED structure must
provide a means of confining the charge carriers and the stimulated optical emission to
the active region of the p-n junction where radiative recombination takes place. Carrier
confinement is used to achieve a high level of radiative recombination in the active region
of the device, which yields high quantum efficiency. Optical confinement is of
importance for preventing absorption of the emitted radiation by the material surrounding
the p-n junction.
By means of this sandwich structure of differently composed alloy layers, both the
carriers and the optical field are confined in the central active layer. The band gap
differences of adjacent layers confine the charge carriers, while the difference in the
indices of refraction of adjoining layers confine the optical field to the central active
layer. This dual confinement leads to both high efficiency and high radiance.
63
LEDs are usually built on an n-type substrate, with an electrode attached to the p-
type layer deposited on its surface.
Most materials used for LED production have very high refractive indices. This
means most of the light reflects back into the material at the material/air interface.
Therefore light extraction is an important aspect of LED design and production.
1. Lifetime: As a solid state light source, LEDs have a very long lifetime and are
generally very robust due to no mechanical or moving parts. Good quality LEDs
can last up to 50,000hrs- more than five years of continuous use.
2. Low maintenance: The long lifetime of LEDs reduces the need to replace failed
lamps, and this can lead to significant financial and environmental savings.
5. Brightness: Light outputs of LEDs are constantly being increased, and there are
several products that have higher lumen output than traditional lighting.
6. Heat: Almost 80% of the energy consumed by LEDs is converted into light and
only some of it’s dissipated as heat.
7. Small form factor: LEDs are very small. Typically, high brightness LED chips
measure 0.3*0.3mm2.
64
8. Instantaneous switch on: LEDs switch on rapidly, even when cold, and this is a
particular advantage for certain applications such as vehicle brake lights.
9. Color: LEDs are available in a broad range of brilliant, saturated colors. White
devices are also available.
Also LED lights are shock resistance, and a solid package of the LEDs can be
designed to focus their light.
65
Chapter-6
RESULT
6.1 CONCLUSION:
The project is done as the final assignment of the under graduate program. This
project has given as an opportunity to sharpen our edges in the technical field. The
working of this project had passed through various ups and downs. Many a times it
became very difficult to progress but the constant support of the mentor made it possible
to complete the project to the requirement.
This project makes the communication possible with the use of infrared rays. We
have developed Philips TV receiver. The transmitter part is contained inside the remote
which is used and the receiver part is placed in the switch board.
While designing the project we have faced many problems especially while
programming the microcontroller. But the biggest hurdle was of tuning the IR transmitter
and the receiver, and the coding part. The range up to which receiver can receive the IR
rays is experimentally found to be 33 feet.
Another problem is that of the relays. In order to operate high power points we
need heavy relays which can alternately damage the microcontroller. So we have used
small relays in order to operate the simple switches.
At the epitome we would like to state that although the project is not flawless, but
undoubtedly we achieved to make the concept of the project clear. From the project one
can come to know how the RC pulse protocol based remote works. As per our knowledge
and hard work we succeeded in achieving the aim of the project.
66
APPENDIX-A
VAR1 equ r7
IR equ p3.2
67
SW7 equ p2.1
Swport equ p2
org 00H
mov swport,#0FFH
mov sp,#50H
clr TOG
main:
jb IR,$
mov c,IR
mov p0.o,c
mov VAR1,#255
djnz VAR1,$
mov VAR1,#255
djnz VAR1,#$
mov VAR1,#255
djnz VAR1,$
mov VAR1,#255
djnz VAR1,$
mov VAR1,#255
djnz VAR1,$
68
mov VAR1,#100
djnz VAR1,$
mov c,IR
mov p0.7,c
mov FLIP,c
clr A
mov COUNT,#5
fadd:
mov VAR1,#255
djnz VAR1,$
mov VAR1,#255
djnz VAR1,$
mov VAR1,#255
djnz VAR1,$
mov VAR1,#140
djnz VAR1,$
mov c,IR
rlc a
djnz COUNT,fadd
mov ADDR,A
clr a
mov COUNT,#6
fcmd:
69
mov VAR1,#255
djnz VAR1,$
mov VAR1,#255
djnz VAR1,$
mov VAR1,#255
djnz VAR1,$
mov VAR1,#140
djnz VAR1,$
mov c,IR
rlc a
djnz COUNT,fcmd
mov TEMP,CMD
mov CMD,a
mov a,ADDR
cjne a,CMD,valid
nvalid:
ljmp main
valid:
clr a
mov c,FLIP
rlc a
mov TEMP,a
clr a
70
mov c,TOG
rlc a
cjne a,TEMP,valid1
sjmp nvalid
valid1:
mov c,FLIP
mov TOG,c
mov a,CMD
clr c
cjne a,#1,skip1
jb sw1,isset1
setb sw1
ljmp main
isset:
clr sw1
ljmp main
skip1:
cjne a,#2,skip2
jb sw2,isset2
setb sw2
ljmp main
isset2:
clr sw2
71
ljmp main
skip2:
cjne a,#3,skip3
jb sw3,isset3
setb sw3
ljmp main
isset3:
clr sw3
ljmp main
skip3:
cjne a,#4,skip4
jb sw4,isset4
setb sw4
ljmp main
isset4:
clr sw4
ljmp main
skip4:
cjne a,#5,skip5
jb sw5,isset5
setb sw5
ljmp main
isset5:
72
clr sw5
ljmp main
skip5:
cjne a,#6,skip6
jb sw6,isset6
setb sw6
ljmp main
isset6:
clr sw6
ljmp main
skip6:
cjne a,#7,skip7
jb sw7,isset7
setb sw7
ljmp main
isset7:
clr sw7
ljmp main
skip7:
cjne a,#8,skip8
jb sw8,isset8
setb sw8
ljmp main
73
isset8:
clr sw8
ljmp main
skip8:
cjne a,#0cH,exit
mov swport,#00H
ljmp main
exit:
ljmp main
END
APPENDIX-B
74
75
76
77
78
79
80
81
82
83
84
APPENDIX-C
TSOP-1738
85
86
87
88
89
90
91
92
REFERENCES
[1] Muhammad Ali Mazidi, Janice Gillispie Mazidi, Rolin D. McKinlay, “The 8051
Microcontroller and Embedded Systems Using Assembly and C”, Prentice Hall, Edition
2008
[5] Marcus O. Durham, “Systems Designs and the 8051”, Techno press, second edition
[6] Sunil S. Rao, “Switchgear protection and power systems”, Khanna publishers, 11th
edition
[7] D. R. Choudhary, “Linear Integrated Circuits”, New Age International Publishers, 2nd
edition
[8] Wikipedia.org
94