Cov txheej txheem:

SanityForce (Tswb System- Rpi): 7 Kauj Ruam
SanityForce (Tswb System- Rpi): 7 Kauj Ruam

Video: SanityForce (Tswb System- Rpi): 7 Kauj Ruam

Video: SanityForce (Tswb System- Rpi): 7 Kauj Ruam
Video: Demo Video, Unlock android device by Kali linux 2024, Kaum ib hlis
Anonim
SanityForce (Tswb System- Rpi)
SanityForce (Tswb System- Rpi)

Tam sim no muaj ntau txoj hauv kev kom koj cov khoom muaj kev nyab xeeb, lossis tsuas yog khaws koj cov nus muag tawm ntawm koj chav, xws li muab xauv rau nws lossis tsuas yog ua kom lwm tus neeg mus txog. Yuav ua li cas yog tias kuv hais rau koj tias koj tsis tas yuav ua txhua yam yooj yim tab sis tuaj yeem tig koj li Raspberry Pi rau hauv koj lub tswb ceeb toom tus kheej! Tam sim no koj yuav xav tias qhov no ua tsis tau lossis tsuas yog qhov tsis tseem ceeb, koj tuaj yeem cia li kaw lub qhov rooj ntawm koj lub qhov rooj kom koj tus tij laug tawm. Tab sis, koj tus tij laug tuaj yeem pom tus yuam sij rau lub xauv thiab tsuas yog nkag mus rau hauv koj chav, tab sis nrog lub tswb nrov no, thaum koj qhib nws, nws tsis tuaj yeem xiam kom txog thaum koj mus thiab tua nws ntawm txoj cai. Yog tias koj tus nus txawm tuaj txog ib lub 'meter' ze ntawm koj lub qhov rooj, lub tswb yuav tawm mus qhia rau txhua tus hauv koj lub tsev tias ib tus neeg tau sim ua phem rau koj tus kheej. Tom qab ntawd thaum ib tus neeg paub nws sim ua phem rau koj tus kheej, lawv yuav tuaj thiab nres nws. Txhawm rau hloov koj tus Pi rau hauv lub tswb ceeb toom hu ua SanityForce, koj yuav tsum tau ua raws ob peb kauj ruam yooj yim thiab yuav xav tau qee qhov ntxiv rau koj Pi. Txhua kauj ruam thiab cov ntaub ntawv koj yuav xav tau muaj npe hauv qab no. Hmoov zoo, thiab Thov kom SanityForce nyob nrog koj!

Kauj Ruam 1: Sau Cov Khoom

Sau Cov Khoom
Sau Cov Khoom

Tam sim no rau txoj haujlwm no koj yuav xav tau ob peb daim ntxiv rau koj Raspberry Pi. Ua ntej pib tsim txoj haujlwm, thov xyuas kom koj muaj tag nrho cov ntaub ntawv uas tau teev tseg hauv qab no.

  • 1 x Raspberry Pi
  • 1 x Breadboard
  • 1x Pair Tus Hais Lus
  • 1 x PiCamera
  • 10x Liab LEDs
  • 1 x PIR Motion Sensor
  • 3x Poj niam-Txiv neej Xov
  • 10 x 330 Resistors
  • 10x ntawm Blue Jumper Cables
  • 2x ntawm Dub Jumper Cables

Kauj Ruam 2: Txuas lub PIR Motion Sensor

Txuas lub PIR Motion Sensor
Txuas lub PIR Motion Sensor

Ua ntej txuas tag nrho lwm cov LEDs thiab cov hais lus, koj xav txuas lub suab sensor uas yog pob txha nraub qaum ntawm koj txoj haujlwm. Txog kev txuas lub suab ntsuas, koj yuav tsum tau ceev faj txuas tus poj niam-txiv neej xaim mus rau GPIO pins thiab GND pins. Kuv yuav siv daim duab saum toj no ua piv txwv qhia tias lub xov tooj yuav mus qhov twg. Hauv qhov piv txwv muaj 3 lub xov hlau txuas nrog lub ntsuas hluav taws xob, ib qho ntsuab, ib qho ntshav, thiab ib qho xiav, nyob rau qhov kev txiav txim los ntawm sab xis mus rau sab laug. Cov hlau ntsuab yuav txuas rau GND tus pin hauv koj lub rooj noj mov, raws li koj tuaj yeem pom hauv qhov piv txwv saum toj no. Cov xaim hluav taws xob yuav txuas rau 5 volts fais fab fais fab tus pin hauv lub rooj noj mov, koj tuaj yeem pom qhov no hauv daim duab saum toj no. Qhov xov tooj thib peb thiab zaum kawg, ib qho xiav nkag mus rau GPIO tus pin ntawm koj lub rooj noj mov, uas GPIO tus pin nws mus yog qhov koj xaiv.

Kauj Ruam 3: Txuas cov LEDs thiab Cov Tiv Thaiv

Txuas cov LEDs thiab Resistors
Txuas cov LEDs thiab Resistors

Yog li ntawm cov LEDs thiab cov tiv thaiv, txuas cov no yog qhov yooj yim heev, tsuas yog nco ntsoov tias cov ceg ntev (anode) ntawm LED txuas nrog lub jumper cable uas txuas nrog GPIO tus pin. Cov ceg luv (cathode) ntawm LED txuas nrog 330 resistor uas txuas nrog GND tus pin. Ua ntej teeb tsa LEDs ntawm lub rooj tsavxwm, sib txuas ob lub xov tooj cua dub uas yuav txuas los ntawm tus lej GND mus rau GND kev tsheb nqaj hlau ntawm lub rooj tsavxwm. Koj tuaj yeem nthuav tawm LEDs nyob txhua qhov chaw ntawm lub rooj noj mov, hauv txhua qhov qauv koj nyiam. Nco ntsoov ua raws li yam kuv tau hais los saum no thiab koj cov LEDs yuav tsum pom thaum peb tso cov cai hauv thiab sim lawv. Tsis tas li, GPIO tus pin koj txuas cov LEDs tsis muaj teeb meem, uas tuaj yeem yog qhov koj xaiv.

Kauj Ruam 4: Txuas PiCamera

Txuas rau PiCamera
Txuas rau PiCamera

Tam sim no txuas rau PiCamera yog txoj haujlwm yooj yim, tab sis ceev faj thaum txuas nws uas koj tsis ua rau lub koob ntawm lub koob yees duab puas tsuaj hauv cov txheej txheem cog rau hauv Pi. Muaj koj yuav qhib lub qhov dub dub ntawm lub bar, thiab tsuas yog ntxig rau Pi lub koob yees duab rau hauv, nco ntsoov thawb lub bar rov qab thaum lub koob yees duab nyob hauv qhov chaw. Tom qab ua qhov ntawd koj xav nias lub Raspberry Pi khawm rau hauv qab kab ntawm Pi interface, cov ntawv qhia zaub mov yuav tshwm sim. Tom qab ntawd koj yuav nyem rau "Nyiam", thiab nqis mus rau "Raspberry Pi Configuration", thaum koj tau nyem rau ntawm qhov ntawd koj yuav tau txais cov ntawv qhia zaub mov nyob rau ntawm koj lub vijtsam. Muaj koj yuav nyem rau ntawm "Interfaces", muaj nyem rau ntawm lub pob kom pab tau rau lub koob yees duab xaiv. Yog tias lub koob yees duab twb tau qhib lawm, xiam nws thiab tom qab ntawd qhib nws. Thaum koj tau qhib lub koob yees duab, rov pib dua koj Pi thiab koj lub koob yees duab yuav pib ua haujlwm thaum Pi tau rov pib dua.

Kauj Ruam 5: Teeb Tus Hais Lus

Teeb Cov Hais Lus
Teeb Cov Hais Lus

Tam sim no rau Pi koj tuaj yeem siv ib tus neeg hais lus uas koj nyiam, tab sis kuv xav kom koj siv cov neeg hais lus uas muaj lub mloog pob ntseg qhov hluav taws xob uas koj tuaj yeem txuas rau Pi lub mloog pob ntseg. Tam sim no teeb tsa cov neeg hais lus yog qhov yooj yim tshaj plaws ntawm kev tsim txoj haujlwm no, txhua yam koj yuav tsum tau ua yog ntsaws lub mloog pob ntseg lub mloog pob ntseg tso rau hauv Pi lub mloog pob ntseg. Tom qab ntawd koj yuav txuas tus hais lus USB A cable rau hauv Pi's USB A chaw. Koj tsuas yog qhib koj tus neeg hais lus thiab koj yuav tsum tau nce thiab khiav. Tsuas yog thaum koj tus neeg hais lus tsis ua haujlwm tom qab ntsaws lawv, sim coj lawv tawm thiab tso lawv rov qab los, lossis tig koj Pi tawm thiab rov ua dua!

Kauj Ruam 6: Coding Txoj Haujlwm

Yog li tam sim no tom qab koj tau sib sau ua ke txhua yam ntawm koj Pi, koj tau npaj rau code hauv Python, yog li nws yuav ua haujlwm tiag tiag. Hauv qab no yog cov cai uas yuav ua kom txhua yam ua haujlwm, koj tsuas yog siv qhov ntawd, tab sis nco ntsoov hloov pauv txhua tus lej GPIO tus lej rau tus lej tus lej tshwj xeeb rau koj lub rooj noj mov. Koj tseem yuav tau hloov lub npe nkauj lub npe uas kuv tau teeb tsa hauv txoj cai, hloov lub npe mus rau lub npe ntawm daim nplaub tshev twg los xij hauv koj lub khoos phis tawj. Hauv qab yog daim duab ntawm yuav ua li cas koj cov cai yuav tsum saib ntawm Python, tsuas yog rub tawm cov ntawv thiab saib.

los ntawm gpiozero ntshuam MotionSensor los ntawm gpiozero ntshuam LED

los ntawm lub sijhawm ntshuam pw

los ntawm picamera ntshuam PiCamera

ntshuam pygame

lub koob yees duab = PiCamera ()

pir = MotionSensor (4)

tswb 1 = LED (21)

tswb 2 = LED (24)

tswb 3 = LED (20)

tswb 4 = LED (19)

tswb 5 = LED (16)

tswb 6 = LED (5)

tswb 7 = LED (12)

tswb 8 = LED (13)

tswb 9 = LED (25)

tswb 10 = LED (22)

def so (): cov

pygame.init ()

pygame.mixer.music.load ("LA LA LA.mp3")

pygame.mixer.music.play (-1)

thaum Muaj Tseeb:

pir.wait_for_motion ()

yog pir.motion_detected:

camera.start_preview ()

tsaug zog (0.1)

camera.capture ('/tsev/pi/Desktop/capture.jpg')

camera.stop_preview ()

so ()

print ("INTRUDER ALERT !!!!")

tswb 1.on ()

tswb 2.on ()

tsaug zog (0.4)

tswb 1.off ()

tswb2.off ()

tswb 3.on ()

tswb4.on ()

tsaug zog (0.5)

tswb3.off ()

tswb4.off ()

tswb5.on ()

tswb 6.on ()

tsaug zog (0.4)

tswb 5. tawm ()

tswb6.off ()

tswb 7.on ()

tswb8.on ()

tsaug zog (0.4)

tswb7.off ()

tswb8.off ()

tswb 9.on ()

tswb 10.on ()

tsaug zog (0.4)

tswb9.off ()

tswb10.off ()

tswb 10.on ()

tswb 9.on ()

tsaug zog (0.4)

tswb10.off ()

tswb9.off ()

tswb8.on ()

tswb 7.on ()

tsaug zog (0.4)

tswb8.off ()

tswb7.off ()

tswb 6.on ()

tswb5.on ()

tsaug zog (0.4)

tswb6.off ()

tswb 5. tawm ()

tswb4.on ()

tswb 3.on ()

tsaug zog (0.4)

tswb4.off ()

tswb3.off ()

tswb 2.on ()

tswb 1.on ()

tsaug zog (0.4)

tswb2.off ()

tswb 1.off ()

lwm tus:

tswb 1.off ()

tswb2.off ()

tswb3.off ()

tswb4.off ()

tswb 5. tawm ()

tswb6.off ()

tswb7.off ()

tswb8.off ()

tswb9.off ()

tswb10.off ()

Kauj Ruam 7: Kuaj Kawg

Tam sim no koj tau tso koj cov cai rau hauv nab hab sej, nws yog lub sijhawm los muab txhua yam ua ke thiab saib yog tias koj txoj haujlwm tau ua tiav! Hauv qab no yog cov vis dis aus ntawm yuav ua li cas koj txoj haujlwm yuav tsum ua haujlwm, tsis quav ntsej qee tus neeg tham tom qab, Kuv tsis nyob hauv qhov chaw ntsiag to! Cia siab tias koj kev rau siab ua SanityForce: Lub Tswb Tswb tau ua tiav, thiab tam sim no koj muaj qee yam txias uas yuav pab koj kom koj cov nus muag tawm ntawm koj chav.

Ua tsaug rau koj ua raws cov lus qhia no, thiab kuv vam tias koj tau kawm ib lossis ob yam! Tsis txhob hnov qab tawm koj cov kev xav hauv cov lus hauv qab no! Muaj kev lom zem nrog koj SanityForce!

Pom zoo: