Cov txheej txheem:

Dr Leej Twg Tardis Doorbell: 14 Kauj Ruam (nrog Duab)
Dr Leej Twg Tardis Doorbell: 14 Kauj Ruam (nrog Duab)

Video: Dr Leej Twg Tardis Doorbell: 14 Kauj Ruam (nrog Duab)

Video: Dr Leej Twg Tardis Doorbell: 14 Kauj Ruam (nrog Duab)
Video: leej twg tej ntxhai - Mang Vang [ Official MV ] 2024, Hlis ntuj nqeg
Anonim
Dr Who Tardis Doorbell
Dr Who Tardis Doorbell

Nov yog qhov haujlwm kuv tau tsim los tsim lub tswb qhov rooj Tardis. Nws yog lub tswb nrov wireless uas thaum nias ua suab los ntawm cov yeeb yam. Kuv tau kaw thiab siv lub suab los ntawm Matt Smith series vim tias qhov no yog khoom plig rau kuv tus viv ncaus thiab nws yog tus nyiam dr. Kuv tau ua cov vis dis aus youtube hauv qab no ntawm cov khoom tiav.

www.youtube.com/watch?v=3cZw3BYwqdc

Kauj Ruam 1: Txheeb Cov Khoom Case

Txiav Case Case
Txiav Case Case
Txiav Case Case
Txiav Case Case
Txiav Case Case
Txiav Case Case

Thawj qhov uas yuav tsum tau ua yog rooj plaub. Nov yog ntoo Tardis uas cov khoom siv hluav taws xob yuav zaum sab hauv. Koj tuaj yeem pom qhov no ntawm Etsy. Muaj ib lub khw hu ua Lazer Qauv uas muag cov lazer txiav ntoo qauv. Koj yuav xav tau cov kua nplaum ntoo thiab lub sijhawm me ntsis los tso txhua yam rau hauv qhov chaw thiab ua kua nplaum ua ke.

*** Thaum koj nyob rau qhov kawg ntawm kev tso tus qauv ua ke tsis txhob lo nplaum lossis siv cov khoom saum toj kawg nkaus uas lub teeb sab saum toj mus rau hauv qhov yeeb yam. Ib tug coj yuav mus ntawm no uas teeb tom qab. koj xav tau lub qhov ntawd ****

Kauj Ruam 2: Laum Qhov rau LED

Laum Qhov rau LED
Laum Qhov rau LED
Laum Qhov rau LED
Laum Qhov rau LED

Sab saum toj ntawm Tardis yuav tsum muaj lub qhov me me uas peb tso cov khoom tawm. Siv lub laum los laum lub qhov uas hla lub qhov ntawd mus rau nruab nrab ntawm Tardis. Muaj ib daim ntoo siv rau kev ruaj ntseg nyob hauv nruab nrab uas yog khoom. Lub qhov hlais yuav tsum hla qhov no kom lub hauv qab zais hauv qab thiab sab saum toj txuas. Qhov no yuav tso cai rau ob txoj kab hluav taws xob me me khiav los ntawm qhov chaw hauv qab mus txog rau saum qhov chaw uas yuav muab tso rau LED.

Kauj Ruam 3: Xim Xim

Painting
Painting

Qhov no yog qhov nyuaj tshaj plaws rau kuv. Kuv tau txais cov xim uas kuv siv los ntawm chaw tos txais haujlwm. Cov nom Tardis cov xim tsis yooj yim nrhiav thiab tej daim ntawm cov ntoo Tardis me me yog li koj xav tau cov txhuam txhuam zoo. Kuv yuav cov xim pleev xim thiab txhuam ntawm qhov chaw nyiam ua haujlwm. Koj yuav xav tau Xiav rau sab nraud thiab dub rau sab saum toj uas muaj cov ntawv dawb thiab tseem dawb. Kuv tsuas yog pleev xim cov ntawv rau ntawm xub ntiag vim nws me me heev thiab nyuaj rau ua yam tsis muaj kev cuam tshuam. Kuv yuav tsum rov qab mus yuam kev nrog cov dub lossis xiav ob peb zaug. Tom qab lub tsho xim pleev xim tiav koj yuav xav tau lub peev xwm ntawm polyurethane. Kuv tau ua peb lub tsho xim kom tau raws li qhov kuv xav. Tom qab ntawd txau 3 lub tsho loj ntawm polyurethane txhawm rau kaw thiab ci rau Tardis. Qhov no pab nrog kev nkhaus thiab tseem muab nws ci zoo nkauj.

Kauj Ruam 4: Laum Sab Qhov

Laum Sab Qhov
Laum Sab Qhov
Laum Sab Qhov
Laum Sab Qhov

Tam sim no koj yuav tsum tau laum thiab txiav ob peb lub qhov nyob rau sab ntawm Tardis rooj plaub. Koj xav tau lub qhov loj txaus rau squid khawm khawm rau lub zog. Koj kuj tseem xav tau lub qhov rau lub hwj chim qaum thiab USB qaum uas yuav txuas rau Lub Rooj Tswjhwm Saib Suab. Kuv drilled thawj qhov ces siv rab riam exacto los ua kom lub qhov tawm loj txaus thiab ncig.

Kauj Ruam 5: Raspberry Pi's

Raspberry Pi tus
Raspberry Pi tus
Raspberry Pi tus
Raspberry Pi tus
Raspberry Pi tus
Raspberry Pi tus

Tam sim no koj yuav tsum teeb tsa Raspberry Pi's. Txhawm rau ua qhov no kuv yuav Raspberry pi 3, lub hwj chim qaum, lub dab dej sov rau Raspberry Pi, 32gb micro sd card, poj niam rau poj niam jumper cables, 10 ohm resistor, ob pob squid laub nyees khawm, 10v txog 5v lub zog hloov pauv, jumper cov xov hluav taws xob thiab cov khoom siv txuas hluav taws xob txuas hluav taws xob, thiab USB lub suab tswj lub suab thiab yog tias koj muaj nws lub wireless keyboard nrog USB dongle ua qhov no yooj yim dua. Koj tseem yuav xav tau Raspberry Pi thib ob thiab daim npav SD. Qhov no yuav tsum yog Raspberry Pi xoom thiab gpio pinout kom muab tshuaj txhuam rau hauv.

*** Daim npav SD tsis xav tau 32gb thiab 8gb yuav ua tau zoo ***

Koj yuav tsum rub daim duab mus rau SD daim npav siv hauv Raspberry Pi. Tom qab ntawd koj tuaj yeem siv ib qho freeware los sau cov duab rau daim npav SD. Kuv siv Win32DiskImager.. Qhov no yog txheej txheem ncaj nraim rau pem hauv ntej. Koj yooj yim ntxig daim npav SD uas yuav muab rau ua ntawv tsav. Tom qab ntawv xaub mus rau daim duab koj rub tawm thiab sau rau disk tom qab ntawd xaiv daim npav SD. Kuv siv Raspian duab ntawm qhov chaw ntawd. Kev tshawb nrhiav google ntawm Raspian thiab sau cov duab rau daim npav SD yuav muab txhua yam koj xav tau.

Thaum cov duab tau sau rau SD daim npav ntsaws nws rau hauv qhov chaw nres nkoj ntawm Raspberry Pi 3 thiab ntsaws lub hwj huam qaum rau thawj zaug khau raj. Raspian duab qhib rau pixel desktop ib puag ncig. Muaj cov duab ntawm lub xwmfab dub qhov no yog lub davhlau ya nyob twg uas peb yuav ua haujlwm ntawm peb cov ntawv sau los ua haujlwm no. nyem rau ntawm daim duab ntawd qhib lub davhlau ya nyob twg.

*** Txij ntawm no nws yog ib qho tseem ceeb kom nco ntsoov tias kuv tau txais cov ntaub ntawv audio los ntawm kev kaw cov yeeb yaj kiab nrog kuv lub xov tooj ces tso cov vis dis aus rau youtube thiab siv lub xaib yt2mp3 los hloov lawv mus rau mp3s. Tom qab ntawd rub lawv mus rau Raspberry Pi thiab muab tso rau hauv /home /pi directory. koj tuaj yeem ua qhov no nrog lub cim nplaub tshev thiab rub cov ntawv hla los ntawm cov ntawv rub tawm.

Kuv tau txuas daim duab ntawm GPIO lub rooj tsavxwm uas qhia koj tias pins ua dab tsi. Rau qhov yooj yim kuv pom zoo siv tus pin kuv tau ua. Pin 3 yog kuv lub zog khawm. Tus pin 14 yog kuv tus coj thiab tus pin 18 yog tus pin program. Tsis muaj dab tsi txuas rau qhov no vim qhov no ua tiav wirelessly. Kuj tseem muaj daim duab ntawm kuv MP3's hauv tsev/pi phau ntawv teev npe.

Kauj Ruam 6: Lub Hwj Chim Plhaub

Power Shell Script
Power Shell Script
Power Shell Script
Power Shell Script

Txoj hauv kev no ua haujlwm yog muaj ob lub plhaub ntawv sau. Cov ntawv sau ua haujlwm bootup thiab pib sau sej. Cov nab hab sej sau ntawv thiab tos nkag los ntawm lub pob nyem lossis hloov pauv hauv tus lej pin. Cov ntawv sau hauv plhaub yog qhov yooj yim zoo nkauj hauv qab no yog thawj qhov. uas yog yuav pib cov ntawv nab hab sej ib zaug tsim.

#!/bin/tsoo

#Lub zog khawm

cd / cov

cd /home /pib

sudo python3 power.py

cd / cov

Tsab ntawv no yuav pib power.sh uas yog lub npe ntawm tsab ntawv nab nab peb tseem yuav tsim. Txoj kev peb tsim tsab ntawv no los ntawm lub davhlau ya nyob twg yog los ntawm kev ntaus cd /home /pi ces nkag mus. Tom qab ntawd peb yuav tsum tsim cov npe rau peb cov ntawv sau yog li sudo mkdir bin ces nkag mus. Qhov no yuav tsim cov ntawv tais ceev tseg uas peb tuaj yeem siv rau peb cov ntawv sau. Tom qab ntawv ntaus cd/home/pi/bin ces nkag mus. Tom qab ntawv ntaus sudo nano power.sh ces nkag mus. Qhov no yuav qhib daim ntawv uas tsis muaj qhov ntawv sau saum toj no yuav raug ntaus. Txhawm rau txuag nias cntrl thiab x ces nws yuav nug yog tias koj xav khaws tseg nias y rau yog ces nws yuav lees paub qhov chaw thiab nias nkag mus. Qhov no tsim cov ntawv tab sis peb xav tau nws kom ua tiav. Yog li nias cd /home /pi nkag. Tom qab ntawd sudo chmod+x /home/pi/bin/power.sh ces nkag mus. Qhov no yuav ua rau tsab ntawv muaj hwj chim peb nyuam qhuav tsim ua tiav rau txhua tus neeg siv. Tam sim no peb xav tau tsab ntawv no los khiav ntawm reboot. Lub ntsiab lus nws yuav cia li pib thaum pib uas yuav pib peb lwm tsab ntawv peb yuav tsim. Ntaus cd /home /pi ces nkag mus. Tom qab ntawv ntaus sudo crontab -e ces nkag mus. Nws yuav nug koj tus kws kho mob siv xaiv nano uas yog 2 Kuv ntseeg ces nkag mus. Cov ntawv no twb tau sau rau hauv nws. Tsuas yog nqes mus rau hauv qab thiab ntaus @reboot sh /home/pi/bin/power.sh ces txuag nrog cntrl thiab x, lees paub nrog y ces nkag mus. Tam sim no lub plhaub tsab ntawv yuav khiav ntawm reboot.

Kauj Ruam 7: Power Python Script

Power Python Script
Power Python Script

Tam sim no tias tsab ntawv plhaub tau npaj los pib tsab ntawv nab nab peb xav tau los tsim cov ntawv nab nab. Los ntawm lub davhlau ya nyob twg hom cd /home /pi ces nkag mus. Cov nab hab sej sau ntawv tsis xav tau lawv tus kheej cov npe khaws cia rau hauv phau ntawv teev npe tseem ceeb nrog lub mp3 yog qhov zoo. Ntaus sudo nano power.py ces nkag mus. Qhov no yuav qhib qhov khoos phis tawj dawb dua. Cov ntawv sau hauv nab hab sej yog qhov sib nrug heev yog li yog tias koj tau txais ib qho kev ua yuam kev syntax nws qhov kev sib nrug.

ntshuam RPi. GPIO ua GPIO

lub sij hawm ntshuam

ntshuam subprocess

GPIO.setmode (GPIO. BCM)

GPIO.setup (3, GPIO. IN, rub_up_down = GPIO. PUD_UP)

oldButtonState = 1

thaum Muaj Tseeb:

buttonState1 = GPIO.input (3)

yog buttonState1! = oldButtonState1 thiab buttonState1 == Cuav:

subprocess.call ("sudo kaw -h tam sim no", plhaub = Tseeb, stdout = subprocess. PIPE, stderr = subprocess. PIPE)

oldButtonState1 = buttonState1

sijhawm.s pw (.1)

Tom qab ntawd txuag nrog cntrl thiab x ces lees paub nrog Y ces nkag mus. Tam sim no yuav muaj dab tsi tshwm sim yog lub plhaub tsab ntawv yuav pib thaum pib thiab pib tsab ntawv nab nab uas yuav tos lub pob nyem ntawm tus pin 3 txhawm rau kaw raspberry pi rau hauv hom pw thiab pib nws. Tam sim no kaw raspberry pi nqis los ntawm lub davhlau ya nyob twg nrog sudo kaw -h tam sim no thiab nkag mus. Thaum tus pi raug kaw thiab lub teeb ntsuab tawm, tom qab ntawd tshem nws. Tam sim no txuas tus squid hloov mus rau tus pin 3. Tus lej pin pib nrog tus lej tsawg kawg ntawm qhov chaw uas daim npav SD nyob. Pin 3 thiab hauv av yog tus pin 5 thiab 6 thaum suav los ntawm qhov kawg. Suav 2 ces 4 ces 6. Ob tus pin yog tus pin 3 thiab hauv av. Plug lub squid hloov mus rau cov pins. Lawv swb sab xis. Qhov twg mus rau tus pin tsis muaj teeb meem. Thaum qhov hloov pauv tau qhib, ntsaws tus pi rov qab rau hauv thiab nws yuav pib. Txij li thaum peb cov ntawv sau thaum pib nias lub pob kom sim thiab nws yuav tsum kaw rau hauv hom pw. Tom qab ntawd nias nws dua thiab nws yuav pib dua. Qee cov nyees khawm tuaj yeem xoob yog tias nws tsis ua haujlwm txheeb xyuas koj qhov kev sib txuas ntawm tus pin thiab tseem qee cov nyees khawm xoob thiab yuav tsum tau nias thiab tuav ib pliag rau qhov txuas kom yaug. Koj tuaj yeem sim qhov no ob peb zaug.

Kauj Ruam 8: Coj Jumper Cables

Coj Jumper Cables
Coj Jumper Cables
Coj Jumper Cables
Coj Jumper Cables
Coj Jumper Cables
Coj Jumper Cables

Tam sim no peb tuaj yeem khiav cov kab no tab sis nws tseem tsis tau txuas nrog. Cov coj me me uas koj yuav tau muaj ob lub pins txhuas los ntawm nws. Qhov ntev dua yog qhov zoo. Txuas 10 ohm resistor mus rau qhov kawg zoo. Tom qab ntawd nqa cov jumper cables koj tau yuav thiab txuas ib qho rau qhov zoo thiab ib qho rau qhov tsis zoo. Tom qab ntawd khiav cov kab hluav taws xob hla lub qhov nyob rau sab saum toj ntawm Tardis rooj plaub hla hauv nruab nrab qhov thiab nkag mus rau hauv qab. Koj tuaj yeem siv daim kab xev hluav taws xob yog tias koj xav tuav qee qhov no ua ke. Nws tsis yog qhov xav tau tiag tiag. Tsis muaj ib yam no hnyav heev. Tsuas yog ceev faj kom tsis txhob rub nws nyuaj lawv yuav tawm mus. Peb tseem tsis txuas qhov no rau Raspberry pi tseem.

Kauj Ruam 9: Dr-who Shell Script

Dr-leej twg Shell Script
Dr-leej twg Shell Script

Nov yog lub plhaub tsab ntawv zoo ib yam li lwm qhov uas yuav rov pib dua thiab pib Dr-leej twg nab nab tsab ntawv peb yuav sau. Qhov no yog ua tiav tib txoj kev. los ntawm lub davhlau ya nyob twg cd/home/pi/bin thiab nkag mus. Tom qab ntawv sudo nano dr-who.sh thiab nkag mus. Tom qab ntawv ntaus cov hauv qab no:

#!/bin/tsoo

#dr leej twg pib sau ntawv

cd / cov

cd /home /pib

sudo python3 dr-who.py

cd / cov

Tom qab ntawd cntrl thiab x ces Y ces nkag mus. Tom qab ntawd nias cd /home /pi ces nkag mus.

Tom qab ntawd sudo chmod+x /home/pi/bin/dr-who.sh ces nkag mus. Tom qab ntawv sudo crontab -e ces nqes mus rau hauv qab thiab ntaus

@reboot sh /home/pi/bin/dr-who.sh ces txuag nrog cntrl thiab x ces Y thiab tom qab ntawd nkag mus. Tam sim no yuav tsum muaj ob kab ntawm crontab uas pib ob lub zog plhaub tsab ntawv thiab dr-leej twg plhaub tsab ntawv thaum pib.

*** Thaum peb nyob ntawm no muaj ob daim ntawv ntxiv los ntxiv uas yuav los ua si tom qab **

sau cov hauv qab no:

@reboot sudo systemct1 pab pigpiod

@reboot sudo systemct1 pib pigpiod

Tom qab ntawd txuag lub pigpiod yog pob xav tau los siv khawm wireless uas peb yuav siv. Nws tsis tau teeb tsa los ntawm lub neej ntawd. Tom qab txuag kev tawm mus rau lub davhlau ya nyob twg. Nias sudo apt-tau nruab pigpiod ces nkag mus. Koj yuav tsum tau txuas nrog internet txhawm rau rub tawm qhov no. Qhov no tuaj yeem ua tiav los ntawm lub desktop ntawm Raspberry pi.

Kauj ruam 10: Dr-who Python Script

Dr-who Python Script
Dr-who Python Script
Dr-who Python Script
Dr-who Python Script
Dr-who Python Script
Dr-who Python Script

Nov yog lub siab tawv tiag ntawm lub qhov rooj. Nov yog qhov haujlwm tseem ceeb nws tus kheej uas ua haujlwm. Qhov no ua haujlwm ntawm tus pin 18 tab sis qhov tso tawm yog ntawm tus pin 14 thiab 18. Qhov haujlwm no yuav ua rau lub teeb ci coj mus ntxiv tom qab ntawv yuav xaiv mp3 nws yuav ua si ces tus coj yuav ntsais dua. Cov npe cov npe ntawm cov mp3 tsuas yog qhov kuv tau teev tseg kom nco ntsoov lawv. Koj tuaj yeem npe lawv txhua yam koj xav tau. Tsuas yog nco ntsoov tias lawv tsis tuaj yeem muaj cov lus txib nab nab hauv lub npe piv txwv li kuv tau teev npe cov ntaub ntawv nrog lo lus txheeb hauv lub npe thiab nws tsis meej pem nab nab thiab yog li nws tau hloov pauv. Nco ntsoov los ntawm lub davhlau ya nyob twg cd /home /pi ces nkag mus. Tom qab ntawv sudo nano dr-who.py ces nkag mus. Hauv kab ntawv sau kab ntawv hauv qab no uas yuav raug sau.

** Nov yog kuv cov ntawv koj yuav sib txawv yog tias koj muaj tus lej MP3 sib txawv lossis yog lawv muaj npe txawv **

ntshuam RPi. GPIO ua GPIO

lub sij hawm ntshuam

ntshuam ntshuam

import os

GPIO.setmode (GPIO. BCM)

GPIO.setup (18, GPIO. IN, rub_up_down = GPIO. PUD_UP)

def randomnumber (): cov

tus lej = random.randint (1, 6

*** xaiv tus lej sib txawv ntawm 1 thiab 6, xav tau hloov pauv yog tias koj tus lej MP3 sib txawv ***

yog tus lej == 1:

os.system ('mpg123 thedoctor.mp3')

sijhawm.sleep (1)

elif tooj == 2:

os.system ('mpg123 opening.mp3')

sijhawm.sleep (1)

elif tooj == 3:

os.system ('mpg123 thecrack.mp3')

sijhawm.sleep (1)

elif tooj == 4:

os.system ('mpg123 bowties.mp3')

sijhawm.sleep (1)

elif tooj == 5:

os.system ('mpg123 exterminated.mp3')

** MP3 lub npe tej zaum yuav txawv nyob ntawm seb koj hu lawv li cas **

sijhawm.sleep (1)

lwm tus:

os.system ('mpg123 timespace.mp3')

sijhawm.sleep (1)

GPIO.setwarnings (Cuav)

GPIO.setup (14, GPIO. OUT) ** teeb tsa cov zis rau tus pin 14 ib yam **

GPIO.output (14, Tsis tseeb) ** Led yog ntawm tus pin 14 teeb nws kom pib ua ntej **

thaum Muaj Tseeb:

GPIO.output (14, Cuav)

input_state = GPIO.input (18) ** tus pin 18 yog lub tswv yim **

yog (GPIO.input (18) == Tsis tseeb):

GPIO.output (14, Tseeb)

sijhawm.sleep (1)

GPIO.output (14, Cuav)

sijhawm.sleep (1)

tus lej random ()

GPIO.output (14, Tseeb)

sijhawm.sleep (1)

GPIO.output (14, Cuav)

lub sij hawm.sleep (.5)

GPIO.output (14, Tseeb)

sijhawm.sleep (1)

GPIO.output (14, Cuav)

Qhov no ua dab tsi yog thaum tus pin 18 cuam tshuam nrog cov coj ntawm tus pin 14 nyob rau sab saum toj ntawm tardis yuav ntsais tom qab ntawv cov ntaub ntawv audio yuav raug xaiv thiab ua si ces tus coj yuav ntsais ob zaug thiab tawm mus. Nov yog qhov yuav tshwm sim txhua lub sij hawm lub tswb nrov nrov nrov. Peb tseem yuav xav tau IP chaw nyob ntawm raspberry pi no rau cov ntawv hauv lwm qhov yog li lub teeb liab wireless yuav tau txais yog li nco ntsoov txuas raspberry pi rau koj lub wifi los ntawm GUI desktop tom qab ntawd rov qab mus rau hauv lub davhlau ya nyob twg thiab sau sudo hostname -Kuv nkag mus. sau tus IP chaw nyob muab rau koj yuav xav tau tom qab. Tam sim no koj tseem tuaj yeem ntsaws cov xaim rau hauv coj mus rau tus pin 14 ua raws GPIO tus pin tawm rau tus pin 14 thiab tus pin hauv av uas yog kab pheeb ces kaum los ntawm nws.

Kauj Ruam 11: Pem Hauv Ntej Khawm Raspberry Pi

Pem Hauv Ntej Khawm Raspberry Pi
Pem Hauv Ntej Khawm Raspberry Pi
Pem Hauv Ntej Khawm Raspberry Pi
Pem Hauv Ntej Khawm Raspberry Pi

Raspberry pi xoom xav tau ob peb yam ua tiav rau nws. Ua ntej cov pins yuav tsum tau muab tso rau hauv. Siv cov hlau txuas thiab qee cov laug los txhuam cov pins rau hauv kev sib txuas ruaj khov. Muaj ib lub roob ntawm cov peev txheej yuav ua li cas online no. Youtube yog ib qho zoo heev. Thaum cov pins raug muag hauv daim npav sd yuav xav tau cov duab raspian sau rau nws ib yam li ua ntej. Peb yuav tsis xav tau lub hwj huam khawm ntawm no. peb yuav xav tau daim ntawv plhaub uas rov pib dua thiab nws yuav pib peb tsab ntawv nab nab uas yuav siv lub teeb liab tsis sib txuas tus pin 18 ntawm lwm tus raspberry pi kom ua haujlwm peb txoj haujlwm.

Kauj Ruam 12: Lub Tswb Tswb Qhov Rooj

Doorbell Plhaub Tsab Ntawv
Doorbell Plhaub Tsab Ntawv
Doorbell Plhaub Tsab Ntawv
Doorbell Plhaub Tsab Ntawv

Tsab ntawv no yuav luag zoo ib yam rau ob qho ntxiv. Los ntawm lub davhlau ya nyob twg nkag mus cd /home /pi ces nkag mus. sudo mkdir/home/pi/bin ces nkag mus. cd/home/pi/bin ces nkag mus. sudo nano doorbell.sh ces nkag mus.

#!/bin/tsoo

cd / cov

cd tsev/pi

sudo python3 doorbell.py

cd / cov

Tom qab ntawd txuag nrog cntrl thiab x ces Y ces nkag mus. Tom qab ntawd sudo chmod+x /home/pi/bindoorbell.sh ces nkag mus. ces cd /home /pi ces nkag mus. Tom qab ntawd sudo crontab -e ces nkag mus xaiv nano ces nkag mus. Hauv qab nkag

@reboot sh /home/pi/bin/doorbell.sh ces txuag nrog cntrl thiab x ces Y ces nkag mus. Qhov no yuav ua haujlwm lub plhaub tsab ntawv thaum pib thiab tom ntej no peb yuav tsim cov ntawv nab nab nrog peb lub qhov rooj nkag tom ntej uas thaum nias yuav qhia lwm tus raspberry pi.

Kauj Ruam 13: Tsab Ntawv Nthuav Python

Doorbell Python Tsab Ntawv
Doorbell Python Tsab Ntawv

Nov yog tsab ntawv uas yuav pab kom muaj kev sib txuas lus wireless ntawm lub qhov rooj ntawm lub qhov rooj thiab lub suab nrov uas peb tau tsim. Tsab ntawv los khiav lub suab ntawm thawj Raspberry pi sau raws li qhov hluav taws xob qis. Nws tau teeb tsa kom siab li ib zaug uas hloov pauv nws sau tsab ntawv ntsais lub teeb thiab ua suab. Tsab ntawv no xa lub teeb liab qis mus rau Raspberry pi thiab rau tus pin ntawd teeb nws rov mus rau siab kom nws yuav khiav ib zaug thaum nias. Tsab ntawv yog raws li hauv qab no:

los ntawm gpiozero ntshuam LED

los ntawm gpiozero ntshuam khawm

los ntawm gpiozero.pins.pigpio ntshuam PiGPIOFactory

los ntawm teeb liab ntshuam ncua

lub sij hawm ntshuam

factory = PiGPIOFactory (tus tswv = '192.168.1.13')

coj = LED (18, pin_factory = lub Hoobkas)

khawm = Khawm (3)

thaum Muaj Tseeb:

yog tias button.is_pressed:

coj.off ()

coj.on ()

lwm tus:

coj.on ()

LED module tsis tau siv rau kev coj nws tsuas yog qhia tias tus pin ntawm thawj Raspberry pi uas ua haujlwm qhov haujlwm. Thaum qhov no tau txais kev cawmdim rau /hom /pi cov npe thiab txij li lub plhaub los pib qhov no twb tau tsim lawm. Tam sim no peb tuaj yeem tshem tawm ob qho Raspberry pi's nrog sudo kaw -h tam sim no. Tom qab ntawd thawj Raspberry pi yuav tsum tau qhib ua ntej uas vim yog nkag mus rau crontab yuav pib lub pigpiod uas yuav tsum tau pib ua ntej. Tom qab ntawd qhov thib ob raspberry pi rau lub qhov rooj tuaj yeem pib. Tom qab ntawd ntev li ntev tau koj cov laug rau lub cev khawm tau ua tiav raug thiab ntsaws rau hauv txoj cai. Ib lub pob nyem yuav pib coj thiab suab.

*** Tam sim no xav tau tus hais lus lossis lub suab yuav tsis ua haujlwm. Kuv pom lub suab kaw suab online uas rub lub zog los ntawm Raspberry pi los ntawm USB chaw nres nkoj. Uas yog zoo meej yog li nws tsis xav tau nws tus kheej ntsaws. Kuv pom zoo nws. Lub suab tso tawm yog dhau los ntawm 3.5mm nkaus. Lub suab nrov yuav txuas rau lub suab nrov Raspberry pi los ntawm lub qhov peb tau ua hauv rooj plaub thiab ib lub xov hlau yuav nkag mus rau 3.5 hli nkaus thiab lwm qhov rau hauv USB. Lub suab tsis zoo yog HDMI chaw nres nkoj yog li koj yuav tsum yuam tus pi rau hauv 3.5 hli nkaus. Qhov no yog ua tiav los ntawm lub davhlau ya nyob twg nrog sudo raspi-teeb tsa ces nkag mus. Cov ntawv qhia zaub mov yuav tshwm tuaj xaiv cov kev xaiv siab dua tom qab ntawd suab 3.5mm tom qab ntawd txuag thiab tawm mus. Thaum koj tau ua tiav qhov no thiab koj tus neeg hais lus tau ntsaws koj tuaj yeem sim koj lub suab nrov ob peb zaug, koj ua tiav qhov tsuas yog sab laug yog xaim lub qhov rooj Raspberry pi rau hauv tsev.

Kauj Ruam 14: Lub Hwj Chim Hloov

Hwj chim Converter
Hwj chim Converter
Hwj chim Converter
Hwj chim Converter

Qhov no yog kauj ruam kawg. Thawj zaug ua kom ntseeg tau tias lub suab nrov Raspberry pi tau qhib. Qab koj lub qhov rooj tam sim no muaj ob txoj xov hlau zoo thiab tsis zoo. Qhov voltage yog 10 lossis 12 volts. Dab tsi koj yuav xav tau yog lub zog hloov pauv uas hloov qhov no mus rau 5 volts uas yog qhov Raspberry pi siv. Yog tias koj saib qhov kawg ntawm cov hlua jumper uas peb siv qhov kawg yog poj niam thiab txiv neej txhuas nrog lub hau npog rau nws. Koj tuaj yeem tau txais cov hnub no los ntawm lawv tus kheej hauv cov khoom siv los tsim koj tus kheej cov xov hlau. Xaiv sab twg koj xav ua poj niam thiab txiv neej txoj hlua kab rov qab los nthuav tawm tooj liab. Tom qab ntawd muab tus poj niam xaus rau ntawm lub xov tooj cua hauv tsev lossis hloov pauv. Tom qab ntawd lub zog hloov pauv muaj ob lub xov tooj ib yam nkaus. Liab rau qhov zoo thiab dub rau qhov tsis zoo. Tam sim no peb ua tib yam li hle cov xov hlau rov los nthuav tawm tooj liab. Muab tus txiv neej xaus rau ntawm lawv thiab siv cov pliers los ntswj nws. Koj tuaj yeem tso cov yas npog rau yog tias koj xav tau. Tom qab ntawd koj tuaj yeem ntsaws lub hwj chim hloov pauv mus rau lub xov hluav taws xob hauv tsev. Zoo rau qhov zoo thiab tsis zoo rau qhov tsis zoo. Koj tuaj yeem kaw qhov kev txuas no nrog daim kab xev hluav taws xob kom nws tuav tau zoo dua. Yog ua tiav kom raug thaum koj ntsaws 5v kawg rau hauv Raspberry pi nws yuav ua haujlwm rau. Koj tuaj yeem sim tias lub tswb qhov rooj ua haujlwm los ntawm nias lub pob. Lub suab nrov yuav tsum pib. Thaum nws ua tiav koj tuaj yeem tso lub zog hloov pauv, lub qhov rooj Raspberry pi txhua sab hauv phab ntsa qhov tom qab koj lub qhov rooj dhau los. Siv cov ntsia hlau los ntswj lub npog qhov rooj tshiab rau. Tam sim no txhua lub sijhawm leej twg nias lub pob qhov rooj pem hauv ntej lub Tardis yuav ntsais tom qab ntawd ua lub suab tom qab ntsais muag dua. Qhov no tuaj yeem ua tiav nrog txhua lub suab thiab txhua kis. Qhov tom ntej kuv yuav tsim yuav yog Darth Vader. Zoo siab tsev

Pom zoo: