Cov txheej txheem:
- Kauj Ruam 1: Kauj Ruam 1: Npaj Txhua Yam Khoom
- Kauj Ruam 2: Kauj Ruam 2: Nyem Qhov Tseeb Rasbpian OS Duab rau SD Card
- Kauj Ruam 3: Kauj Ruam 3: Qhib I2C Function Los ntawm Raspi-teeb tsa
- Kauj Ruam 4: Kauj Ruam 4: Txuas lub Acrylic Panel rau ntawm lub qhov
- Kauj Ruam 5: Kauj Ruam 5: Teeb Infrared Pyroelectric Sensor
Video: Raspberry Pi Smart NightLight: 5 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:27
Tsis ntev los no kuv tau sawv ntxov, ntau zaus hnub sab nraum tseem tsaus ntuj, tab sis kuv tsis xav qhib lub teeb kom cuam tshuam rau kuv tus poj niam so, yog li kuv tau xav txog kev yuav lub teeb hmo ntuj. Kuv tshawb nrhiav ntau lub khw hmo ntuj, tab sis kuv tsis xav tias nws yog kuv xav tau, tab sis kuv pom lub teeb hmo ntuj hu ua DockerPi hauv khw hauv Amazon, uas yog tswj los ntawm Raspberry Pi. Nws zoo heev thiab tuaj yeem muab cov yam ntxwv DIY. Kuv nyeem cov lus piav qhia wiki ntawm cov khoom no, nws tuaj yeem tswj tau ncaj qha los ntawm kab hais kom ua, raws li tus programmer siv Linux system, Kuv xav tias qhov no zoo heev, yog li kuv yuav nws rov qab thiab pib qhov haujlwm no.
Kauj Ruam 1: Kauj Ruam 1: Npaj Txhua Yam Khoom
Tom qab unboxing thiab tom qab ntawd kuv tshem daim npog tiv thaiv ntawm cov phaj acrylic, thiab tom qab ntawd teeb tsa DockerPi tus qauv rau kuv Raspberry Pi nrog cov ntsia hlau thiab tooj liab lo. nws ruaj khov.
Kauj Ruam 2: Kauj Ruam 2: Nyem Qhov Tseeb Rasbpian OS Duab rau SD Card
Kuv rub cov duab Raspbian tshiab los ntawm:
thiab tom qab ntawd nyem cov duab ntawm lub software hu ua: etcher
koj tuaj yeem rub tawm ntawm no:
unzip daim ntawv duab los ntawm pob gzip thiab koj yuav tau txais *.img cov ntaub ntawv, xaiv cov duab thiab xaiv tsav uas koj lub PC lees paub daim npav TF, tsuas yog nyem "Flash" thiab tos ob peb feeb, nws yuav ua tiav.
thiab tom qab ntawd tshem daim npav TF thiab ntxig nws rau koj li Raspberry Pi thiab txhawb nws.
Kauj Ruam 3: Kauj Ruam 3: Qhib I2C Function Los ntawm Raspi-teeb tsa
Thaum Raspberry pi pib, kuv qhib lub davhlau ya nyob twg thiab ntaus cov lus txib no: sudo raspi-config
thiab mus rau "Cov Kev Sib Txuas" thiab xaiv "I2C" thiab qhib nws. vim li cas kuv thiaj yuav tsum siv cov lus txib no?
Vim tias DockerPi lub teeb hmo ntuj siv I2C raws tu qauv sib tham nrog Raspberry Pi.
Kauj Ruam 4: Kauj Ruam 4: Txuas lub Acrylic Panel rau ntawm lub qhov
Nws haum rau lub qhov zoo heev, thiab koj tuaj yeem pom daim duab uas lub vaj huam sib luag acrylic tuaj yeem nyob twj ywm hauv qhov.
cov kauj ruam tom ntej yog khiav cov cai ntsuas los xyuas seb nws ua haujlwm zoo.
Kuv tau rub tus lej piv txwv los ntawm github ntawm kev ntaus cov lus txib no hauv davhlau ya nyob twg ntawm raspberry Pi.
cd ~ ib
git clone
cd dockerpi/Hmo ntuj/
sudo./Nightligh.sh
thiab tom qab ntawd kuv lub teeb hmo ntuj tig thiab ci.
Kuv nyeem cov lus qhia ntawm nws lub wiki thiab pom tag nrho cov teeb pom kev ntawm LED lub npe daim ntawv qhia chaw.
cov kauj ruam tom ntej yuav yog qhov lom zem tshaj plaws, Kuv xav ntxiv tib neeg lub cev infrared pyroelectric sensor, cia nws kuaj pom tias kuv tau teeb rau lub teeb hmo hmo no ~
Kauj Ruam 5: Kauj Ruam 5: Teeb Infrared Pyroelectric Sensor
Ntawm no, peb tab tom siv lub PIR tsab ntawv tsa suab sensor. PIR sawv rau passive infrared. Qhov ntsuas lub suab no suav nrog lub iav fresnel, lub ntsuas hluav taws xob pom, thiab txhawb nqa kev tshawb nrhiav hluav taws xob. Lub lens ntawm lub sensor tsom mus rau ib qho hluav taws xob hluav taws xob tam sim no nyob ib puag ncig nws mus rau lub ntsuas hluav taws xob. Peb lub cev tsim hluav taws xob cua sov, thiab vim li ntawd, qhov cua sov no tau khaws los ntawm lub suab txav. Lub ntsuas hluav taws xob tso tawm 5V teeb liab rau ib pliag ntawm ib feeb sai li sai tau thaum nws pom tias muaj tus neeg. Nws muaj qhov ntsuas qhov ntsuas ntawm kwv yees li ntawm 6-7 meters thiab muaj kev nkag siab zoo. Thaum PIR lub suab ntsuas pom ib tus neeg, nws tso tawm 5V teeb liab rau Raspberry Pi los ntawm nws GPIO thiab peb txheeb xyuas dab tsi Raspberry Pi yuav tsum ua raws li nws pom tus neeg nkag los ntawm Python coding. Ntawm no peb tsuas yog luam tawm "Tus neeg nkag nkag pom".
Tom qab koj tau teeb tsa koj li Raspberry Pi, tam sim no peb tuaj yeem pib cuam tshuam nrog nws GPIO koob. Ntawm no, peb yuav sim ntsais ib qho LED siv tus ntawv Python. Luam thiab muab cov cai hauv qab no tso rau hauv koj li Raspberry Pi. Koj tuaj yeem ua qhov no los ntawm kev qhib cov ntawv sau "leafpad" ntawm koj li Raspberry Pi thiab luam cov cai no rau hauv nws, thiab khaws qhov no ua Python cov ntaub ntawv: nightlight.py:
#import cov tsev qiv ntawv.
ntshuam RPi. GPIO ua GPIO
lub sij hawm ntshuam
ntshuam smbus
DEVICE_BUS = 1
DEVICE_ADDR = 0x15
GPIO.setwarnings (Cuav)
GPIO.setmode (GPIO. BOARD)
GPIO.setup (11, GPIO. IN) #Nyeem cov zis los ntawm PIR tsab ntawv tsa suab sensor
npav = smbus. SMBus (DEVICE_BUS) # piv txwv ntawm smbus rau i2c ntaus ntawv, txhais tau tias hmo ntuj.
thaum Muaj Tseeb:
sim:
kuv = GPIO.input (11)
yog tias kuv == 0: #Thaum lub zog tso tawm los ntawm lub suab sensor LOW
print ("Tsis muaj neeg nkag los", kuv)
rau kuv hauv ntau (1, 25):
bus.write_byte_data (DEVICE_ADDR, kuv, 0x00) #Tua OFF LED
sijhawm.s pw (0.2)
sijhawm.s pw (0.1)
elif i == 1: #Thaum cov zis los ntawm lub suab sensor yog HIGH
print ("Intruder kuaj pom", i)
rau kuv hauv ntau (1, 25):
bus.write_byte_data (DEVICE_ADDR, kuv, 0xFF) #Tua OFF LED
sijhawm.s pw (0.2)
sijhawm.s pw (0.1)
tshwj tsis yog KeyboardInterrupt li e:
print ("Tawm lub voj")
thiab tom qab ntawd khaws nws thiab ua kom nws khiav thaum lub raspberry pi khau raj.
sudo vim.tiny /etc/rc.local
thiab ntxiv kab no ua ntej tawm 0:
sudo nab hab sej /home/pi/nightlight.py &
thiab tom qab ntawd khaws nws thiab rov pib dua koj Pi, nws yuav ua haujlwm tau zoo …
Tsaug rau saib ~
Pom zoo:
USB-Powered Nightlight W/ Backup Roj teeb (Ob Qhov Tsim): 3 Cov Kauj Ruam
USB-Powered Nightlight W/ Roj Teeb Thaub Qab (Ob Lub Qauv): Ib pliag rov qab, Kuv pom qhov xav tau lub teeb roj teeb uas tsaus ntuj rau kuv chav. Lub tswv yim yog tias kuv tsis xav kom sawv tawm ntawm lub txaj txhua lub sijhawm kuv xav tig kuv lub teeb kom mus pw. Kuv kuj xav tau lub teeb uas tsis zoo li kuv chav pw lig
SpotLight Interactive Nightlight: 4 Kauj Ruam
SpotLight Interactive Nightlight: SpotLight yog lub teeb pom kev sib tham hmo ntuj uas siv los ntawm Arduino, ua raws qhov ntxim nyiam pug-based form factor. Lub teeb muaj peb yam sib tham sib tham: 1) Ntxig ib npib nyiaj rau sab nraum qab ntawm SpotLight kom tig teeb thiab tua. 2) Tsiaj lub SpotLight rau ma
Moonbunny As Nightlight: 3 Kauj Ruam
Moonbunny As Nightlight: Kuv tus tub (yuav luag 3) xav tau hmo ntuj ntawm nws lub txaj. Thiab raws li kuv muaj lub tshuab luam ntawv 3d thiab kuv pom tias lub hli hollow txias, kuv tau luam tawm ib qho rau nws. Ua raws kuv ntawm Instagram rau xov xwm tshiab kawg
DIY USB Creeper Nightlight: 8 Kauj Ruam (nrog Duab)
DIY USB Creeper Hmo Hmo Ntuj: Koj puas tau xav tias muaj dab tsi nyob hauv tus tsiaj? Yuav ua li cas thiaj ua tau koj tus kheej lub cev txaus ntshai! Tsim USB creeper uas ci! Nov yog koj ua li cas
UVIL: Backlit Blacklight Nightlight (lossis SteamPunk Indicator Lamp): 5 Cov Kauj Ruam (nrog Duab)
UVIL: Backlit Blacklight Nightlight (lossis SteamPunk Indicator Lamp): Yuav ua li cas tso ua ke ib qho eerily ci ci neo-retropostmodern ultraviolet qhia lub teeb qhov no qhia tau hais tias kev tsim kho ntawm thawj ob qho uas kuv tau ua raws li txoj hauv kev los ntsuas PCB txheej txheem txheej txheem tau teev tseg hauv lwm Cov Lus Qhia . Kuv lub tswv yim yog siv cov no raws li kuv