Cov txheej txheem:

Zog Txuag 3000: 7 Cov Kauj Ruam
Zog Txuag 3000: 7 Cov Kauj Ruam

Video: Zog Txuag 3000: 7 Cov Kauj Ruam

Video: Zog Txuag 3000: 7 Cov Kauj Ruam
Video: MV Nkauj ntsuab Nraug nab 2018 | Hwj huaj kev hlub 2018 2024, Kaum ib hlis
Anonim
Zog Txuag 3000
Zog Txuag 3000

Adrien Green, Huy Tran, Jody Walker

Kev siv Raspberry Pi computer thiab Matlab yog txoj hauv kev yooj yim thiab muaj txiaj ntsig los pab cov tswv tsev txo qis kev siv hluav taws xob. Qhov zoo tshaj plaws txog Kev Siv Hluav Taws Xob 3000 yog tias nws yooj yim heev rau teeb tsa thiab siv. Lub hom phiaj tseem ceeb ntawm Energy Saver 3000 yog tso cai rau cov tswv tsev tuaj yeem taug qab lawv daim nqi hluav taws xob kom pom tias lawv tau siv nyiaj ntau npaum li cas, thiab tso cai rau cov tswv tsev tua lub teeb nyob hauv tsev ntawd nyob deb nrog nias lub pob.

Kauj Ruam 1: Cov Khoom Siv

Qhov Siv
Qhov Siv
Qhov Siv
Qhov Siv
Qhov Siv
Qhov Siv

1: Raspberry Pi lub computer

2: Breadboard

3: Jumper xov hlau

4: Laub khawm

5: Mini LED teeb

6: 330 ohm, 10 Kohm, thiab 300 ohm resistor

7: Ethernet Cable

8: Lub teeb photocell

Kauj Ruam 2: Nqe Lus Teeb Meem

Peb tes num yog los tsim lub zog txuag hluav taws xob hauv tsev siv Raspberry Pi computer thiab MATLAB. Peb lub hom phiaj yog tsim kom muaj cov kab ke uas tso cai rau cov neeg siv taug qab lawv daim nqi hluav taws xob kom pom tias lawv tuaj yeem txo lawv cov kev siv hluav taws xob. Peb kuj xav kom cov neeg siv tuaj yeem kaw lawv lub teeb thaum lawv tau ploj mus nrog nias lub pob. Txhawm rau ua qhov no, peb tau txuas lub koob yees duab kom pom thaum lub teeb qhib. Yog tias lub teeb tau qhib, MATLAB qhov kev zov me nyuam yuav suav tias lawv tau nyob ntev npaum cas thiab siv zog thiab nyiaj txiag npaum li cas txij li lawv tau ua.

Kauj ruam 3: Teeb

Teeb
Teeb

Xaim kab ntawv ci raws li qhia hauv daim duab saum toj no.

Kauj Ruam 4: MATLAB Txoj Cai rau Kev Tswj Cov Duab

muaj nuj nqi control_light () rpi = raspi ();

writeDigitalPin (rpi, 12, 1)

lub sij hawm = 0

sum = 0 os

Sijhawm = 0

Nqi = 0

teeb = 100/1000;% kilowatts

rau kuv = 1: 2

tic ua

thaum muaj tseeb

x = readDigitalPin (rpi, 13)

os x == 1

writeDigitalPin (rpi, 19, 1)

elseif x == 0

writeDigitalPin (rpi, 19, 0)

toc;

sij hawm = sij hawm + toc

kwh = toc * noob

duas = 0.101

cost = kwh * duas

sumcost = sumcost + nqi

X = linspace (Sijhawm, sijhawm, 10)

Y = linspace (Tus nqi, sumcost, 10)

Sijhawm = sijhawm

Tus nqi = sumcost

disp (['Lub teeb tau qhib rau', num2str (toc), 'teev. Tus nqi = $', num2str (tus nqi)])

lub ntsiab lus (X, Y, 'b') lub npe ('Tus Nqi Sijhawm')

xlabel ('Sijhawm (Teev Sijhawm)'))

ylabel ('Tus nqi ($ Daws las)')

tuav

so

kawg

kawg

ncua (5)

tic ua

thaum muaj tseeb

x = readDigitalPin (rpi, 13)

os x == 1

writeDigitalPin (rpi, 19, 1)

elseif x == 0

writeDigitalPin (rpi, 19, 0)

toc;

time = Sijhawm + toc

kwh = toc * noob

duas = 0.101

cost = kwh * duas

sumcost = Tus nqi + tus nqi

X = linspace (Sijhawm, sijhawm, 10)

Y = linspace (Tus nqi, sumcost, 10)

Sijhawm = sijhawm

Tus nqi = sumcost

disp (['Lub teeb tau qhib rau', num2str (toc), 'teev. Tus nqi = $', num2str (tus nqi)])

cov ntsiab lus (X, Y, 'g')

title ('Tus Nqi Sijhawm')

xlabel ('Sijhawm (Teev Sijhawm)'))

ylabel ('Tus nqi ($ Daws las)')

tuav

so

kawg

kawg

ncua (5)

kawg

Kauj Ruam 5: MATLAB Txoj Cai rau Teeb Teeb Tawm

muaj nuj nqi button_controlv1 ()

rpi = raspi (); cov

cov = 1;

thaum muaj tseeb % tsim lub voj tsis muaj qhov kawg kom cov cai ua haujlwm

khawm = readDigitalPin (rpi, 6); % Nyeem lub pob nyem nias tus lej ntawm tus lej 6

yog tias khawm == 0

cov = condi + 1

kawg

yog mod (condi, 2) == 0

writeDigitalPin (rpi, 17, 0)

h = msgbox ('Koj muab lub teeb tawm.:)') tos rau (h);

so

kawg

yog mod (condi, 2) == 1

writeDigitalPin (rpi, 17, 1)

kawg

kawg

Kauj Ruam 6: MATLAB Code rau Qhib Teeb

muaj nuj nqi button_controlv2 ()

rpi = npib ();

cov = 2;

thaum muaj tseeb % tsim lub voj tsis muaj qhov kawg kom cov cai ua haujlwm

khawm = readDigitalPin (rpi, 6); % Nyeem lub pob nyem tus lej ntawm tus lej 6

yog tias khawm == 0

cov = condi + 1

kawg

yog mod (condi, 2) == 0

writeDigitalPin (rpi, 17, 0)

kawg

yog mod (condi, 2) == 1

writeDigitalPin (rpi, 17, 1)

h = msgbox ('Koj tau qhib lub teeb.:(')

tos rau (h);

ncua (10)

so

kawg

kawg

Kauj Ruam 7: MATLAB Code rau GUI

Muaj nuj nqi EnergySaver3000 ()

imgurl = 'https://clipart-library.com/images/pc585dj9i.jpg';

imgfile = 'Lub teeb.jpg'; urlwrite (imgurl, imgfile);

imgdata = imread (imgfile);

h = msgbox ('Txais tos rau Lub Zog Txuag 3000!', '', 'kev cai', imgdata);

tos rau (h);

meej h;

thaum muaj tseeb

iprogram = ntawv qhia zaub mov ('Qhov program twg koj xav kom khiav?', 'Bill Calculator', 'Light Control');

yog iprogram == 1

control_light () h = msgbox ('Ua tiav !!!')

kaw tag nrho

lwm yam

iprogram == 2

kawg

meej h;

ichoice = ntawv qhia zaub mov ('Lub teeb tswj', 'Qhib', 'Tua Tawm', 'Tsis txhob xav li cas');

yog ichoice == 1

button_controlv2 ()

h = msgbox ('Ua tiav !!!')

elseif kev xaiv == 2

button_controlv1 ()

h = msgbox ('Ua tiav !!!')

elseif kev xaiv == 3

h = msgbox ('Koj tsis tau ua dab tsi:(') tos rau (h);

h = msgbox ('Ua tiav !!!')

kawg

tos rau (h);

kawg

kawg

Pom zoo: