Professional Documents
Culture Documents
C
DOKUZ EYLUL UNIVERSITY
ENGINEERING FACULTY
ELECTRICAL & ELECTRONICS
ENGINEERING DEPARTMENT
VOLKAN DENİZ
Adviser
JUNE 2009
İZMİR
PROJECT EXAMINATION RESULT FORM
We certify that we have read this project and that in our opinion it is fully
adequate, in scope and in quality, as a senior project.
………………………………………….
………………………………………….
………………………………………….
Assist. Prof. Dr. Özge Şahin
(Committee Member)
………………………………………….
2
(Chairman)
ACKNOWLEDGEMENTS
I would like to thank my advisor, Asst. Prof. Dr. Olcay Akay for his help in
guidance and supervision during this project.
I would like to specifically thank Asst. Prof. Dr. Nalan Özkurt for her
valuable advice and help during the project.
I also would like to thank GRUNDIG A.Ş. for their guidance and advice.
I would like to thank my friend Ahmet Tekin for being with me during
realization of this final year project.
I also would like to thank Mert Özuysal, Nejdet Tayyar Irgaç, Arif Ataman
and Osman Tayfun Bişkin for helps in critical situations.
3
ABSTRACT
The aim of this project is to control the VCD player and heater by using a PC
interface. PC sends the data to microcontroller via Wi-Fi and the microcontroller
controlls the VCD player with infrared (IR) communication.
While all IR remote controls share the basic concept of communicating from
the remote control to the home entertainment device via IR signal, there is no
universal standard for the encoding method. All IR remote control systems use IR
light-emitting diodes (LEDs) to send out an IR signal in response to button pushes.
The pattern of pulses indicates the particular button pushed. To allow control of
multiple appliances such as a TV, DVD Player, air conditioner and cable box without
interference, systems generally have a preamble and address to synchronize the
receiver and identify the source (and destination) of the infrared signal. Some of the
earliest remote controls (and to this day a few cable box remote controls) use a
simple system in which the IR LED is simply turned on and off. However, to avoid
interference by other light sources, especially flourescent bulbs, and keep the signal
from being swamped out by ambient light, most systems digitally modulate a carrier
frequency of between 36 kHz and 40 kHz. A bandpass filter in the receiving unit
eliminates all but the desired frequency.
4
ÖZET
5
CONTENTS
CONTENTS.............................................................................................6
LIST OF FIGURES………………………...……………………….....8
Chapter 1. INTRODUCTION….....................................................9
Chapter 2. THEORETICAL FOUNDATIONS INFRARED (IR)
RADIATION…………...………………….…………………………..10
2.1.Infrared Lights……………..................................................10
2.2.IR Remote Controllers.…………....……………………….10
Chapter 3. HARDWARE DESIGN……………………………...13
3.1.Proteus Design………...……………………………………13
3.2.Receiver……...………...……………………………………14
3.3.PIC16F877..……………………………………...…………15
3.3.1 Features…………………………………………………...15
3.4.Transmitter and Timer ……….……………………...……17
3.5.Linear Regulator (7805)…………………………………...19
Chapter 4. SOFTWARE DESIGN…..……………………..…...20
4.1 Software Design of VCD Player …………………………..21
4.1.1 Features…..………………………………………...21
4.2. Software Design of Heater………………………...………22
4.2.1 Features…...………………………………………..22
4.3 PC INTERFACE……………………………………...……24
6
Chapter 5. WIRELESS MODULE………………………………25
5.1.Features……………………………………………………..25
5.2.General Description ……………………………………….25
5.3.Hardware …………………………………………………..26
5.4.Performance Specifications………………………………..27
5.5.Configuration……………………………………………….27
Chapter 6. RESULTS and CONCLUSION…................................29
REFERENCES .....................................................................................31
7
LIST OF FIGURES
8
Chapter 1
INTRODUCTION
In this project we study infrared (IR) receiver and transmitter and also
protocols of remote controllers. The remote controller is controlled with PIC16F877.
With most pieces of consumer electronics, from camcorders to stereo equipment, an
infrared remote control is usually always included.Video and audio apparatus,
computers and also lighting installations nowadays often operate on IR remote
control.The carrier frequency of such IR signals is typically in the order of around 36
kHz. The control codes are sent in serial format modulated to 36 kHz carrier
frequecy (usally by turning the carrier on and off).There are many different coding
systems in use, and generally different manufacturers use different codes and
different datarates for transmission. Infrared light is invisible since its frequency is
below that of visible red. Otherwise, it is like any other light source, operating under
the same laws of physics. In most cases, the IR signals are produced by a LED
source. TV remotes send commands only one way, in a low-speed burst for distances
of up to 30 feet. They use directed IR with LEDs that have a moderate cone angle to
improve ease-of-use characteristics. The IR signal sent out by those devices is
generally modulated to around 38 kHz carrier using amplitude shift keying (carrier
on or off). The data rate send is generally in the range of 100-2000 bps.
9
Chapter 2
THEORETICAL FOUNDATIONS INFRARED (IR)
RADIATION
10
IR is interesting, because it is easily generated and does not suffer
electromagnetic interference, so it is nicely used for communication and control,
however it is not perfect, some other light emissions could contain IR as well, and
that can interfere in this communication. The sun is an example, since it emits a wide
spectrum of radiation. Lots of things can generate IR, anything that radiate heat do it,
including our body, lamp, stove, oven, car's engine, car's tires, hot asphalt and rocks,
plants, even the hot water at the faucet. The massive use of IR LEDs at TV/VCR
remote controls and other applications, brought IR diodes and transistors (emitter and
receivers) at very low cost at the market. To allow a good communication using IR,
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 generated by the surrounding
environment. As an analogy, looking eye naked to the night sky we can see hundreds
of stars, but we can spot easily a far away airplane just by its flashing strobe light,
even if that blinking light is dimmer than the stars’ lights. That strobe light is the
"key", the "coding" element that alerts us.
Similar to the airplane at the night sky, the room where the TV is installed
may have hundreds of tiny IR sources, our body, 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. Thus, remote controls use to pulsate its infrared in a certain frequency. The
IR receiver module at the TV, VCR or stereo "tunes" to this certain frequency and
ignores all other IR signals received. The best frequency for the job is between 30
and 60 kHz, the most used is around 36 kHz. It works exactly as a radio tuning to a
specific station. In this case, the receiver tunes to the IR "radio" at 36 kHz, and
ignores the rest. Your cup of hot tea generates IR, but not at 36 kHz, it is flat and
plain IR emission, and then, ignored by the TV IR receiver. Therefore, remote
controls use the 36 kHz (or around) to transmit information. IR 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 IR is quite easy, more difficult is
to receive and identify this frequency. This is why some companies produce IR
receivers, that contains the filters, decoding circuits and the output shaper, that
delivers a square wave, meaning the existence or not of the 36kHz incoming
11
pulsating infrared. It means that those 3 dollars small units, have an output pin that
goes high (+5V) when there is a pulsating 36 kHz IR in front of it, and zero volts
when there is not this radiation. A square wave of approximately 27 uS
(microseconds) injected at the base of a transistor, can drive an IR LED to transmit
this pulsating light wave. Upon its presence, the commercial receiver will switch its
output to high level (+5V).
If we can turn on and off this frequency at the transmitter, our receiver's
output will indicate when the transmitter is on or off.
12
Chapter 3
HARDWARE DESIGN
+5V
C5
R2
100R
22p U3
R R1
V1
8
X1
4 3 POT
+5V CR YSTAL R Q
VCC
C6 C4 1k D4
13 33 7 DIOD E -LED
OSC 1/CLK IN R B0/IN T DC
14 34
OSC 2/CLK OUT RB1
1 35 5
MC LR /V pp/THV RB2 CV
22p
R B3/PGM
36 100n Q1
2 37 B C337
10k RA 0/AN0 RB4 R V2
3 38
RA 1/AN1 RB5
G ND
4 39 2 6 POT
RA 2/AN 2/VREF- RB 6/PGC TR TH
5 40
RA 3/AN 3/VREF+ RB 7/PGD
6
RA 4/T0C KI
7 15
1
N E 555
RA 5/AN 4/SS R C 0/T1OS O/T1C K I
16
R C 1/T1O S I/CC P2
8
RE 0/AN 5/RD R C 2/C CP1
17 C9
9 18 100n
RE 1/AN6/W R R C 3/S C K/SCL
10 23
RE 2/AN 7/CS R C 4/SDI/SDA
24
R C 5/S DO
25
R C6/TX /CK
26
R C 7/R X /DT
19 C 10
R D 0/PSP0
20
R D 1/PSP1
21 J1
R D 2/PSP2
22 1u 1
R D 3/PSP3
27 6
R D 4/PSP4
28 2
R D 5/PSP5
29 7
R D 6/PSP6
30 3
R D 7/PSP7
1 3 U2 8
P IC 16F877 4
9
C1+ C1- +5V
5
11 14
12
T1IN T1OUT
13 C1 C ONN -D 9F
R 1OU T R 1IN
10 7
T2IN T2OUT
9 8
R 2OU T R 2IN
1u
2 C2
VS+
6
V S-
1u
C2+ C2-
4 C9 5 MA X232
1u
13
Figure 3.1:Circuit diagram of our design using PIC16F877.
3.2 Receiver
When we start to the project, we did not know what we would send to VCD
player and heater. To solve this problem, we set a receiver circuit and learned all
necessary informations (command code, data codes etc.) Protocols are not important
for receiver circuit because timing of the data can be found with this circuit.
We found the protocol types and received data for the appliances. VCD player works
with NEC protocol and heater works with another protocol which has 13 bits.
14
Figure 3.3: Received signals.
3.3. PIC16F877
All the necessary support components are included, together with a Power
and Programming LED for easy status indication. Plus a reset switch for program
execution and a RS232 connection for data transfer to and from a standard RS232
port, available on most computers.
The new PIC16F877 Controller is the ideal solution for use as a standard
controller in many applications. The small compact size combined with easy
program updates and modifications, make it ideal for use in machinery and control
systems, such as alarms, card readers, real-time monitoring applications and much
more. This board is ideal as the brains of your robot or at the center of your home-
monitoring system. Save time and money, by simply building your ancillary boards
and monitoring circuits around this inexpensive and easy to use controller.
3.3.1 Features
15
• Up to 28 I/O points with easy to connect standard headers
• RS232 Connection with MAX232
• Internal EEPROM
• 8 Channel 10-bit A/D Convertor
• One 16-bit Timer with Two 8-bit Timers
• Power and Programming LED
• Reset Button
• Ideal as an Interchangeable Controller for Real-Time Systems
16
RA0-5 : Input/Output port A MCLR : Master Clear ( Active low Reset )
RB0-7 : Input/Output port B Vpp : Programming voltage input
RC0-7 : Input/Output port C THV : High voltage test mode control
RD0-7 : Input/Output port D VREF+/- : Reference voltage
RE0-2 : Input/Output port E SS : Slave select for the synchronous
AN0-7 : Analog input port serial port
RX : USART Asynchronous Receive T0CKI : Clock input to Timer0
TX : USART Asynchronous T1OSO : Timer1 oscillator output
Transmit T1OSI : Timer1 oscillator input
SCK : Synchronous serial clock input T1CKI : Clock input to Timer1
SCL : Output for both SPI and I2C PGD : Serial programming data
modes PGC : Serial programming clock
DT : Synchronous Data PGM : Low voltage programinng input
CK : Synchronous Clock INT : External interrupt
SDO : SPI Data Out ( SPI mode ) RD : Read control for the parallel slave
SDI : SPI Data In ( SPI mode ) port
SDA : Data I/O ( I2C mode ) WR : Write control for the parallel slave
CCP1,2 : Capture In/Compare Out/PWM port
Out CS : Select control for the parallel slave
OSC1/CLKIN : Oscillator In/Ecternal Clock In PSP0-7 : Parallel slave port
OSC2/CLKOUT : Oscillator Out/Clock Out VDD : Positive supply for logic and I/O pins
Vss : Ground reference for logic and I/O
pins
To transmit the stored signal, we should generate a 38-40 KHz square wave
carrier signal to protect from other IR interferances. We used 555 Timer to generate
the carrier wave and modulation. We built the circuit in Figure 3.7. With
potentiometer, we are able to control the duty cycle and frequency of the carrier
wave. The 555 Timer modulates any signal which is applied from its 4th pin and
outputs the modulated signal from its 3rd pin.
17
Figure 3.6: The transmitter circuit. Figure 3.7: Carrier signal (38 Khz).
18
In electronics, a linear regulator is a voltage regulator based on an active
device operating in its ’linear region.’ All linear regulators require an input voltage at
least some minimum amount higher than the desired output voltage. That minimum
amount is called the drop-out voltage. For example, a common regultor such as 7805
(Figure 3.10) has an output voltage of 5V. Its drop-out voltage is 2V. Its minimum
input voltage will be 7V.
Chapter 4
19
SOFTWARE DESIGN
Not all the IR remote controls have similar characteristics; in fact most of
them have different frequency carriers depending of the factory, or the model or the
protocol. Another point to consider is that depending on the trademark or model, it
can be seen a considerable difference in the total amount of bits which is transmitted
after switch is pressed. We could say that RC5 and NEC codes are important for the
system, which are generally employed in most of IR remote controls.
Three functions are created for the system. They are one,zero and toggle to
give microprocessor 1, 0 and toogle bits.
-‘This part is explained detailly Ahmet Tekin’s final year project’.
20
4.1 Software Design of VCD Player
4.1.1 Features:
The NEC protocol uses pulse distance encoding of the bits. Each pulse is a
560µs long 38kHz carrier burst (about 21 cycles). A logical "1" takes 2.25ms to
transmit, while a logical "0" is only half of that, being 1.125ms. The recommended
carrier duty-cycle is 1/4 or 1/3.
21
Inv.Command
Button Address bits Inv. Address bits Command bit
bits
STOP 00000000 11111111 00101000 11010111
PAUSE 00000000 11111111 11001000 00110111
OPEN/CLOSE 00000000 11111111 00001000 11110111
PLAY 00000000 11111111 10001010 01110101
FORWARD 00000000 11111111 01111000 10000111
BACK 00000000 11111111 01010000 10101111
ZOOM 00000000 11111111 11100000 00011111
VOLUME UP 00000000 11111111 11000000 00111111
VOLUME
00000000 11111111 01000000 10111111
DOWN
4.2.1 Features
22
Figure 4.5: Bit length of logic 0.
6 00100 1101111
4.3 PC INTERFACE
23
We designed a PC interface for communicating with VCD player and heater.
--‘These parts are explained detailly Ahmet Tekin’s final year project’.
Chapter 5
WIRELESS MODULE
24
5.1.Features
Nano WiReach offers much more than many other device servers on the
market. It acts as a security gap between the application and the network; supports
up to 10 simultaneous TCP/UDP sockets; two listening sockets; a web server with
two websites; SMTP and POP3 clients; MIME attachments; FTP and TELNET
clients, and SerialNET™ mode for serial-to-IP bridging.
25
Nano WiReach supports the SSL3/TLS1 protocol for secure sockets, HTTPS
and FTPS, WEP, WPA and WPA2 WiFi encryption.
Nano WiReach minimizes the need to redesign the host device hardware. It
easily inserts into headers on the host PCB and connects to an external antenna.
Minimal or no software configuration is needed for Nano WiReach to access the
Wireless LAN.
Connect One’s high-level AT+i™ API eliminates the need to add WiFi
drivers, security and networking protocols and tasks to the host application. The
AT+i SerialNET operating mode offers a true plug-and-play mode that eliminates
any changes to the host application.
5.3 Hardware
26
• Power Consumption: Transmit – 250mA @16dbm 235mA @12dbm (typical)
Receive – 190mA (typical) Power Save mode – 8mA
• RoHS-compliant; lead-free
Wireless module is working with 3.3 volt and it has receiver pin (RX) to
receive data from PC and transmitter pin (TX) for transmitting data to
microprocessor. It has reset pin for starting the module again. When the data come to
data ready pin, it can choose the next operation to do.
5.5 Configuration
-AT+iWLSI=speedtouch
27
The primary parameter governing the identity of the Access Point to which the
iChip will associate and connect to is the Service Set IDentifier (SSID). Each Access
point has its own SSID value. Speedtouch is the SSID of our system.
-AT+iIPA=169.254.111.17
-AT+iLPRT=10017
Permanently sets the port number on which iChip will listen for client
connections in SerialNET mode. It could be such a number between 0 and 65536.
-AT+iHIF=1
-AT+iMTTF=250
Sets max inactivity timeout before flushing the SerialNET socket.
-AT+iSNMD=3
Activates SerialNET mode. When this flag is specified, iChip automatically
goes online.
However, if the HSRV parameter is defined, a socket is not opened until data
arrive on the local serial port.
Chapter 6
28
RESULTS and CONCLUSIONS
IR signals are used to carry data, and the most popular application area is
remote controller which is used on TV, DVD player, air conditioner etc. Some
remote controllers use RF signals like car and garage remote controller. This is one
of the advantages of the IR signals because IR signals are effective at short distance
and transmitter and receiver must see each other.
One of the important problems is the noise. IR transmitter module can get a
signal from daylight which consist a lot of frequency components. This problem was
encountered and system works successfully.
IR remote controller was designed for 38 KHz signals. But we change that
value a little to be near 37.5 KHz. At that point it can be asked “if the transmitted
signal is not modulated at 38 KHz, would this circuit still work?” To answer this
question the effect of the carrier frequency of the IR signal must be known. Of
course if a circuit is designed for a special carrier frequency, it does not respond to
another signal which is modulated with a different frequency. But if the transmitted
signal is modulated with a closer frequency band of the carrier frequency, the circuit
responds. For example, if message signal is modulated with 37 KHz, circuit will
work again but there will be a difference of two signals on the circuit. It can
communicate with the remote controller with 38 KHz modulation at a longer
distance than 37 KHz modulation. Hence the effect of the carrier frequency on
29
distance can be seen with different devices which have different modulation
frequencies.
Finally, IR technologies make the daily life with remote controller. All
remote controllers work with a special protocol. In this project, IR remote controller
gets the 32 bit data values from PC and sends them to VCD player and 12 bit data
values from PC and sends them to heater . It uses 2 protools while achieving this.
If we want, we can use SONY, RC5 and another protocol for another device. Our
designed circuit would be useful if you are far from our controlled device. For
example, if we forget closing our device, we can close or get it work in sleep mode.
This circuit designed in this project can be employed in futuristic smart home
projects.
30
REFERENCES
2. http://www.sbprojects.com/knowledge/ir/ir.htm
3. http://www.ustr.net/infrared/index.shtml
4. http://www.datasheetcatalog.com
5. http://www.rentron.com/Infrared_Remote_Control.htm
31