Cov txheej txheem:

EF230 Smart Home Project: 7 Kauj Ruam
EF230 Smart Home Project: 7 Kauj Ruam

Video: EF230 Smart Home Project: 7 Kauj Ruam

Video: EF230 Smart Home Project: 7 Kauj Ruam
Video: 20 MOMENTS YOU WOULDN'T BELIEVE IF NOT FILMED 2024, Kaum ib hlis
Anonim
EF230 Ntse Tsev Project
EF230 Ntse Tsev Project

Cov Khoom thiab Cov Khoom Xav Tau:

  • 1 Arduino MKR 1000
  • 3 Cov qhob cij
  • 2 Mini Photocells
  • 1 NPN Transistors
  • 1 Mini Hloov Hloov
  • 1 LED - RGB (4 prong)
  • 1 LED (xim uas koj xaiv)
  • 1 Diode 1N4148
  • 1 10K Ohm Resistors
  • 5 100 Ohm Resistor
  • 1 Kub Sensor TMP36
  • 1 DAGU 48: 1 Piv Gearmotor
  • 25 Jumper Xov
  • USB Qaum
  • MATLAB Program
  • SIK Kev Tshawb Fawb Qhia rau Arduino 101/Genuino 101 Pawg Thawj Coj - SIK Kev Tshawb Fawb Phau Ntawv Qhia Txuas

Txoj haujlwm no qhia meej txog lub tswv yim tsim ntawm lub tsev ntse uas yuav siv cov ntaub ntawv los pab cov tswv tsev ua kom zoo dua lawv lub zog siv thiab kev nyab xeeb. Nws suav nrog lub teeb pom kev zoo kom qhib teeb sab nraum zoov thaum hmo ntuj, lub teeb pom kev zoo rau kev nyab xeeb, thiab ntsuas kub thiab kiv cua rau kev ntsuas kub hauv tsev.

Kauj Ruam 1: Teeb Pom Kev Zoo LED

  • Kev teeb lub teeb pom kev zoo LED yog txhais tau tias yog sawv cev rau sab nraum zoov teeb ntawm lub tsev tuaj thaum hmo ntuj.
  • Thaum lub mini photocell hnov qhov txo qis ntawm lub teeb LED yuav ci.
  • Rau lub tsev ntse no muaj lub zog thiab kev nyab xeeb cuam tshuam. Nws yuav txuag hluav taws xob los ntawm kev tso lub teeb tawm thaum nruab hnub thiab yuav muab kev nyab xeeb ntxiv thaum hmo ntuj.
  • Cov kab hluav taws xob thiab teeb tsa rau qhov ib feem ntawm txoj haujlwm no tuaj yeem pom nyob hauv kev sim 7 hauv SIK Kev Tshawb Fawb Qhia.

Kauj ruam 2: Mini Hloov Hloov

  • Qhov hloov pauv yog thawj kauj ruam hauv kev ruaj ntseg ntawm lub tsev ntse.
  • Thaum qhib, qhov hloov pauv yuav pib teb cov lus nug rau tus neeg siv yog tias lawv xav nkag mus rau hom 'Tsev' lossis 'Nyob' hom.
  • Yog tias 'Lub Tsev' hom raug xaiv qhov kev nyab xeeb raug txiav txim siab tshem riam phom, tab sis xaiv 'Nyob' hom yuav tiv thaiv kev nyab xeeb.
  • Kev txuas rau ntu no ntawm txoj haujlwm tuaj yeem pom nyob hauv kev sim 6 hauv Phau Ntawv Qhia Kev Kuaj. Rau lub hom phiaj ntawm lub tsev ntse, LED's thiab lawv cov xov txuas uas pom hauv kev sim 6 tsis tas yuav suav nrog.

Kauj Ruam 3: Ob Daim Duab

Qhov thib ob Photocell
Qhov thib ob Photocell
  • Qhov thib ob photocell ua haujlwm ua lub ntsuas hluav taws xob rau kev ruaj ntseg ntawm lub tsev ntse.
  • Lub ntsuas ntsuas tsuas yog siv thaum lub kaw lus tso rau hauv 'Tawm' hom raws li tau piav qhia hauv cov kauj ruam dhau los.
  • Yog tias lub koob yees duab pom kev txo qis ntawm lub teeb nws tau txais, nws lees paub qhov no yog kev txav sab hauv tsev.
  • Kev teeb tsa rau ib feem ntawm txoj haujlwm no tuaj yeem pom nyob hauv kev sim 7 hauv SIK Kev Tshawb Fawb Qhia. Txawm li cas los xij, tsuas yog lub photocell thiab nws cov xov txuas yuav tsum tau suav nrog hauv cov thaiv.

Kauj Ruam 4: RGB LED

  • RGB LED tau siv ua ke nrog lub zog hloov hluav taws xob me me thiab daim duab thib ob rau kev nyab xeeb ntawm lub tsev ntse.
  • Peb qhov xim sib txawv tau siv los ua ntsuas rau cov neeg nyob hauv tsev ntse.
  • Thaum lub kaw lus tso rau hauv 'Tsev' hom, LED hloov xiav. Thaum lub kaw lus tso rau hauv 'Tawm' hom LED hloov ntsuab. Thaum lub photocell siv los ua lub ntsuas suab txav mus, lub teeb ci liab.
  • Txoj hlua rau RGB LED tuaj yeem pom hauv kev sim 3 ntawm SIK Kev Tshawb Fawb Qhia.

Kauj Ruam 5: Kub Sensor

  • Qhov ntsuas kub yog qhov tseem ceeb ntawm kev txuag hluav taws xob hauv tsev ntse.
  • Tus neeg nyob hauv tuaj yeem nkag tau qhov ntsuas kub xav tau rau lawv lub tsev thaum lub tsev ntse siv.
  • Qhov ntsuas kub yog qhov system paub deb npaum li cas qhov kub tiag tiag yog los ntawm qhov kub xav tau.
  • Teeb tsa lub ntsuas kub tuaj yeem nrhiav pom hauv kev sim 9 ntawm SIK Kev Tshawb Fawb Qhia.

Kauj Ruam 6: DAGU Gearmotor

DAGU Gearmotor Cov
DAGU Gearmotor Cov
  • Lub cav tso cai rau lub tsev ntse los tswj qhov ntsuas kub hauv tsev raws li qhov ntsuas kub xav tau thiab nyeem cov ntsuas kub.
  • Ua raws li AC chav nyob hauv tsev, lub cev muaj zog yuav tig ntawm qhov sib txawv raws qhov ntsuas kub qhov tseeb ntau dua li qhov xav tau kub. Qhov sib txawv ntau dua, nws ua kom lub cav nrawm dua.
  • Txoj hlua rau lub cav tuaj yeem pom nyob hauv Phau Ntawv Qhia Kev sim hauv kev sim 11.

Kauj ruam 7: Code

  • Txoj cai rau lub tsev ntse suav nrog ntau tus neeg siv cuam tshuam uas tso cai rau tus neeg nyob hauv kom nkag siab yooj yim nws ua haujlwm li cas thiab hloov pauv qhov chaw yooj yim.
  • Nrog lub tsev ntse, cov neeg nyob hauv yuav tau txais thiab email ceeb toom yog tias lub suab ntsuas tau teeb tsa thaum lawv tsis nyob.
  • Qhov kev hloov pauv nkaus xwb uas yuav tsum tau ua yog sau cov ntaub ntawv rau tus xa email thiab tus tau txais email chaw nyob.

clear ib; meej s; meej m; clc; kaw tag nrho; % Ntshiab arduino thiab servo hloov pauv kom lawv tuaj yeem rov txhais dua txhua lub sijhawm yog li cov cai yuav ua haujlwm tau zoo ("meej m" yog qhov tsim nyog rau ib qho ntawm lub sijhawm ua haujlwm kom raug) a = arduino (); % Teeb tsa qhov sib txawv ntawm arduino

s = servo (ib, 'D6'); % Teem servo sib txawv

% Pib email hloov pauv rau kev ruaj ntseg system ceeb toom email

email = {'ntxig rau tus neeg tau txais chaw nyob'}; % Array ntawm email kom muaj email ruaj ntseg xa mus rau

% Email nyiam qhov chaw teeb tsa tsim nyog rau siv Gmail xa ntawv los ntawm

setpref ('Internet', 'E_mail', 'tus xa email chaw nyob');

setpref ('Internet', 'SMTP_Username', 'sender's username');

setpref ('Internet', 'SMTP_Password', 'tus xa tus password');

cov khoom = java.lang. System.getProperties;

props.setProperty ('mail.smtp.auth', 'tseeb');

props.setProperty ('mail.smtp.socketFactory.class', 'javax.net.ssl. SSLSocketFactory'); props.setProperty ('mail.smtp.socketFactory.port', '465');

% Email kawm thiab cov ntawv hloov pauv

subj = 'Kev ceeb toom nkag rau koj lub tsev';

text = 'Nyob zoo, Nov yog koj li Smart Home security system ceeb toom rau koj tias tau muaj cov lus tsa suab pom sab nraum koj lub tsev. Peb tau ua cov kev ntsuas tsim nyog thiab hu rau cov tub ceev xwm rau koj. Nyob nyab xeeb. ';

thaum muaj tseeb

sai = {'Nkag mus rau qhov xav tau kub hauv tsev (ntawm 65F thiab 85F):'}; % Ceev rau cov neeg siv cov ntawv qhia zaub mov

dlgtitle = 'Xaiv Qhov Kub'; % Title rau cov neeg siv cov ntawv qhia zaub mov

cov = [1 30]; % Qhov ntev rau cov neeg siv cov ntawv qhia zaub mov

cov ntsiab lus = {'72'}; % Lub tswv yim tsis raug uas pom tshwm thaum ntawv qhib thawj zaug

tempsel_array = inputdlg (tam sim, dlgtitle, dims, ntsiab lus); % Popup cov neeg siv cov ntawv qhia zaub mov uas yuav txuag tus lej nkag mus rau hauv ib qho array

yog ~ isempty (tempsel_array) % Yog hais tias qhov array tsis khoob

tempsel_char = cell2mat (tempsel_array); % Hloov cov array mus rau ib txoj hlua

tempsel = str2double (tempsel_char); % Hloov cov kab ntawv ua cim rau tus lej

thingSpeakWrite (chID, tempsel, 'WriteKey', writeKey, 'Field', 1); % Sau qhov ntsuas kub tau xaiv rau koj qhov ThingSpeak channel

tawg % Ua txhaum los ntawm lub voj thaum cov ntawv qhia zaub mov yuav tsis tshwm ntau zaus

lwm tus % Yog tias tus neeg siv nyem rho tawm es tsis txhob nkag mus rau qhov ntsuas kub

msg1 = msgbox ('Tsis tau xaiv qhov kub, ua rau 85F', 'Ceeb Toom!'); % Cov lus pom rau tus neeg siv tom qab nyem rho tawm

tos rau (msg1); % Tos rau lub thawv ntawv kaw ua ntej txuas ntxiv

cov = 85; % Teeb qhov ntsuas kub kom zoo raws li tau teev tseg hauv lub thawv ntawv

thingSpeakWrite (chID, tempsel, 'WriteKey', writeKey, 'Field', 1); % Sau qhov ntsuas kub tau xaiv rau koj qhov ThingSpeak channel

tawg % Ua txhaum los ntawm lub voj thaum cov ntawv qhia zaub mov yuav tsis tshwm ntau zaus

kawg

kawg

thaum muaj tseeb

chID = 745517; % ThingSpeak Channel ID

writeKey = 'G9XOQTP8KOVSCT0N'; % Qhov tseem ceeb rau kev nkag mus rau ThingSpeak Channel

% Pib ua cov ntsuas kom mus nqa cov ntaub ntawv

temporary = readVoltage (a, 'A3'); % Nyeem qhov hluav taws xob ntawm qhov ntsuas kub

lightl1 = readVoltage (a, 'A2'); % Lub teeb theem rau tus kws kho qhov muag mus rau tus liab LED

lightl2 = readVoltage (a, 'A5'); % Lub teeb theem rau tus kws yees duab mus rau qhov kev nyab xeeb

switchv = readVoltage (a, 'A0'); % Tus nqi rau qhov hloov

% Hloov cov ntaub ntawv kub ntawm qhov hluav taws xob mus rau degrees Fahrenheit

tempC = (temperate - 0.5) * 100; % Hloov qhov hluav taws xob mus rau qhov kub hauv Celsius

tempF = (tempC * 9/5) + 32; % Hloov qhov kub hauv Celsius mus rau qhov kub hauv Fahrenheit

% Pib tus lej tus lej rau ntau xim LED

liab = 'D9'; % Pin rau lub teeb liab los ntawm LED

ntsuab = 'D10'; % Pin rau lub teeb ntsuab los ntawm LED

xiav = 'D11'; % Pin rau lub teeb xiav los ntawm LED

yog tempsel <tempF % Yog tias qhov ntsuas kub tau xaiv ntau dua li chav sov

sauPosition (s, 1); % Servo yuav pib txav mus

ncua (10) % Servo yuav tig rau 10 vib nas this los sawv cev tias AC yuav tua tom qab lub sijhawm tshwj xeeb

sauPosition (s, 0); % Tua tawm kiv cua rau lub hom phiaj ntawm txuas ntxiv cov lej yam tsis muaj kiv cua

ntev = 150; % Hloov qhov ntsuas kub kom tawg tawm ntawm lub voj tom qab lub kiv cua tau kaw, dua li tsuas yog rau lub hom phiaj ntawm txuas ntxiv cov cai

kawg

yog lightl1 <= 3 % Yog tias thawj tus kws kho qhov muag pom lub teeb qis

writeDigitalPin (a, 'A1', 1); % Qhib LED liab uas sawv cev rau sab nraum zoov

lwm % Yog tias lub teeb qib siab dua

writeDigitalPin (a, 'A1', 0); % Tua liab liab thaum lub teeb pom kev siab dua ntxiv

kawg

yog switchv> 3 % Yog tias qhov hloov pauv tau qhib

A = muaj nyob ('m', 'var'); % Txheeb xyuas qhov muaj nyob ntawm qhov sib txawv 'm', qhov no yuav pib ua ntej rau lub sijhawm thiab tso cai rau nws tawg thaum xaiv cov ntawv qhia zaub mov (qhov no yog vim li cas meej m yuav tsum tau ua thaum pib ntawm txoj cai)

thaum A == 0 % Loop yuav ua kom txog thaum sib txawv 'm' muaj

menutext = 'Hom kev nyab xeeb twg koj xav nkag mus?'; % Cov ntawv rau kev ruaj ntseg popup ntawv qhia zaub mov

xaiv = {'Tsev', 'Nyob deb'}; % Kev xaiv rau cov ntawv qhia zaub mov ruaj ntseg

m = menu (menutext, xaiv); % Cov ntawv qhia zaub mov rau hom kev ruaj ntseg system

so % Ua kom ntseeg tau tias lub voj voos tawg yog li cov ntawv qhia zaub mov yuav tsis tshwm ntau zaus

kawg

yog m == 1 % Yog hom 'Tsev' raug xaiv

writeDigitalPin (a, bluep, 1); % Qhib tsuas yog lub teeb xiav hauv cov xim hloov LED

writeDigitalPin (a, redp, 0);

writeDigitalPin (a, greenp, 0);

elseif m == 2 % Yog hom 'Nyob' xaiv

writeDigitalPin (a, bluep, 0);

writeDigitalPin (a, redp, 0);

writeDigitalPin (a, greenp, 1); % Qhib tsuas yog lub teeb ntsuab hauv cov xim hloov LED

yog tias lightl2 <= 3 % Yog tias lub teeb pom kev hauv lub photoresistor thib ob qis, sawv cev rau cov lus pom los ntawm kev ruaj ntseg

xa ntawv (email, subj, ntawv nyeem); % Xa email nrog rau yav dhau los txhais email thaj chaw writeDigitalPin (a, greenp, 0); % Flash liab xim rau thiab tawm 2 zaug

writeDigitalPin (a, redp, 1);

ncua (0.3)

writeDigitalPin (a, redp, 0);

ncua (0.3)

writeDigitalPin (a, redp, 1);

ncua (0.3)

writeDigitalPin (a, redp, 0);

ncua (0.3)

writeDigitalPin (a, redp, 1); % Ua kom tiav nrog cov xim liab tom qab teeb pom kev kom pom tias muaj cov lus tsa suab kom txog thaum lub teeb qib rov qab mus

msg2 = msgbox ('Intruder kuaj pom los ntawm kev ruaj ntseg, email tau xa mus rau tus tswv tsev kom qhia rau lawv.', 'CEEB TOOM!'); % Lub npov xov xwm qhia rau tus neeg siv cov lus tsa suab thiab qhia txog email xa tos rau (msg2) % Tos rau lub thawv ntawv kaw ua ntej txuas ntxiv

lwm tus

writeDigitalPin (a, greenp, 1); % Thaum lub teeb theem tau nce ntxiv nws yuav tig rov los rau ntsuab

kawg

kawg

elseif switchv <3.3 % Yog hais tias tus tes hloov yog muab tua

writeDigitalPin (a, bluep, 0); % Tua lub LED kom tag los qhia qhov kev ruaj ntseg kaw

writeDigitalPin (a, redp, 0);

writeDigitalPin (a, greenp, 0);

kawg

kawg

Pom zoo: