Está en la página 1de 86

i

LI CAM OAN
Em xin cam oan ton b lun vn ny do chnh bn thn em tm ti, c
kt, thc hin di s hng dn ca Ths. Phm Th Thu H.
Nu sai em xin chu mi hnh thc k lut theo quy nh.

Ngi thc hin


Phm Xun Tm

iu khin mt s thit b gia nh thng qua sng v tuyn

ii

LI CM N
Ngi thc hin ti xin c gi li cm n chn thnh n qu Thy c
trong khoa in in T Trng i hc kinh t k thut cng nghip v
nht l qu Thy, C thuc b mn in T Vin Thng ging dy v
truyn t kin thc chuyn ngnh cho em thc hin n trong thi gian
va qua.
c bit em xin gi li cm n su sc ti Th.s Phm Th Thu H v s tn
tnh hng dn cng nh to nhng iu kin thun li nht cho em c
th thc hin v hon thnh tt ti ny.
ng thi em cng khng qun cm n cc bn trong lp trao i, gp
ngi thc hin hon thnh ti ny mt cch tt p v ng thi gian.
Mc d c nhiu c gng v n lc thc hin, nhng do kin thc cng
nh kh nng bn thn cn nhiu hn ch nn trong qu trnh thc hin ti
khng th trnh khi nhng sai phm, thiu s tRt mong nhn c s gp
, ch dn t ni qu thy c v cc bn sinh vin.

Ngi th hin

t i

Phm Xun Tm

iu khin mt s thit b gia nh thng qua sng v tuyn

iii

LI NI U
Ngy nay vi nhng ng dng ca khoa hc k thut tin tin . Th
gii v ang dn thay i vn minh, hin i hn. S pht trin ca k
thut in t to ra hng lot thit b vi nhng c im ni bt nh chnh
xc cao, tc nhanh, gn nh, nhiu tnh nng gip ch nhiu cho ngi s
dng.
in t ang tr thnh mt ngnh cng nghip a nhim v. in t
p ng nhng i hi khng ngng t cc lnh vc cng nng ng nghip
cho n cc thit b phc v i sng hng ngy ca mi con ngi.
Mt trong nhng ng dng quan trng l k thut iu khin t xa.
N g p phn rt ln trong vic iu khin thit b m con ngi khng th
chm trc tip vo vn hnh.
Xut pht t ng dng em chn ti :
Thit k v thi cng mch iu khin mt s thit b gia nh thng qua
sng v tuyn lm ti tt nghip.

iu khin mt s thit b gia nh thng qua sng v tuyn

iv

MC LC
LI CAM OAN .............................................................................................I
LI CM N ................................................................................................. II
LI NI U .............................................................................................. III
MC LC ...................................................................................................... IV
LIT K HNH : .......................................................................................VIII
LIT K BNG :.......................................................................................... XI
BNG TRA CU THUT NG VIT TT .......................................... XII
CHNG 1: GI I HI ............................................................................ 1
1.1. MC TIU TI.................................................................................. 1
1.2. NHIM V TI ................................................................................. 1
1.3. GII THIU TNG QUAN CC CHNG ......................................... 1
CHNG 2: C S

.............................................................. 2

2.1. SNG V TUYN................................................................................... 2


2.1.1. Khi nim sng v tuyn (RF) ......................................................... 2
2.1.2. Phn loi sng v tuyn..................................................................... 2
2.1.3. c im ca sng v tuyn ............................................................ 2
2.1.4. S truyn sng v tuyn trong kh quyn ....................................... 3
2.1.5. Cch to ra sng v tuyn................................................................. 4
2.2. K THUT IU CH SNG V TUYN .......................................... 5
2.2.1. K thut iu ch tng t ............................................................... 5
2.2.1.1. i u ch AM ................................................................................. 5
2.2.1.2. i u ch tn s FM ...................................................................... 6
2.2.1.3. i u ch phase (PM) .................................................................... 7
2.2.2. K thut iu ch s .......................................................................... 8
2.2.2.1. i u ch ASK ................................................................................ 8
2.2.2.1.1. Khi nim ............................................................................... 8
2.2.2.1.2. Nguyn l i u ch ................................................................. 9
2.2.2.1.3. Biu thc ton hc ............................................................... 10
2.2.2.1.4. Gii i u ch ........................................................................ 10
iu khin mt s thit b gia nh thng qua sng v tuyn

2.2.2.1.5. u v nh

im :.............................................................. 11

2.2.2.2. i u ch FSK .............................................................................. 11


2.2.2.2.1. Khi nim ............................................................................. 11
2.2.2.2.2. Nguyn l i u ch FSK ...................................................... 11
2.2.2.2.3. Biu thc ton hc ............................................................... 11
2.2.2.2.4. Gii i u ch ........................................................................ 13
2.2.2.2.5. u v nh

im :.............................................................. 13

2.2.2.3. i u ch PSK .............................................................................. 14


2.2.2.3.1. nh ngha ........................................................................... 14
2.2.2.3.2. Nguyn l i u ch ............................................................... 14
2.2.2.3.3. Biu thc ton hc ............................................................... 14
2.2.2.3.4. i u ch pha 2 trng thi 2-PSK (BPSK) ........................... 15
2.2.2.3.5. i u ch pha 4 trng thi 4-PSK (QPSK) ........................... 17
2.2.2.3.6. i u ch pha 8 trng thi 8-PSK ......................................... 19
2.3. NHNG YU T NH HNG TI QU TRNH THU PHT
SNG V TUYN......................................................................................... 20
2.3.1. Suy hao ............................................................................................. 20
2.3.2. Nhiu ................................................................................................. 21
2.3.2.1. Khi nim nhiu thng tin v tuyn ............................................ 21
2.3.2.2. Cc loi nhiu trong thng tin v tuyn ..................................... 21
2.3.3.Fading trong thng tin v tuyn...................................................... 24
2.3.3.1 Tng qut v Fading .................................................................... 24
2.3.3.2 Phn loi fading .......................................................................... 25
2.3.3.3. Kh ph Fading ...................................................................... 25
2.4. S KHI CA H THNG IU KHIN BNG SNG V
TUYN ........................................................................................................... 26
2.4.1. My pht........................................................................................... 26
2.4.2. My thu............................................................................................. 27
CHNG 3: THIT K ............................................................................. 28
3.1. PHN TCH BI TON V PHNG N THIT K ...................... 28
iu khin mt s thit b gia nh thng qua sng v tuyn

vi

3.1.1. Phn tch bi ton ............................................................................ 28


3.1.2. Phng n thit k........................................................................... 28
3.2. S KHI TNG QUT................................................................... 29
3.3. THIT K TNG KHI......................................................................... 30
3.3.1. Khi m ha v pht sng v tuyn ............................................... 30
3.3.1.1. Tm hiu IC PT2262 ................................................................... 30
3.3.1.1.1. Ch nng

hn IC PT2262 ......................................... 30

3.3.1.1.2. M t ch nng : ................................................................ 32


3.3.1.1.3. Hot ng : .......................................................................... 32
3.3.1.1.4 . Lu thut ton ................................................................ 35
3.3.1.2. S mch m ha v pht sng v tuyn ............................. 36
3.3.1.3. Tnh ton ..................................................................................... 37
3.3.2. Khi thu v gii m sng v tuyn ................................................. 37
3.3.2.1. Ic PT2272.................................................................................... 37
3.3.2.1.1 Ch nng

hn IC PT2272 ........................................... 38

3.3.2.1.2 M t ch nng, hot ng : ............................................... 39


3.3.2.1.3. PT2272 loi cht v loi tm thi (Latch - Momentary)..... 40
3.3.2.1.4. Lu thut ton ................................................................. 41
3.3.2.2. S mch thu v gii m sng v tuyn .................................. 42
3.3.2.3. Tnh ton ..................................................................................... 43
3.3.3. Khi x l trung tm ....................................................................... 44
3.3.3.1.Gii thiu i i u Khin T89S52 ............................................. 44
3.3.3.2. S hn T89S52 ................................................................... 45
3.3.3.3. Ch nng ca cc chn AT89S52 ............................................. 46
3.3.4. Khi hin th..................................................................................... 49
3.3.5. Khi chp hnh ................................................................................ 53
3.3.6. Khi ngun ....................................................................................... 54
CHNG 4 : THI CNG MCH ............................................................. 55
4.1. S NGUYN L TON MCH .................................................... 55
4.2. S MCH IN .................................................................................... 56
iu khin mt s thit b gia nh thng qua sng v tuyn

vii

4.2.1. Mch Pht ........................................................................................ 56


4.2.2. Mch thu, gii m, hin th, chp hnh v ngun ........................ 58
4.3. PHN TCH CHNG TRNH CHO VI IU KHIN ..................... 62
4.4. KIM TRA............................................................................................... 71
CHNG 5 : KT QU, HN CH V H NG PHT TRIN ........ 72
5.1. KT QU ................................................................................................ 72
5.2 HN CH V HNG PHT TRIN .................................................. 72
TI LIU THAM KHO ............................................................................ 73

iu khin mt s thit b gia nh thng qua sng v tuyn

viii

Hnh 2.1: S lan truy n ca sng in t


Hnh 2.2: Phng lan truy n ca sng in t
Hnh 2.3: Cch to ra sng RF
Hnh 2.4: Thu v pht sng RF
Hnh 2.5: i u ch AM
Hnh 2.6: i u ch tn s
Hnh 2.7: i u ch phase
Hnh 2.8: Nguyn l i u ch ASK
Hnh 2.9: Dng sng SK khi i u ch bng phng php OOK
Hnh 2.10: Gii i u ch ASK
Hnh 2.11: Phng php i u ch FSK
Hnh 2.12: Qu trnh gii i u h FSK
Hnh 2.13: Dng sng i u h BPSK
Hnh 2.14: Gii i u ch BPSK
Hnh 2.15: i u ch QPSK
Hnh 2.16: Dng sng i u ch QPSK
Hnh 2.17: Gii i u ch QPSK
Hnh 2.18: Nguyn l i u ch tn hiu 8-PSK
Hnh 2.19: Gii i u ch 8-PSK
Hnh 2.20: Mt tn hin nhiu trng
Hnh 2.21: Nhiu xuyn m
Hnh 2.22: Nhiu xuyn knh gia hai sng mang k nhau
Hnh 2.23: Nhiu ng knh
Hnh 2.24: S my pht sng v tuyn
Hnh 2.25: S my thu sng v tuyn
Hnh 3.1: S khi tng qut m h i u khin thit b in bng sng v
tuyn
Hnh 3.2: S chn IC PT2262
Hnh 3.3: Cu to IC PT2262
iu khin mt s thit b gia nh thng qua sng v tuyn

ix

Hnh 3.4: dng sng Bit AD


Hnh 3.5: Dng sng Bit SYNC
Hnh 3.6: Mt m word hon chnh
Hnh 3.7: Truy n mt m Frame
Hnh 3.8: in tr dao ng ca cp IC PT2262 PT2272
Hnh 3.9: Lu thut ton a PT2262
Hnh 3.10: S nguyn l mch m ha v pht sng v tuyn
Hnh 3.11: S nguyn l module pht RF 315MHz
Hnh 3.12: Module pht RF 315MHz thc t
Hnh 3.13: IC PT2272 loi M4 v L4
Hnh 3.14: Cu to IC PT2272
Hnh 3.15: Hot ng ca PT2272
Hnh 3.16: Hot ng ca PT2272 loi MX v LX
Hnh 3.17: Lu thut ton PT2272
Hnh 3.18: Khi thu RF
Hnh 3.19: Module thu RF thc t
Hnh 3.20: Khi thu RF kt ni vi vi i u khin
Hnh 3.21: S khi T89S52
Hnh 3.22: S

hn T89S52

Hnh 3.23: M h R s t vi i u khin


Hnh 3.24: M h kt ni th h anh ho vi i u khin
Hnh 3.25: Khi hin th
Hnh 3.26: Hnh dng v s chn LCD 16x2
Hnh 3.27: Khi chp hnh
Hnh 3.28: Khi hin th
Hnh 4.1: S ton mch
Hnh 4.2: Mch in khi pht RF
Hnh 4.3: M phng 3D khi pht RF
Hnh 4.4: Mch pht thc t
Hnh 4.5: Mch in khi thu, gii m, hin th, chp hnh v khi ngun
iu khin mt s thit b gia nh thng qua sng v tuyn

Hnh 4.6: M phng 3D khi thu, gii m, hin th, chp hnh v khi ngun
Hnh 4.7: Khi thu, gii m, chp hnh v ngun thc t
Hnh 4.8: Lu thut ton khi x l

iu khin mt s thit b gia nh thng qua sng v tuyn

xi

LIT K BNG :
Bng 2.1: Phn loi tn s
Bng 3.1: Gi tr in tr dao ng tng ng
Bng 3.2 : Ch nng

hn a Port 3

Bng 3.3: Ch nng hn LCD 16x2


Bng 3.4: Tp lnh LCD 16x2
Bng 4.1: Danh sch linh kin s dng trong mch pht
Bng 4.2: Danh sch linh kin s dng trong mch thu

iu khin mt s thit b gia nh thng qua sng v tuyn

xii

BNG TRA CU THUT NG VIT TT


Thut ng

Ting Anh

Ting Vit
B iu khin dao
ng theo in p.

VCO

Voltage-controlled oscillator

PLL

Phase lock loop

Vng kha pha.

LPF

Low-Pass Filter

B lc thng thp.

a truy nhp phn


chia theo thi gian.
a truy nhp phn
FDMA
Frequency Division Multiple Access
chia theo tn s.
a truy nhp phn
CDMA
Code Division Multiple Access
chia theo m.
a truy nhp phn
Direct Sequence Code Division
chia theo m chui
DS CDMA
Multiple Access
trc tip.
Kh nng gim thiu
MAI
Multiple Access Interference
nhiu a truy nhp.
TDMA

Time division multiple access

Bit error rate)

T l li bt.

OFDM

Orthogonal frequency-division
multiplexing

CMOS

Complementary Metal-OxideSemiconductor

Ghp knh phnchia


theo tn s trc giao
Cng ngh dng
ch to vi mch tch
hp

BER

iu khin mt s thit b gia nh thng qua sng v tuyn

CHNG 1
GI I HI
1.1. MC TIU TI
T c s l thuyt c bn v sng v tuyn, qu trnh thu pht sng v
tuyn. T ng dng thit k, lp rp mch in iu khin mt s
thit b gia nh thng qua sng v tuyn . a sn phm vo dng th
nghim vo thc tin cuc sng. T a ra cc kt lun cho ti, a ra
hng pht trin cho ti v rt kinh nghim cho bn thn.
1.2. NHIM V TI
- Nghin cu c c l thuyt.
- Xy dng thit k m hnh mch in v a ra cc thut ton.
- Thi cng, lp rp mch.
- Thu thp cc thng s k thut.
1.3. GII THIU TNG QUAN CC CHNG
Ni dung ti c chia thnh 5 chng v c sp xp nh sau:
Chng 1 Gi i thiu
Trnh by tng quan ni dung chnh trong ti, nhng vn s c
cp n trong ton b bi vit.
Chng 2 C s

thu t

Chng ny s i su v l thuyt thu, pht s ng v tuyn, c ch m ha


v gii m ca cp IC PT2262/PT2272, l thuyt LCD 16x2, ng thi trnh
by s lc v vi iu khin AT89S52.
Chng 3 hit k
a ra phng n thit k, cp n nhng tnh ton c th thit k
phn cng cho h thng bao gm cc thng tin v s khi, chc nng, hot
ng cc khi.
Chng 4 Thi cng Thi cng mch thc t, vit code cho vi iu khin.
Chng 5

t qu, hn ch v h ng pht trin

Bao gm kt qu thi cng h thng, nhng iu t c, hn ch v hng


pht trin ti.
iu khin mt s thit b gia nh thng qua sng v tuyn

CHNG 2
C

2.1. SNG V TUYN


2.1.1. Khi nim sng v tuyn (RF)
Sng v tuyn ( Radio Frequency ) l mt kiu bc x in t vi bc
sng trong ph in t di hn nh sng hng ngoi. Sng v tuyn c tn s
t 3 KHz ti 300 GHz, tng ng bc sng t 100 km ti 1 mm.
Cc tn s khc nhau ca sng v tuyn c c tnh truyn lan khc nhau
trong kh quyn tri t. Sng di truyn theo ng cong ca tri t, sng
ngn nh phn x t tng in ly nn c th truyn rt xa, cc bc sng ngn
hn b phn x yu hn v truyn trn ng nhn thng.
2.1.2. Phn loi sng v tuyn
Bng 2.1: Phn loi sng v tuyn
oi sng

n s

B c sng

S ng di v cc di

3-300 KHz

100Km - 1Km

Sng trung

0,3-3 MHz

1000m - 100 m

S ng ngn

3-30 MHz

100m - 10 m

S ng cc ngn

30-3000 MHz

10m - 0,01 m

2.1.3. c im ca sng v tuyn


Sng v tuyn l s ng in t nn c cc c im sau:
- Sng in t lan truyn c trong chn khng vi tc ln nht (bng
vn tc nh sng ) c = 3.108m/s.

Hnh 2.1: S lan truyn ca sng in t

iu khin mt s thit b gia nh thng qua sng v tuyn

- Trong s ng in t th dao ng ca in trng v t trng ti mt im


lun lun ng pha vi nhau.
- S ng in t l sng ngang, ngha l n l s lan truyn ca cc dao ng
lin quan n tnh cht c hng (c th l cng in trng v cng
t trng) ca cc phn t m hng dao ng vung gc vi hng lan
truyn sng.

Hnh 2.2: Phng lan truyn ca sng in t


- Khi s ng in t gp mt phn cch gia hai mi trng th n b phn x v
khc x nh nh sng. Nu sng v tuyn p vo vt th dn in c kch
thc bt k, n s i chm li ph thuc vo t thm v hng s in mi.
- S ng in t mang nng lng
Nng lng ca mt ht photon c bc sng l hc/, vi h l hng s
Planck v c l vn tc nh sng trong chn khng.
2.1.4. S truyn sng v tuyn trong kh quyn
Cc vng sng ngn t b hp th
Khng kh hp th rt mnh cc sng di, sng trung v sng cc ngn.
Khng kh cng hp th mnh cc sng ngn. Tuy nhin trong mt vng
tng i hp, cc s ng c bc sng ngn hu nh khng b hp th. Cc
vng sng ny gi l cc di sng v tuyn.

iu khin mt s thit b gia nh thng qua sng v tuyn

Vai tr ca tn in li trong vic thu v pht sng v tuyn


- Tn in li: l tng kh quyn cao t 80-800km c cha nhiu ht mang
in tch l cc electron, ion dng v ion m.
- Sng di: c nng lng nh nn khng truyn i xa c. t b nc hp
th nn c dng trong thng tin lin lc trn mt t v trong nc.
- Sng trung: Ban ngy sng trung b tn in li hp th mnh nn khng
truyn i xa c. Ban m b tn in li phn x mnh nn truyn i xa
c. c dng trong thng tin lin lc vo ban m.
- Sng ngn: C nng lng ln, b tn in li v mt t phn x mnh. V
vy t mt i pht trn mt t th sng ngn c th truyn ti mi ni trn
mt t. Dng trong thng tin lin lc trn mt t.
- Sng cc ngn: C nng lng rt ln v khng b tn in li phn x hay
hp th. c dng trong thn tin v tr.
2.1.5. Cch to ra sng v tuyn
c s ng v tuyn dng trong iu khin, khi u ngi ta dng mch
dao ng cng hng LC c kt ni bi mt cun dy v mt t in. Khi
mch LC b kch thch, trong cun dy s xut hin t trng v trong t in
s xut hin in trng. Khi vo trng thi cng hng, t trng trong cun
dy L v in trng trong t C s kt hp to ra dng s ng in t . Dng
dy anten ph hp cho pht s ng trong mch LC vo khng gian, n y
s ng RF dng cho cng vic iu khin v tuyn c to ra.

Hnh 2.3: Cch to ra sng RF

iu khin mt s thit b gia nh thng qua sng v tuyn

C1

L1

L2

L4

L3

C2

Hnh 2.4: Thu v pht sng RF


Dng mch cng hng LC to sng mang c tn s ln, sau to ra cc
m lnh iu khin, gn cc m lnh iu khin ny vo sng mang bng cc
phng php iu ch ri pht chng vo khng gian.
2.2. K THUT IU CH SNG V TUYN
2.2.1. K thut iu ch tng t
2.2.1.1. i u ch AM
Bin ca s ng mang c thay i bi bin ca tn hiu c truyn
i. Tn hiu cn c truyn i l ngun iu ch v c gi l sng
iu ch (Modulating Wave). Thng tin cn truyn s c gi vo trong
mt sng c tn s ln hn c th truyn i xa ny c gi l Sng
mang (Carrier)

Hnh 2.5: iu ch AM
iu khin mt s thit b gia nh thng qua sng v tuyn

Sng mang
Xc = Acos( + t)
Trong :
Xc: Gi tr ( ng ) tc thi ca Sng mang;
A: Bin ( ng

i) ca Sng mang;

t: Thi gian biu kin (thi gian x m xt hin ti k t thi im g ban


u x nh tr ) ca sng mang.
: Tn s gc ca sng mang v c xc nh bi h thc di y:
= 2f Vi f l Tn s ca Sng mang
Tn hiu

i u h (AM Signal)

S = Acos( + t) + m(t) = A[1 + m(t)]cos(t)


m(t): Hm ph thuc thi gian t ca tn hiu iu ch.
u im
- D hin thc (iu ch v gii iu ch)
- D bin i tn hiu sang cc gii bng tn khc nhau
Nhc im
- D b nh hng ca nhiu
- Khng s dng hiu qu nng lng
2.2.1.2. i u ch tn s FM
iu Tn Frequency Modulation(FM) l mt phng thc iu ch lm
thay i tn s sng mang theo tn hiu cn truyn, trong khi bin ca sng
mang cao tn khng thay i.

Hnh 2.6: iu ch tn s

iu khin mt s thit b gia nh thng qua sng v tuyn

Gi s tn hiu d liu bng gc (bn tin) cn c truyn l


v sng
mang cao tn hnh sin
, y fc l tn s s ng mang cao
tn v Ac l bin s ng mang cao tn. B iu ch kt hp s ng mang vi
tn hiu bng gc c c tn hiu truyn l:

Trong phng trnh ny,

l tn s tc thi ca b to dao ng

v l lch tn s c trng cho lch cc i so vi fc trn mt hng,


gi s xm(t) c gii hn trong khong (-1, +1).
u im
- Kh b nh hng ca nhiu.
- S dng hiu qu nng lng.
Nhc im
- Tn hiu c iu ch yu cu bng thng rng hn nhiu tn hiu truyn i
ban u (d liu).
- Hin thc mch iu ch v gii iu ch phc tp hn so vi phng php
iu bin.
2.2.1.3. i u ch phase (PM)
Tn hiu truyn i khng nh hng n thnh phn bin v tn s m ch
lm thay i pha ca sng mang.
Ph tn s ca tn hiu c iu ch theo phng php iu pha tng t
nh phng php iu tn, phng php iu pha cng c cc c im tng
t phng php iu tn.
Tuy nhin, c hai l do phng php iu pha c d chp nhn hn
- i vi bn nhn: tn s ca tn hiu nhn c l c nh, ch c pha thay
i nn ch cn thit k b lc tn s ch cho mt tn s duy nht thay v
nhiu tn s nh trong phng php iu tn gim chi ph thit k v hin
thc mch

iu khin mt s thit b gia nh thng qua sng v tuyn

- Trong trng hp tn hiu iu ch ch nhn mt s gi tr (nh tn hiu s),


mch iu ch v gii iu ch hin thc theo phng php iu pha c
n gin rt nhiu

Hnh 2.7: iu ch phase


Dng tn hiu PM:
[

Trong :
x(t) tn hiu tc thi
kp l hng s t l
u im:
- Kh nng chng nhiu cao.
- Bng thng tn hiu rng.
- Chi ph thp.
2.2.2. K thut iu ch s
2.2.2.1. i u ch ASK
2.2.2.1.1. Khi nim
ASK (Amplitude Shift Keying) l k thut iu ch s theo bin tn
hiu. Tn hiu ASK c dng s ng dao ng c tn s f, mi bit c trng bi
bin khc nhau ca tn hiu.
V d: Tn hiu ASK c tn s 100 KHz, bin tn hiu = 1 cho bit 0
v bin tn hiu = -1 cho bit 1.

iu khin mt s thit b gia nh thng qua sng v tuyn

2.2.2.1.2. Nguyn l i u ch
Dng hai mc bin khc nhau ca s ng mang biu din cho mc 0 v
1, s dng 1 tn s sng mang duy nht

Hnh 2.8: Nguyn l iu ch ASK


Ngoi ra c th iu ch ASK theo phng php OOK (on-off-keying)

Hnh 2.9: Dng s ng ASK khi iu ch bng phng php OOK


iu khin mt s thit b gia nh thng qua sng v tuyn

10

2.2.2.1.3. Biu thc ton hc


Gi s tn hiu sng mang:

Vc t cos ct
Tn hiu iu ch:
Vd t

1 2
1
1
cos 0t cos 30t cos 50t ...
2
3
5

Tn hiu sau khi qua b iu ch ASK:

VASK (t ) Vc (t ).Vd (t )
1
2
1
VASK (t ) cos c t cos c t.cos 0t cos c t.cos 30t ...
2

1
1
1
VASK (t ) cos ct cos(c 0 )t cos(c 0 )t cos(c 30 )t cos(c 30 )t ... .
2

2.2.2.1.4. Gii i u ch
Gii iu ch ASK c th l kt hp hoc khng kt hp trong trng hp
th nht th mch phc tp nhng chng nhiu tt. Trong trng hp th hai
th mch n gin v thng s dng mch tch sng hnh bao.

Hnh 2.10: Gii iu ch ASK


iu khin mt s thit b gia nh thng qua sng v tuyn

11

2.2.2.1.5. u v nh

im :

u im :
- n gin :
Dng 2 bin khc nhau ca s ng mang biu din 0 v 1
S dng mt tn s sng mang duy nht.
- Phng php ny ph hp trong truyn s liu tc thp
(~1200bps trn knh truyn thoi).
Nhc im :
- D b nh hng bi nhiu.
- Khng ph hp i vi cc tn hiu c truyn trong cc knh truyn
yu cu tc cao.
2.2.2.2. i u ch FSK
2.2.2.2.1. Khi nim
FSK (Frequency Shift Keying) l k thut iu ch s theo tn s tn hiu.
Tn hiu FSK c dng s ng dao ng vi tn s khc nhau, mi bit c c
trng bi tn s khc nhau ca tn hiu.
2.2.2.2.2. Nguyn l i u h FSK
L phng php iu ch dng 2 tn s khc nhau ca s ng mang biu
din bit 1 v 0. Tn s cao ng vi mc 1 v tn s thp ng vi mc 0
2.2.2.2.3. Biu th ton h
Gi s c s ng mang :
[

Gi nguyn bin , pha ch thay i tn s:

Trong :

Ta gi iu tn khi :

iu khin mt s thit b gia nh thng qua sng v tuyn

12

s(t) l tn hiu sin


kf l h s iu tn
Suy ra:

Suy ra:
[

Trong trng hp iu ch s FSK th s(t) = {

Khi
Tn s ng vi mt bit no :
- i vi bit 0 tn s s ng mang l

, ta c

- i vi bit 1 tn s s ng mang l

, ta c

Phng php iu ch FSK cho php to ra tn hiu FSK dng sin vi 2 tn


s:
- Khi bit data = 1, iu khin kh a K v tr ni s ng mang tn s
li ra FSK.

vi

- Khi bit data = 0, iu khin kh a K v tr ni s ng mang tn s


li ra FSK.

vi

Hnh 2.11: Phng php iu ch FSK


iu khin mt s thit b gia nh thng qua sng v tuyn

13

2.2.2.2.4. Gii i u h
Mch ph bin nht ca b gii iu ch tn hiu FSK l vng kh a pha
(PLL). Tn hiu FSK li vo vng kh a pha ly ra 2 gi tr tn s. in th
lch mt chiu li ra ca b so pha theo di nhng dch chuyn tn s ny
v cho ta 2 mc thp v cao ca tn hiu li vo FSK.
B PLL l mt h thng hi tip gm 3 b phn chnh: Mch so pha, mch
lc h thng v mt b iu khin dao ng VCO. PLL l mt vng kn, tn
hiu ra t VCO t ng kh a bi tn hiu vo. Bng cch so snh pha ca tn
hiu ra t VCO v tn hiu vo, s sai pha s c bin i thnh in th 1
chiu, in th ny s iu khin VCO to ra mt tn hiu ra lun lun c
cng pha v tn s vi tn hiu vo.
B PLL km theo mt mch lc thng thp ly i nhng thnh phn cn
d ca s ng mang m mt mch to li dng xung khi phc dng xung
chnh xc nht cho tn hiu iu ch.

Hnh 2.12: Qu trnh gii iu ch FSK


2.2.2.2.5. u v nh

im :

u im:
- Dng nhiu hn hai tn s.
- Dng truyn d liu tc 1200bps hay thp hn trn mng in
thoi.
- Bng thng c dng hiu qu hn.
- t li hn so vi ASK.
- C th dng tn s cao (3-30Mhz) truyn s ng radio hoc cp ng
trc .
iu khin mt s thit b gia nh thng qua sng v tuyn

14

Nhc im:
- Truyn s liu tc thp.
- Hiu qu ph thp.
- Kh nng p ng tn s ca mi trng cn hn ch.
- Tn s tn hiu cao gy nhiu ngoi v hn ch kh nng tng tc
truyn.
- Cng ngh ch to phc tp hn ASK.
2.2.2.3. i u h PSK
2.2.2.3.1. nh ngha
iu ch s theo phase tn hiu PSK (Phase Shift Keying) l mt dng iu
ch g c pha tn hiu vi bin khng i.
iu ch PSK l phng php hiu qu nht truyn tn hiu s, c th
n i y l phng php iu ch trit s ng mang do bng thng ca tn
hiu PSK nh hn bng thng ca tn hiu FSK nu dng cng mt tn hiu
di nn, nhng my thu phi c mch dao ng to s ng mang thc
hin vic gii iu ch, tn hiu dao ng ny phi c cng tn s v phase
ca s ng mang my pht.
2.2.2.3.2. Nguyn l i u h
Tn hiu PSK c dng s ng dao ng c tn s f, mi bit c trng bi gc
pha khc nhau ca tn hiu.
V d: pha= 90 cho bit 0 v pha = -90 cho bit 1.
2.2.2.3.3. Biu th ton h
Gi s tn hiu s ng mang c biu din :
Tn hiu bng gc : s(t) l tn hiu nh phn (0,1) hay l 1 dy NRZ
Khi tn hiu pha PSK c dng
[

Trong
l s sai pha gia cc pha ln cn ca tn hiu
Biu din tn hiu :
[

{
[

iu khin mt s thit b gia nh thng qua sng v tuyn

15
[

t {

]
[

Vy tn hiu iu pha l tng ca hai tn hiu iu bin vung g c


2.2.2.3.4. i u h pha 2 trng thi 2-PSK (BPSK)
iu ch
T biu thc :
[

Trong :
l s sai pha gia cc pha ln cn ca tn hiu
Nu n=2,
th ta c kiu iu ch 2-PSK hay gi l iu ch nh phn
BPSK. Tn hiu BPSK c dng:

Tn hiu bng gc s(t) l xung NRZ lng cc


Vi bit 1

Vi bit -1

Nh vy bin ca tn hiu khng i trong qu trnh truyn dn, nhng b


chuyn i trng thi.
Trong BPSK, ng vi tn hiu vo l cc in th biu din mc logic -1,1
th cc tn hiu ra l s ng mang hnh sin c pha lch nhau 180 .

iu khin mt s thit b gia nh thng qua sng v tuyn

16

Hnh 2.13: Dng s ng iu ch BPSK

Gii iu ch BPSK
Tn hiu BPSK c tng hp vi sng mang chun thng qua b lc thng
thp (LPF Low-Pass Filter) loi b cc thnh phn hi bc cao cho thu
c tn hiu ban u.

Hnh 2.14: Gii iu ch BPSK


Pha tn hiu sng mang chun bng pha ca tn hiu nhn c.

iu khin mt s thit b gia nh thng qua sng v tuyn

17

2.2.2.3.5. i u h pha 4 trng thi 4-PSK (QPSK)


iu ch
T biu thc :
[

Trong :
l s sai pha gia cc pha ln cn ca tn hiu
Nu n=4,
th ta c kiu iu ch 4-PSK hay gi l iu ch BPSK.
Tn hiu QPSK c dng:

Tn hiu bng gc s(t) l xung NRZ lng cc 4 gi tr

Hnh 2.15: iu ch QPSK


Tn hiu bng gc a qua b bin i ni tip thnh song song (SPC), u
ra chia lm 2 lung s liu c tc bit gim i mt na, ng thi bin i
tn hiu n cc thnh tn hiu
Hai s ng mang a ti b trn lm lch
pha nhau 90 , tng hp tn hiu u ra 2 b trn c tn hiu QPSK.

Tn hiu ra QPSK :

iu khin mt s thit b gia nh thng qua sng v tuyn

18

Hnh 2.16: Dng s ng iu ch QPSK

Gii iu ch QPSK

Bit
S(t)
Combiner

Hnh 2.17: Gii iu ch QPSK


Tn hiu gii iu ch c a chia lm 2 ng v c lm lch pha 90 ,
tn hiu sau cc mch nhn a vo mch lc thng thp loi b cc thnh
phn tn s cao, sau a qua b so v mch logic to ra 2 tn hiu nh
phn bng cch x l logic thch hp. 2 tn hiu ny qua b tng hp ta c
tn hiu ban u.
iu khin mt s thit b gia nh thng qua sng v tuyn

19

2.2.2.3.6. i u h pha 8 trng thi 8-PSK


iu ch
T biu thc :
[

Trong :
l s sai pha gia cc pha ln cn ca tn hiu
Nu n=8,

th ta c kiu iu ch 8-PSK. Tn hiu 8-PSK c dng:

Tn hiu bng gc s(t) nhn 8 gi tr.


B iu ch 8-PSK l s kt hp tn hiu ca 2 b 4-PSK. Sng mang ca 2
b iu ch c s sai pha 45 . Mt b m ha bin i tn hiu c to ra
t tn hiu bng gc s(t) sau khi i qua b SPC( b bin i ni tip thnh
song song) thnh tn hiu iu ch.

Hnh 2.18: Nguyn l iu ch tn hiu 8-PSK

iu khin mt s thit b gia nh thng qua sng v tuyn

20

Gii iu ch:

Bit
S(t)
Combiner

Hnh 2.19: Gii iu ch 8-PSK


Tn hiu gii iu ch c a qua b nhn v c lm lch pha 135 ,
90 , 45 , sau c a qua b lc thng thp loi b thnh phn tn s
cao, tn hiu ra cho qua mch so snh v mch logic ly ra 3 tn hiu nh phn.
Cui cng 3 tn hiu ny qua mch tng hp ta c tn hiu ban u.
2.3. NHNG YU T NH HNG TI QU TRNH THU PHT
SNG V TUYN
2.3.1. Suy hao
Suy hao l mt tc ng ca mi trng truyn ti vic truyn tn hiu.
Cng ca tn hiu trn bt c mt mi trng truyn no u b suy gim
theo khong cch.
Suy hao c th do:
- S phn tn nng lng bc x khi lan truyn (suy hao khong cch)
- S hp th ca mi trng (tn hao nhit)
- S nhiu x sng (tn x )
- S tn sc
Tn hiu suy gim s tc ng n cc yu t sau :

Tn hiu ti im thu phi ln my thu c th pht hin v khi


phc tn hiu

iu khin mt s thit b gia nh thng qua sng v tuyn

21

Tn hiu nhn c ti im thu phi ln my thu c th pht


hin v khi phc khng b sai li

suy gim thng l mt hm tng theo tn s

pht tn hiu i xa th ngi ta s s dng cc b khuch i tn hiu v


chuyn tip.
2.3.2. Nhiu
2.3.2.1. Khi nim nhiu thng tin v tuyn
Nhiu thng tin v tuyn l nh hng ca nng lng khng cn thit bi
mt hoc nhiu ngun pht x, bc x hoc nhng cm ng trn my thu
trong h thng thng tin v tuyn, dn n lm gim cht lng, gin on
hoc b mt hn thng tin m c th khi phc c nu khng c nhng
nng lng khng cn thit
2.3.2.2. Cc loi nhiu trong thng tin v tuyn
Nhiu trng (White Gaussian Noise)
Nhiu trng l qu trnh xc xut c mt ph cng sut phng ( khng
i ) trn ton b di tn

Hnh 2.20: Mt tn hin nhiu trng


Qui lut phn b xc xut ca nhiu trng tun theo hm phn b Gaussian:
x2

Ngun nhiu trng:

2
1
y
e
2

- Nhiu sinh ra do s chuyn ng nhit ca cc in t trong cc linh kin


bn dn
- Nhng m thanh nh ting gi , ting nc cng l nhng ngun nhiu trng
iu khin mt s thit b gia nh thng qua sng v tuyn

22

Nhiu u n

Inters

o Inteference

Trong mi trng truyn dn v tuyn, nhiu xuyn k t (ISI) gy bi tn


hiu phn x c thi gian tr khc nhau t cc hng khc nhau t pht n
thu l iu khng th trnh khi. nh hng ny s lm bin dng hon ton
mu tn hiu khin bn thu khng th khi phc li c tn hiu gc ban u.

Hnh 2.21: Nhiu xuyn m


Mt trong nhng phng php loi b nhiu ISI l dng b lc cos nng
v b lc ngang p khng (phng php Nyquist I).
Nhiu lin knh ICI (Interchannel Interference)
Nhiu xuyn knh gy ra do cc thit b pht trn cc knh lin nhau Nhiu
lin knh thng xy ra do tn hiu truyn trn knh v tuyn b dch tn gy
can nhiu sang cc knh k n . loi b nhiu xuyn knh ngi ta phi c
khong bo v (guard band) gia cc di tn.

Hnh 2.22: Nhiu xuyn knh gia hai sng mang k nhau
iu khin mt s thit b gia nh thng qua sng v tuyn

23

loi b nhiu xuyn knh ngi ta phi c khong bo v (guard band )


gia cc di tn
Nhiu ng knh (Co-Channel Interference)
Nhiu ng knh xy ra khi c hai my pht trn cng mt tn s hoc trn
cng mt knh. My thu iu chnh knh ny s thu c c hai tn hiu vi
cng ph thuc vo v tr ca my thu so vi hai my pht.

Hnh 2.23: Nhiu ng knh


Khc phc :
Khng th dng b lc loi b giao thoa ny. Ch c th ti thiu h a
nhiu ng knh bng cch thit k mng cellular ph hp. Tc l thit k sao
cho cc cell trong mng c s dng cng nh m tn s khng nh hng ti
nhau, khong cch cc cell cng tn s phi ln
Nhiu a tru nhp (Multiple Access Interference).
Nhiu a truy nhp l nhiu do cc tn hiu ca cc user giao thoa vi nhau,
l yu t nh hng trc tip n dung lng ca h thng.
rong cc h thng a tru nhp:
- TDMA: a truy nhp phn chia theo thi gian
Trong TDMA l s giao thoa ca cc tn hiu khe thi gian ny vi khe
thi gian khc do s khng hon ton ng b gy ra. Ngi ta phi c
khong bo v (guard time) gim xc sut ngi dng b giao thoa nhng
cng ng thi lm gim hiu sut s dng ph
- FDMA: a truy nhp phn chia theo tn s
Cc hiu ng Doppler lm dch ph tn s dn n c s giao thoa gia cc
iu khin mt s thit b gia nh thng qua sng v tuyn

24

di tn con Guard band gim xc xut giao thoa gia cc knh k nhau lm
gim hiu sut s dng ph
- CDMA: a truy nhp phn chia theo m
Trong CDMA ngi ta s dng tnh trc giao ca m nn hu nh khng c
nhiu gia cc user.
- DS - CDMA: a truy nhp phn chia theo m chui trc tip.
Theo nhng nghin cu gn y, phng thc a truy nhp phn chia theo
m chui trc tip DS-CDMA (Direct Sequence Code Division Multiplexing
Access) da vo vic tri ph dng d liu bng cch s dng mt m tri
ph c n nh cho mi ngi s dng trong min thi gian.Kh nng gim
thiu nhiu a truy nhp MAI (Multiple Access Interference) da vo tnh
tng quan cho ca m tri ph. Trong trng hp truyn a ng i hi
rt kht khe ca vin thng di ng, kh nng phn bit mt tn hiu thnh
phn t nhiu thnh phn khc trong tn hiu thu tng hp c cung cp bi
tnh t tng quan ca m tri ph. My thu RAKE c cha nhiu b tng
quan, mi b tng quan c ni vi mt dng dn c kh nng phn gi
khc nhau. V vy hot ng ca h thng DS-CDMA s ph thuc nhiu vo
s lng ngi s dng thc t, c trng ca knh v s lng cc nhnh
c dng trong my thu RAKE. Cng v l do ny m dung lng ca h
thng s b hn ch do nhiu ni (self-interference) v MAI m nguyn nhn
l s cha hon chnh ca tnh t tng quan cng nh tnh tng quan cho
ca m tri ph. iu ny gy ra kh khn cho h thng DS-CDMA trong
vic s dng y nng lng tn hiu thu b phn tn trong min thi gian.
2.3.3 Fading trong thng tin v tuyn
2.3.3.1 Tng qut v Fading
Fading l hin tng sai lc tn hiu thu mt cch bt thng xy ra i vi
cc h thng v tuyn do tc ng ca mi trng truyn dn. Cc yu t gy
ra Fading i vi cc h thng v tuyn mt t nh:
- S thng ging ca tng in ly i vi h thng s ng ngn
- S hp th gy bi cc phn t kh, hi nc, ma, tuyt, sng ms
hp th ny ph thuc vo di tn s cng tc c bit l di tn cao
(>10Ghz).
- S khc x gy bi s khng ng u ca mt khng kh.

iu khin mt s thit b gia nh thng qua sng v tuyn

25

- S phn x s ng t b mt tri t, c bit trong trng hp c b mt


nc v s phn x s ng t cc bt ng nht trong kh quyn. y cng l
mt yu t dn n s truyn lan a ng.
- S phn x, tn x v nhiu x t cc chng ngi trn ng truyn lan
s ng in t, gy nn hin tng tri tr v giao thoa s ng ti im thu do tn
hiu nhn c l tng ca rt nhiu tn hiu truyn theo nhiu ng. Hin
tng ny c bit quan trng trong thng tin di ng
2.3.3.2 Phn loi fading
- Fading phng
L Fading m suy hao ph thuc vo tn s l khng ng k v hu nh l
hng s vi ton b bng tn hiu dng ca tn hiu.
Fading phng thng xy ra i vi cc h thng v tuyn c dung lng nh
v va, do rng bng tn hiu kh nh nn fading do truyn dn a ng
v do ma gn nh l xem khng c chn lc theo tn s.
- Fading a chn tn s selective fading)
Xy ra khi bng tn ca tn hiu ln hn bng thng ca knh truyn. Do
h thng tc va v ln c rng bng tn hiu ln (ln hn rng
knh) s chu nhiu tc ng ca selective fading.
N i chung l i ton b bng thng knh truyn th n nh hng khng
u, ch nhiu ch t, ch lm tng ch lm gim cng tn hiu. Loi ny
ch yu do fading a ng gy ra.
- Fading nhanh (fast fading): hay cn gi l hiu ng Doppler, nguyn nhn
l c s chuyn ng tng i gia my thu v my pht dn n tn s thu
c s b dch tn i 1 lng delta_f so vi tn s pht tng ng
- Fading chm (slow fading): Do nh hng ca cc vt cn tr trn ng
truyn. VD: ta nh cao tng, ngn ni, ilm cho bin tn hiu suy
gim, do cn gi l hiu ng bng rm (Shadowing) Tuy nhin, hin tng
ny ch xy ra trn mt khong cch ln, nn tc bin i chm. Hay s
khng n nh cng tn hiu nh hng n hiu ng cho chn gi l suy
hao chm. V vy hiu ng ny gi l Fading chm (slow fading)
2.3.3.3. Kh ph Fading
- Phn tp (diversity): khng gian (dng nhiu anten pht v thu) v thi gian
(truyn ti nhiu thi im khc nhau).
iu khin mt s thit b gia nh thng qua sng v tuyn

26

- S dng mch san bng thch nghi, thng l cc ATDE (Adaptive Time
Domain Equalizer) vi cc thut ton thch nghi thng dng l Cng p
khng ZF (Zero Forcing) v Sai s trung bnh bnh phng cc tiu LMS
(Least Mean Square error).
- S dng m sa li gim BER (vn c th ln do selective fading gy
nn).
- Tri ph tn hiu (pha-inh chn lc thng do hin tng truyn dn a
ng (multipath propagation) gy nn, tri ph chui trc tip, nht l vi
my thu RAKE, c kh nng tch cc tia s ng v tng hp chng li, loi b
nh hng ca multipath propagation).
- S dng iu ch a s ng mang m tiu biu l OFDM (ci ny ngy nay
c ng dng khp ni, trong di ng 3G, trong WIFI, WIMAX hay trong
truyn hnh s mt t DVB-T...).
2.4. S KHI CA H THNG IU KHIN BNG SNG V
TUYN
2.4.1. My pht
Tn hiu vo

Mch bin

Mch Khuch

iu

Anten pht

Mch to
sng cao tn

Hnh 2.24: S my pht sng v tuyn


- Tn hiu vo : tn hiu m tn cn truyn i.
- Mch to s ng in t cao tn: Pht dao ng in t tn s cao (c MHz).
- Mch bin iu : Trn dao ng in t cao tn vi dao ng in t m tn
- Mch khuych i : Khuych i dao ng in t cao tn c bin iu
- Anten pht : To ra s ng in t cao tn lan truyn trong khng gian.
iu khin mt s thit b gia nh thng qua sng v tuyn

27

2.4.2. My thu

Khuch i

Mch tch

cao tn

sng

X l v chp

Gii m tn

Khuch i

hnh

hiu

m tn

Anten thu

Hnh 2.25: S my thu sng v tuyn


- Anten thu: thu s ng in t cao tn bin iu.
- Mch khuch i cao tn: Khuych i dao ng in t cao tn t an ten
gi ti.
-Mch tch sng: Tch dao ng in t m tn ra khi dao ng in t cao
tn.
-Mch khuych i m tn: Khuych i dao ng in t cao tn tch
sng.
- Gii m tn hiu : Gii m cc tn hiu c m ha t bn pht.
- X l v chp hnh : tn hiu c gii m s c x l iu khin thit
b.

iu khin mt s thit b gia nh thng qua sng v tuyn

28

CHNG 3
THIT K
3.1. PHN TCH BI TON V PHNG N THIT K
3.1.1. Phn tch bi ton
- Thit k mch iu khin ( trong phm vi ti ny iu khin 4 thit b
in 220v ) thng qua sng v tuyn.
- 4 thit b phi c iu khin c lp vi nhau.
- H thng s bao gm mt mch pht v mt mch thu kt hp vi gii m
v x l.
3.1.2. Phng n thit k
Phng n 1: Thit k mch iu khin thit b thng qua sng GSM bng
module sim 300cz (hoc module sim900)
S dng module sim 300cz (hoc module sim900) giao tip vi vi iu
khin (8051, Pic). iu khin thit b in qua tin nhn SMS
u im :
- S dng bng tn di ng 900Mhz/1800Mhz t b nhiu, khong cch iu
khin xa hn.
- Nhn c tin nhn thng bo trng thi cc thit b ang hot ng.
Nhc im:
- Kh giao tip gia module v vi iu khin.
- Gi thnh cao.
Phng n 2: Mch iu khin thit b thng qua sng v tuyn s dng
module thu pht PT2262 - PT2272
S dng module thu pht RF 315Mhz giao tip vi vi iu khin 8051 iu
khin thit b
u im:
- S dng IC thu pht chuyn dng nn d m ha v gii m.
- D thi cng lp t
Nhc im:
- Ch iu khin trong khong cch gn < 50m.
- Khng bit c trng thi cc thit b khi xa.
iu khin mt s thit b gia nh thng qua sng v tuyn

29

Do i u kin thi gian, kinh t v thi ng nn ngi thc hin quyt nh


chn phng n 2 : M h i u khin thit b thng qua sng v tuyn s dng
module thu pht PT2262-PT2272 thc hin.
3.2. S KHI TNG QUT

KHI M HA V
PHT SNG V
TUYN

KHI THU SNG V


GII M V TUYN

KHI NGUN

KHI IU KHIN TRUNG


TM

KHI HIN TH

KHI CHP
HNH

Hnh 3.1: S khi tng qut mch iu khin thit b in bng sng v
tuyn

iu khin mt s thit b gia nh thng qua sng v tuyn

30

3.3. THIT K TNG KHI


3.3.1. Khi m ha v pht sng v tuyn
3.3.1.1. Tm hiu IC PT2262
PT2262 l mt IC m h a s dng trong iu khin t xa kt hp vi IC
gii m PT2272. Hai IC ny c sn xut trn cng ngh CMOS. N m h a
d liu v a ch dng song song thnh tn hiu ni tip ph hp cho iu
khin t xa dng tia hng ngoi hoc s ng v tuyn da trn cc phng php
iu ch. IC PT2262 c ti a 12 chn a ch nn s c 531441 (3^12) m a
ch, do gim ng k kh nng trng lp m v gii m tri php.

Hnh 3.2: S chn IC PT2262


3.3.1.1.1. Ch nng

hn IC PT2262

- A0 A5 (1-6): dng nhp m a ch, trn mi chn c th c 3 trng


thi, cho ni masse l bit 0, cho ni vo ngun dng l bit 1 v b
trng l bit F.

iu khin mt s thit b gia nh thng qua sng v tuyn

31

- A6/D5 A11/D0 (7-13): c th dng nh cc chn a ch t A6 n


A11, nhng khi dng nh chn nhp d liu th ch xc lp theo mc 0
v mc 1, ch c 2 trng thi 0 hoc 1.
- /TE (14): dng cho xut nh m xung m lnh, n c tc dng mc p
thp ( ni masse). Ngha l khi chn ny mc p thp, n s cho xut
ra xung m lnh trn chn Dout.
- OSC1(15) v OSC2(16): dng gn in tr R nh tn cho xung
nhp, dng to ra cc dy xung m lnh. Tn s xung nhp phi ly
tng thch gia bn pht v bn nhn. Tn s s ng mang dao ng
c quyt nh bi R chn 15 v 16 v c tnh bng : f = R/12 .
V d : Mc in tr 470k vo chn 15 v 16 u ra chn 17 s c
470/12 = khong 39Khz
- Dout(17): l chn ng ra ca nh m tn hiu m lnh, cc tn hiu m
lnh u dng xung, ngha l lc mc p thp, lc mc p cao.
- Vcc(18) ni vi ngun (3v-15v).
- Vss(9) ni masse.
Cc chn t A0 n A7 c s dng nh l cc chn m h a. Nu cc
chn ny mch PT2262 c dng nh th no th mch PT2272 cng
c dng nh vy. Khi th cc mch pht v mch thu s hiu nhau, cn
cc mch pht khc s khng nhn ra.
Cc chn 10 n 13 l cc chn data khi truyn. Nh vy IC ny c th
truyn song song 4 bit.

iu khin mt s thit b gia nh thng qua sng v tuyn

32

Hnh 3.3: Cu to IC PT2262

3.3.1.1.2. M t ch nng :
PT2262 m h a cc m a ch v d liu t A0 ~ A5 v A6/D5 ~
A11/D0 thnh mt dng s ng c bit v kt qu u ra n chn DOUT khi
chn / TE c ko v 0 (mc thp). Dng s ng ny c a vo b iu
bin RF hoc my pht hng ngoi truyn. Sng v tuyn hoc tia hng
ngoi c gii iu ch RF hoc IR bng IC PT2272
3.3.1.1.3. Hot ng :
M bit
Mt M Bit l thnh phn c bn ca cc dng s ng c m ha, c th
c phn loi l mt Bit AD (a ch / d liu) hoc Bit SYNC (ng b).

iu khin mt s thit b gia nh thng qua sng v tuyn

33

- Dng sng ca Bit AD (Bit a ch/ d liu)


: chu k dao ng

Hnh 3.4: dng sng Bit AD


Mt Bit AD c th c ch nh l Bit 0, 1 hoc f nu n trng
thi thp, cao hoc trng.
- Dng sng ca Bit SYNC (Bit ng b)
Dng sng Bit ng b l 4 bit di vi chu k dao ng bng 1/8 rng bit.
1 bit = 32

Hnh 3.5: Dng sng Bit SYNC


M WORD
Mt nhm cc M bit c gi l M Word. Mt M Word bao gm 12 bit
AD v theo sau l mt Bit Sync. 12 bit AD c xc nh bi chn tng ng
A0 ~ A5 v A6/D5 ~ A11/D0. Khi kiu d liu ca PT2262 c s dng,
cc bit a ch s gim cho ph hp.
V d: Trong khi truyn 3 bit d liu v 9 bit a ch th dng m nh sau:

PT2262 / PT2272 c ti a l 12 Bit a ch trong c 6 bit AD

Hnh 3.6: Mt m word hon chnh


iu khin mt s thit b gia nh thng qua sng v tuyn

34

M Frame
Mt M Frame bao gm 4 m Word lin tc. Khi PT2262 pht hin / TE
mc thp, n to ra m Frame ti chn DOUT. Nu / TE vn mc thp ti
thi im truyn M Frame kt thc, PT2262 s tip tc truyn mt m Frame
khc. M Frame c tng hp trong khi truyn.

Hnh 3.7: Truyn mt m Frame


in tr dao ng
Mch dao ng ca PT2262 cho php to dao ng chnh xc bng cch kt
ni mt in tr bn ngoi gia chn OSC1 v chn OSC2. Cho PT2272
gii m chnh xc nhn dng sng, tn s dao ng ca PT2272 phi gp
2,5 ~ 8 ln so vi tn s truyn ca PT2262.

Hnh 3.8: in tr dao ng ca cp IC PT2262 PT2272


Bng 3.1: Gi tr in tr dao ng tng ng
* - PT2272 hot ng trong di in p = 5V-15V
** - PT2272 hot ng trong di in p = 3V-15V

iu khin mt s thit b gia nh thng qua sng v tuyn

35

3.3.1.1.4 . Lu thut ton


Bt u

TrngThi
thi Ch
ch
Trng

No

/TE cho php


(chn /TE mc thp)

Yes

M ha v xut tn hiu

Kt thc

Hnh 3.9: Lu thut ton ca PT2262

iu khin mt s thit b gia nh thng qua sng v tuyn

36

3.3.1.2. S m h m ha v pht sng v tuyn

Hnh 3.10: S nguyn l mch m ha v pht sng v tuyn


Khi m ha s dng IC PT2262 nhn tn hiu t 4 nt bm, sau iu
ch tn hiu theo phng php ASK ri a ra b pht sng v tuyn.

Hnh 3.11: S nguyn l module pht RF 315MHz

iu khin mt s thit b gia nh thng qua sng v tuyn

37

Mch pht c mc theo kiu khuch i E chung. Cryst1 l thch anh to


dao ng, tn s 315Mhz, khi c cp in n t dao ng to ra sng hnh
sin.
Transistor S9018 l transistor khuch i cao tn, khuch i tn hiu t
thch anh v tn hiu u ra ly chn C ca transistor.
R2 l in tr to in p chun cho thch anh, R3 nh dng cho chn E
ca transistor.

Hnh 3.12: Module pht RF 315MHz thc t

3.3.1.3. Tnh ton


in p : DC 3 ~ 5V
Dng in 3 mA (DC 5V)
Cng sut pht 10mW
Tn s hot ng f=315Mhz
Cng sut my pht (cng sut c ch) :
Cng sut tiu th :
Hiu sut my pht :
Bc s ng :

Chn anten c di bng 1/4 bc s ng l 0,23m (23cm)


3.3.2. Khi thu v gii m sng v tuyn
3.3.2.1. Ic PT2272
PT2272 l IC gii m iu khin t xa kt hp vi IC m ha PT2262. S
chn a ch cng ging nh PT2262 l c ti 12 chn a ch v 531411 m
iu khin mt s thit b gia nh thng qua sng v tuyn

38

a ch. PT2272 c sn nhiu la chn ph hp vi nhu cu ng dng: thay


i s lng cc chn d liu u ra, loi c cht (L) ng ra hoc loi tm
thi (M) u ra.
C loi PT2272:
PT2272-M2; PT2272-L2

PT2272-M3; PT2272-L3

PT2272-M4; PT2272-L4

PT2272-M5; PT2272-L5

PT2272-M6; PT2272-L6

Hnh 3.13: IC PT2272 loi M4 v L4

3.3.2.1.1 Ch nng

hn IC PT2272

- A0 A7 (1-8): dng nhp m a ch, trn mi chn c th c 3 trng


thi, cho ni masse l bit 0, cho ni vo ngun dng l bit 1 v b
trng l bit F.
- D3 D0 (10-13): c th dng nh cc chn a ch, nhng khi dng
nh chn nhp d liu th ch xc lp theo mc 0 v mc 1.
- DIN (14): Tn hiu nhn c sau khi loi b s ng mang thnh tn hiu
iu khin s c a vo chn ny.
- OSC1 (15) v OSC2 (16): dng gn in tr nh tn cho xung nhp,
xung nhp ny cn thit cho hot ng ca IC.
- VT (17): khi chn ny mc cao th tn hiu nhn c l hp l.
- Vcc (18): ni vi ngun (4v-15v).
- Vss (9): ni masse.
iu khin mt s thit b gia nh thng qua sng v tuyn

39

Nh vy chn 17 PT 2272 s ln mc 1 khi nhn c d liu ng. Cc


chn 10 n 13 s nhn data v th hin mc logic tng ng khi nhn.

Hnh 3.14: Cu to IC PT2272


3.3.2.1.2 M t ch nng, hot ng :
PT2272 gii m cc dng s ng c nhn v a vo chn DIN. Cc dng
s ng c gii m gm cc m word c cha a ch, d liu v cc bit ng
b. Cc bit a ch gii m c so snh s thit lp ti a ch chn u vo.
Nu c hai a ch ph hp , PT2272 s xut d liu ra chn tng ng vi bit
d liu sau a u ra VT ln mc cao.

ta = 8 chu k dao ng

tc = thi gian truyn 2 m word

iu khin mt s thit b gia nh thng qua sng v tuyn

40

tb = 1 chu k dao ng
Hnh 3.15: Hot ng ca PT2272

3.3.2.1.3. PT2272 loi cht v loi tm thi (Latch - Momentary)


PT2272 gm loi cht d liu u ra hoc loi gi d liu u ra tm thi.
- Loi cht (PT2272-LX) xut cc d liu ra trong qu trnh truyn v d
liu ny c duy tr trong b nh cho n khi d liu khc c nhp
hoc nhp vo.
- Loi tm thi (PT2272-MX), xut cc d liu ra ch trong qu trnh
truyn. cc d liu khng cn trong b nh sau khi truyn xong.

T = thi gian truyn 2 m word


Hnh 3.16: Hot ng ca PT2272 loi MX v LX

iu khin mt s thit b gia nh thng qua sng v tuyn

41

3.3.2.1.4. Lu thut ton


Bt u

Trng thi ch
V hiu ha chn VT

No
C tn hiu?

Yes

o snh a ch bit

No

Yes
a ch n V
n c cao
Xut tn hiu ra cc chn
DATA out

Kt thc

Hnh 3.17: Lu thut ton PT2272

iu khin mt s thit b gia nh thng qua sng v tuyn

42

3.3.2.2. S mch thu v gii m sng v tuyn

Hnh 3.18: Khi thu RF


Khi thu s dng mch thu sng cao tn (mch thu siu ti sinh) tn hiu thu
c a qua IC LM358 khuch i v so snh in p ly ra mc tn
hiu 0,1 a vo PT2272 gii m.

Hnh 3.19: Module thu RF thc t


iu khin mt s thit b gia nh thng qua sng v tuyn

43

Hnh 3.20: Khi thu RF kt ni vi vi iu khin

3.3.2.3. Tnh ton


Module thu RF 315Mhz:
Hot ng in p: DC 3 ~ 5V.
Dng in 3 mA (DC 5V).
Hot ng tn s: 315Mhz
Ch iu ch: ASK / OOK.
nhy: -105 dBm
nhy my thu l kh nng thu c tn hiu nh nht u vo m my
thu cho ra c mc tn hiu b ch th bnh thng.
Phm vi thu 100m i vi khng gian m.
Anten s dng l loi anten rt, di 23cm.

iu khin mt s thit b gia nh thng qua sng v tuyn

44

3.3.3. Khi x l trung tm


Cc loi vi iu khin PIC hay AVR c nhiu u im hn so vi 8051 nh
h tr kt ni ngoi vi tt hn, tc x l nhanh hn, lp trnh n gin hn.
Tuy nhin ngi thc hin n s dng vi iu khin AT89S52-chp lp
trnh chuyn dng, ph thng, ph hp vi yu cu ti. ng thi gip
ngi thc hin ti ng dng mt cch thit thc kin thc c hc vo
thc t.
3.3.3.1.Gii thiu i i u Khin T89S52
AT89S52 l h IC vi iu khin 8051 do hng Atmel sn xut. Cc sn
phm AT89S52 thch hp cho nhng ng dng iu khin. Vic x l trn
byte v cc ton s hc cu trc d liu nh c thc hin bng nhiu ch
truy xut d liu nhanh trn RAM ni. Tp lnh cung cp mt bng tin
dng ca nhng lnh s hc 8 bit gm c lnh nhn v lnh chia. N cung cp
nhng h tr m rng trn chip dng cho nhng bin mt bit nh l kiu d
liu ring bit cho php qun l v kim tra bit trc tip trong h thng iu
khin.
AT89S52 cung cp nhng c tnh chun nh: 8 KByte b nh ch c c
th xa v lp trnh nhanh (EPROM), 128 Byte RAM, 32 ng I/O,
3TIMER/COUNTER 16 Bit, 5 vect ngt c cu trc 2 mc ngt, mt Port
ni tip bn song cng, 1 mch dao ng to xung Clock v b dao ng
ON-CHIP.
Cc c im ca chip AT89S52 c tm tt nh sau:
8 KByte b nh c th lp trnh nhanh, c kh nng ti 1000 chu
k ghi/xo
Tn s hot ng t: 0Hz n 24 MHz
3 mc kha b nh lp trnh
3 b Timer/counter 16 Bit
128 Byte RAM ni.
4 Port xut /nhp I/O 8 bit.
Giao tip ni tip.
64 KB vng nh d liu ngoi.
4s cho hot ng nhn hoc chia
iu khin mt s thit b gia nh thng qua sng v tuyn

45

Hnh 3.21: S khi AT89S52

3.3.3.2. S hn T89S52
Mc d cc thnh vin ca h 8051 (v d 8751, 89S52, 89C51, DS5000)
u c cc kiu ng v khc nhau, chng hn nh hai hng chn DIP (Dual
In-Line Pakage), dng v dt vung QPF (Quad Flat Pakage) v dng chip
khng c chn LLC (Leadless Chip Carrier) th chng u c 40 chn cho
cc chc nng khc nhau nh vo ra I/O, c RD , ghi WR , a ch, d liu
v ngt. Cn phi lu mt s hng cung cp mt phin bn 8051 c 20 chn
vi s cng vo ra t hn cho cc ng dng yu cu thp hn. Tuy nhin v
iu khin mt s thit b gia nh thng qua sng v tuyn

46

hu ht cc nh pht trin s dng chip ng v 40 chn vi hai hng chn


DIP nn ngi thc hin ti ch tp trung m t phin bn ny.

Hnh 3.22: S cc chn AT89S52


3.3.3.3. Ch nng ca cc chn AT89S52
Port 0: T chn 32 n chn 39 (P0.0_P0.7). Port 0 c 2 chc nng: trong
cc thit k c nh khng dng b nh m rng n c chc nng nh cc
ng IO, i vi thit k ln c b nh m rng n c kt hp gia bus
a ch v bus d liu.
Port 1: T chn 1 n chn 9 (P1.0 _ P1.7). Port 1 l port IO dng cho giao
tip vi thit b bn ngoi nu cn.
Port 2: T chn 21 n chn 28 (P2.0 _P2.7). Port 2 l mt port c tc dng
kp dng nh cc ng xut/nhp hoc l byte cao ca bus a ch i vi
cc thit b dng b nh m rng.
Port 3: T chn 10 n chn 17 (P3.0 _ P3.7). Port 3 l port c tc dng
kp.Cc chn ca port ny c nhiu chc nng, c cng dng chuyn i c
lin h n cc c tnh c bit ca 89S52 nh bng 2.2:

iu khin mt s thit b gia nh thng qua sng v tuyn

47

ng 3.2 : h c n ng cc ch n c a Po t 3

Chc nng

Chn

Tn

P3.0

RxD

Ng vo Port ni tip

P3.1

TxD

Ng ra Port ni tip

P3.2

INT0

Ng vo ngt ngoi 0

P3.3

INT1

Ng vo ngt ngoi 1

P3.4

T0

Ng vo bn ngoi ca b nh thi 1

P3.5

T1

Ng vo bn ngoi ca b nh thi 0

P3.6

WR

iu khin ghi b nh d liu ngoi

P3.7

RD

iu khin c b nh d liu ngoi

PSEN (Program store enable): PSEN l tn hiu ng ra c tc dng cho php


c b nh chng trnh m rng v thng c ni n chn OE ca
Eprom cho php c cc byte m lnh.PSEN mc thp trong thi gian
89S52 ly lnh. Cc m lnh ca chng trnh c c t Eprom qua bus d
liu, c cht vo thanh ghi lnh bn trong 89S52 gii m lnh. Khi
89S52 thi hnh chng trnh trong ROM ni, PSEN mc cao.
ALE (Address Latch Enable): Khi 89S52 truy xut b nh bn ngoi, Port 0
c chc nng l bus a ch vd liu do phi tch cc ng d liu v a
ch. Tn hiu ra ALE chn th 30 dng lm tn hiu iu khin gii a
hp cc ng a ch v d liu khi kt ni chng vi IC cht. Tn hiu
chn ALE l mt xung trong khong thi gian port 0 ng vai tr l a ch
thp nn cht a ch hon ton t ng.
EA (External Access): Tn hiu vo EA (chn 31) thng c mc ln mc
1 hoc mc 0. Nu mc 1, 89S52 thi hnh chng trnh t ROM ni. Nu
mc 0, 89S52 thi hnh chng trnh t b nh m rng. Chn EA c ly
lm chn cp ngun 21V khi lp trnh cho Eprom trong 89S52.
RST (Reset): Khi ng vo tn hiu ny a ln mc cao t nht 2 chu k
my, cc thanh ghi bn trong c np nhng gi tr thch hp khi ng
h thng. Khi cp in mch phi t ng reset.
iu khin mt s thit b gia nh thng qua sng v tuyn

48

Hnh 3.23: Mch Reset vi iu khin


Cc ng vo b dao ng X1, X2: B to dao ng c tch hp bn trong
89S52. Khi s dng 89S52, ngi ta ch cn ni thm thch anh v cc t.
Tn s thch anh ty thuc vo mc ch ca ngi s dng, gi tr t thng
c chn l 33p.

Hnh 3.24: Mch kt ni thch anh cho vi iu khin

iu khin mt s thit b gia nh thng qua sng v tuyn

49

3.3.4. Khi hin th


LCD hin th c nhiu thng tin, d kt ni vi vi iu khin. Trong
h thng ny s dng LCD 16x2.

Hnh 3.25: Khi hin th


LCD l t vit tt ca Liquid Crystal Display (mn hnh tinh th lng). C
nhiu loi mn hnh LCD vi cc kch c khc nhau, v d nh LCD 16x1 (16
ct v 1 hng), LCD 16x2 (16 ct v 2 hng), LCD 20x2 (20 ct v 2 hng)
Trong n ny s dng loi LCD 16x2- loi bn ph bin trn th trng.

iu khin mt s thit b gia nh thng qua sng v tuyn

50

LCD1

D0
D1
D2
D3
D4
D5
D6
D7
A
K
7
8
9
10
11
12
13
14
15
16

RS
RW
E
4
5
6

1
2
3

VSS
VDD
VEE

LCD16X2

Hnh 3.26: Hnh dng v s chn LCD 16x2

iu khin mt s thit b gia nh thng qua sng v tuyn

51

B ng 3.3: Ch c n ng ch n L D 16x2

Chn

K hiu

I/O

Chc nng

VSS

Ngun (GND)

VDD

Ngun (+ 5V)

VEE

Chnh tng phn

RS

0 : nhp lnh
1: nhp d liu

RW

0 : ghi d liu
1 : c d liu

I/O

Tn hiu cho php

D0

I/O

Bus d liu 0

D1

I/O

Bus d liu 1

D2

I/O

Bus d liu 2

10

D3

I/O

Bus d liu 3

11

D4

I/O

Bus d liu 4

12

D5

I/O

Bus d liu 5

13

D6

I/O

Bus d liu 6

14

D7

I/O

Bus d liu 7

15

Ngun n LCD
(+5V)

16

Ngun n LCD
(GND)

iu khin mt s thit b gia nh thng qua sng v tuyn

52

B ng 3.4: Tp lnh LCD 16x2

M (HEX)

Lnh thanh ghi LCD 16x2

Xa mn hnh hin th

Tr v u dng

Gim con tr (dch con tr sang tri)

Tng con tr (dch con tr sang phi)

Dch hin th sang phi

Dch hin th sang tri

Tt con tr, tt hin th

Tt hin th, bt con tr

Bt hin th, tt con tr

Bt hin th, nhp nhy con tr

Tt con tr, nhp nhy con tr

10

Dch v tr con tr sang tri

14

Dch v tr con tr sang phi

18

Dch ton b hin th sang tri

1C

Dch ton b hin th sang phi

80

p con tr v u dng th nht

C0

p con tr v u dng th hai

38

Hai dng v ma trn 5x7

iu khin mt s thit b gia nh thng qua sng v tuyn

53

3.3.5. Khi chp hnh


Trong phm vi n mn hc ny, s dng 4 relay m nhn chc
nng ng ngt 4 thit b in . Relay loi 12V DC vi u im: d s dng,
thng dng trn th trng, ph hp vi mc in p khi ngun v c th
chu c dng lm vic ln. C s dng thm cch ly quang OPTO cch ly
khi chp hnh v khi VK

Hnh 3.27: Khi chp hnh

iu khin mt s thit b gia nh thng qua sng v tuyn

54

3.3.6. Khi ngun


Khi ngun dng bin p loi 220VAC- 12VAC, 1A.S dng IC n p
7812 v 7805 to in p 12V DC n nh cp Role v 5V DC cp cho vi iu
khin AT89S52, LCD, hot ng.

Hnh 3.28: Khi ngun

iu khin mt s thit b gia nh thng qua sng v tuyn

55

CHNG 4
THI CNG MCH
4.1. S NGUYN L TON MCH

Hnh 4.1: S ton mch

iu khin mt s thit b gia nh thng qua sng v tuyn

56

4.2. S MCH IN
Mch nguyn l v mch in c thit k trn phn mm Protues 7.8 sp2
4.2.1. Mch Pht

Hnh 4.2: Mch in khi pht RF

Mch c kch c (6.1435 x 4.953) cm

Hnh 4.3: M phng 3D khi pht RF


iu khin mt s thit b gia nh thng qua sng v tuyn

57

Bng 4.1: Danh sch linh kin s dng trong mch pht

S th

Tn linh kin

S
ng

Module RF 315M

Nt nhn

Diode 1N4148

in tr 2,7K

in tr 4,7M

in tr ko 10K

PT2262

Led n

Thch anh 12 MHz

10

Pin 12V DC 23A

11

Anten

Hnh 4.4: Mch pht thc t


iu khin mt s thit b gia nh thng qua sng v tuyn

58

4.2.2. Mch thu, gii m, hin th, chp hnh v ngun

Hnh 4.5: Mch in khi thu, gii m, hin th, chp hnh v khi ngun
Mch c kch c (12.446 x 10.922) cm

iu khin mt s thit b gia nh thng qua sng v tuyn

59

Hnh 4.6: M phng 3D khi thu, gii m, hin th, chp hnh v khi ngun

iu khin mt s thit b gia nh thng qua sng v tuyn

60

Bng 4.2: Danh sch linh kin s dng trong mch thu
S th

Tn linh kin

S
ng

Module thu RF 315Mhz

PT 2272

VDK AT89S52

LCD 16x2

Role 12V DC

IC 7805

IC 7812

OPTO

Led n

10

Transistor C1815

11

Loa chip

12

Anten

13

Diode 1N4007

14

T ha 2200uF 16v

15

T ha 470uF 16v

16

T gm 104

17

T gm 33

18

Chit p vi chnh

19

in tr 10 ohm

20

in tr 100 ohm

21

in tr 330 ohm

22

in tr 1K ohm

23

in tr 10K ohm

24

in tr cng sut 33 ohm 2W

25

Jum 2

iu khin mt s thit b gia nh thng qua sng v tuyn

61

Hnh 4.7: Khi thu, gii m, chp hnh v ngun thc t


iu khin mt s thit b gia nh thng qua sng v tuyn

62

4.3. PHN TCH CHNG TRNH CHO VI IU KHIN


Yu cu chng trnh i v i vi iu khin:
Nhn tn hiu iu khin t khi thu RF.
Xut tn hiu iu khin thit b tng ng thng qua mch Relay
Cp nht v hin th trng thi thit b trn LCD.

iu khin mt s thit b gia nh thng qua sng v tuyn

63

u :
Begin

Khi to LCD

RL1; RL2; RL3; RL4


count1; count2; count3; count4

RL1=off; RL2=off; RL3=off; RL4=off


count1= count2= count3= count4= 0

sign1; sign2; sign3; sign 4

(sign1=0; sign2=0;

No

sign3=0; sign4=0) ?

Yes

Yes

Yes

No

Yes

No

No

End

Hnh 4.8: Lu thut ton khi x l


iu khin mt s thit b gia nh thng qua sng v tuyn

No

64

Code chng trnh cho vi iu khin :


#include <regx52.h>

#define on 0
#define off 1

#define RS P2_5

//RS=0 => code

#define RW P2_6

//RW=0 => ghi

//RS=1 => data


//RW=1 => doc

#define EN P2_7
#define LCD_PORT P0

sbit sign1=P1^0;
sbit sign2=P1^1;
sbit sign3=P1^2;
sbit sign4=P1^3;
sbit lamp1=P3^0;
sbit lamp2=P3^1;
sbit lamp3=P3^2;
sbit lamp4=P3^3;
int count1=0,count2=0,count3=0,count4=0;

//==========================
void delay_time(unsigned int time) // Thoi gian time ms
{
while (time--)
{
TH1=0xFC;
TL1=0x17;
TF1=0;//Xoa co tran
TR1=1;// Starting count
iu khin mt s thit b gia nh thng qua sng v tuyn

65

while(!TF1);
TR1=0;//Ngung timer 1
}
}
//================================
void delay_5ms()
{
int i,j;
for(i=0;i<250;i++)
for(j=0;j<4;j++){}
}
//===========================
void delay_15ms()
{
int i,j;
for(i=0;i<250;i++)
for(j=0;j<100;j++){}
}

//=========================== LCD ===============


//============================== GUI LENH CHO LCD
void LCD_CODE(unsigned char c)
{
RS=0;//code
RW=0;//ghi
LCD_PORT=c;
EN=1;
EN=0;
delay_5ms();
}
iu khin mt s thit b gia nh thng qua sng v tuyn

66

//=============================== KHOI TAO LCD


void LCD_INIT()
{
delay_15ms();
LCD_CODE(0x38); //che do 8bit,2 hang,kieu ky tu 5x8 diem anh.
LCD_CODE(0x0C); //hien thi man hinh,c con tro, con tro nhp'
nhy.
LCD_CODE(0x01); // Xoa man hinh LCD
}
//============================== IN KY TU
void LCD_DATA(unsigned char c)
{
RS=1;//data
RW=0;//ghi
LCD_PORT=c;
EN=1;
EN=0;
delay_5ms();
}
//=============================== IN CHUOI KY TU
void LCD_STRING(unsigned char *s)
{
while(*s) //den NULL thi thoi
{
LCD_DATA(*s);
s++;
}
}
///// chuong trinh chinh
void main(void)
{
iu khin mt s thit b gia nh thng qua sng v tuyn

67

sign1=0;sign2=0;sign3=0;sign4=0;
lamp1=off;
lamp2=off;
lamp3=off;
lamp4=off;
TMOD=0x10;//Timer 1 che do 1
LCD_INIT();
LCD_CODE(0x80);
LCD_STRING("DO AN TOT NGHIEP");

/////

TAO DAU 3 CHAM NHAY

LCD_CODE(0xC0);
LCD_STRING("

.");

delay_time(500);
LCD_CODE(0xC0);
LCD_STRING("

..");

delay_time(500);
LCD_CODE(0xC0);
LCD_STRING("

...");

delay_time(500);
////
LCD_CODE(0x01);/// xoa man hinh
LCD_CODE(0x80);
LCD_STRING("D.KHIEN THIET BI");
LCD_CODE(0xC0);
LCD_STRING(" BANG SONG RF");
delay_time(2000);

LCD_CODE(0x01);/// xoa man hinh


LCD_CODE(0x80);
iu khin mt s thit b gia nh thng qua sng v tuyn

68

LCD_STRING("GVHD: THAC SI");


LCD_CODE(0xC0);
LCD_STRING(" PHAM THI THU HA");
delay_time(2000);

LCD_CODE(0x01);/// xoa man hinh


LCD_CODE(0x80);
LCD_STRING("Sinh Vien:");
LCD_CODE(0xC0);
LCD_STRING(" PHAM XUAN TAM");
delay_time(2000);

LCD_CODE(0x01);/// xoa man hinh


LCD_CODE(0x80);
LCD_STRING("TRANG THAI CUA 4");
LCD_CODE(0xC0);
LCD_STRING(" THIET BI : ");
delay_time(500);

LCD_CODE(0X01);
LCD_STRING(" 1 2 3 4 ");
LCD_CODE(0xC0);
LCD_STRING(" OFF OFF OFF OFF");

while(1)
{
while(sign1==0&&sign2==0&&sign3==0&&sign4==0);
if(sign1==1)
{
if(count1==0)
iu khin mt s thit b gia nh thng qua sng v tuyn

69

{
lamp1=on;
count1=count1+1;
LCD_CODE(0xc1);
LCD_STRING("ON ");
delay_time(350);
}
else
{
lamp1=off;
count1=count1-1;
LCD_CODE(0xc1);
LCD_STRING("OFF");
delay_time(350);
}
while(sign1==1);
}
if(sign2==1)
{
if(count2==0)
{
lamp2=on;
count2=count2+1;
LCD_CODE(0xC5);
LCD_STRING("ON ");
delay_time(350);
}
else
{
lamp2=off;
iu khin mt s thit b gia nh thng qua sng v tuyn

70

count2=count2-1;
LCD_CODE(0xC5);
LCD_STRING("OFF");
delay_time(350);
}
while(sign2==1);
}
if(sign3==1)
{
if(count3==0)
{
lamp3=on;
count3=count3+1;
LCD_CODE(0xC9);
LCD_STRING("ON ");
delay_time(350);
}
else
{
lamp3=off;
count3=count3-1;
LCD_CODE(0xC9);
LCD_STRING("OFF");
delay_time(350);
}
while(sign3==1);
}
if(sign4==1)
{
if(count4==0)
iu khin mt s thit b gia nh thng qua sng v tuyn

71

{
lamp4=on;
count4=count4+1;
LCD_CODE(0xCD);
LCD_STRING("ON ");
delay_time(350);
}
else
{
lamp4=off;
count4=count4-1;
LCD_CODE(0xCD);
LCD_STRING("OFF");
delay_time(350);
}
while(sign4==1);
}
}
}

4.4. KIM TRA


Cc thng s o c mch thu:
Uv1 (in p xoay chiu khi qua bin p) = 12V AC
Uv2 (in p 1 chiu khi qua cu diode v t lc ) = 16V DC
Uv3 (in p 1 chiu khi qua IC 7812 ) = 12V DC
Dng in : I = 250mA
Cng sut tiu th ca ton mch : P = Uv3.I = 12.0,25 = 3W

iu khin mt s thit b gia nh thng qua sng v tuyn

72

CHNG 5
KT QU, HN CH V H NG PHT TRIN
5.1. KT QU
Qu trnh tm hiu v nghin cu hon thnh n gip ngi thc
hin cng c li kin thc c hc v m rng thm nhiu kin thc mi,
ng thi c dp c st vi thc t v rt ra c nhiu kinh nghim b ch.
Di s hng dn ca Ths Phm Th Thu H gip ngi thc hin hon
thin ti Thit k v thi cng mch iu khin mt s thit b gia nh
thng qua sng v tuyn
Sau nhiu tun tch cc tm hiu v n lc thc hin, ngi thc hin ti
hon thnh n ng theo yu cu v thi gian quy nh. Di y l
nhng kt qu t c cng nh u im ca mch n:
iu khin ng, ngt thit b in t xa thng qua sng v tuyn
315Mhz.
LCD gn trn board hin th trng thi thit b mt cch trc quan.
Board mch c thit k gn v sp xp hp l, d dng s dng v
mang tnh thm m kh cao.

5.2 HN CH V HNG PHT TRIN


Hn ch:
- Mi ch iu khin c 4 thit b in
- Ch iu khin c thit b 2 trng thi tt v m
- Cha c tnh nng bo ng khi c s c thit b iu khin.
- Phm vi hot ng ngn.
H ng pht trin :
- C th pht trin iu khin nhiu thit b hn .
- ng dng iu khin thit b t ng h a trong cng nghip .
- Xy dng sn phm hon thin hn c v phn cng v phm mm.
- Pht trin ln quy m iu khin ln hn, ng dng ngi nh thng minh.

iu khin mt s thit b gia nh thng qua sng v tuyn

73

TI LIU THAM KHO


1. Datasheet PT2262 http://www.alldatasheet.com/
2. Datasheet PT2272 http://www.alldatasheet.com/
3. Datasheet module thu pht RF 315 MHz http://www.datasheetarchive.com
4. Datasheet LCD 16x2 http://www.alldatasheet.com/
5. H Vi iu

hin

51, Tng Vn On NXB Lao ng X hi, 2005

6. Cu tr c v p trnh h vi iu hin 51, Nguyn Tng Cng - Phan


Quc Thng NXB Khoa hc v k thut, H Ni, 2004.
7. Bi ging l thuyt h thng thng tin / Dng Trn c - H Ni : Hc
vin Cng ngh Bu chnh Vin thng, 2009.
8. Bi ging l thuyt trng in t v siu cao tn / Ng c Thin,
Nguyn Qu S- H Ni : Hc vin Cng ngh Bu chnh Vin thng, 2009
9. Bi ging x l tn hiu s : Dng cho sinh vin h i hc ngnh in t
- Vin thng, in t v Cng ngh thng tin / H Thu Lan - H Ni : Hc
vin Cng ngh Bu chnh Vin thng, 2010
10. Ti liu tham kho t Internet:
http://www.scribd.com
http://www.dientu4u.com
http://www.dientuvietnam.net/

iu khin mt s thit b gia nh thng qua sng v tuyn