Cov txheej txheem:

Smart Wall Calendar: 5 Kauj Ruam
Smart Wall Calendar: 5 Kauj Ruam

Video: Smart Wall Calendar: 5 Kauj Ruam

Video: Smart Wall Calendar: 5 Kauj Ruam
Video: LCD Multifunctional Alarm Clock - How to set Date and Time 2024, Hlis ntuj nqeg
Anonim
Ntse phab ntsa daim ntawv qhia hnub
Ntse phab ntsa daim ntawv qhia hnub

Kuv tus poj niam thiab kuv tau siv daim ntawv phab ntsa daim ntawv qhia hnub qub, uas peb cim hnub tseem ceeb. Peb kuj siv Google daim ntawv qhia hnub ntawm peb lub xov tooj ntse rau cim cov xwm txheej, yog li qhov no txhais tau tias ua haujlwm ob zaug. Yog li kuv txiav txim siab los tsim qee yam ntawm daim ntawv qhia ntse phab ntsa, uas yuav tso tawm peb nco, xwm txheej thiab qee yam ntaub ntawv. Txij li thaum kuv muaj ntau yam khoom siv hluav taws xob qub nyob ib puag ncig, kuv lub hom phiaj yog siv lawv ntau li ntau tau thiab tsim daim ntawv qhia hnub nrog tus nqi me ntsis li sai tau.

Hauv qhov kev qhia no kuv yuav qhia koj, yuav tsim li cas phab ntsa ntse daim ntawv qhia hnub, nthuav tawm cov xwm txheej los ntawm ntau tus lej Google. Nws tseem yuav tso tawm sijhawm, hnub tim, huab cua, kub thiab qee yam ntaub ntawv ntxiv. Nws yuav raug siv los ntawm Raspberry Pi lub khoos phis tawj nrog Passive Infrared Sensor (PIR) lub suab txav txuas rau nws, yog li cov zaub qhib, thaum pom cov lus tsa suab hauv chav, tab sis tig tawm tom qab ob peb feeb ntawm qhov tsis ua haujlwm. Cov ntawv qhia no yog ua raws ntau lwm yam kev qhia uas kuv pom hauv is taws nem thiab kuv yuav muab cov txuas rau lawv kom nkag siab zoo dua. Qee qhov kev paub txog kev tsim qauv yooj yim xav tau (HTML, Python, …).

Kauj ruam 1: Kho vajtse

Raws li tau hais ua ntej, Kuv tau sim rov qab siv ntau lub tshuab hluav taws xob qub los khaws cov nqi qis. Txawm li cas los xij qee yam khoom kuv yuav tsum yuav, yog li kuv yuav teev txhua yam uas tsim nyog rau kev tsim kho.

- Cov khoom siv Raspberry Pi. Thaum xub thawj kuv siv kuv tus qauv qub 2 los ntawm qee qhov haujlwm. Nws ua haujlwm, tab sis lub vev xaib kho thiab rov ua haujlwm tau coj kuv ntau lub sijhawm, yog li kuv thiaj li hloov mus ua qauv 3, uas ua haujlwm tau zoo dua https://www.ebay.com/sch/i.html?_from=R40&_trksid=m570.l1313 & _nkw = raspberry+pi+kit & _sacat = 0

- LCD npo. Kuv siv lub vijtsam los ntawm kuv lub khoos phis tawj qub, yog li kuv tsuas xav yuav LVDS tus tsav tsheb rau nws thiab lub zog siv https://www.ebay.com/sch/i.html?_from=R40&_trksid=m570.l1313&_nkw=hdmi+ tsav tsheb+LVDS+board & _sacat = 0

-Lub thawv ntim yas rau cov khoom siv hluav taws xob

- Passive infrared motion sensor

- AM2302 ntsuas kub/av noo

- Cov yas dub swb-rau phau ntawv rau LCD thav duab

- Cov kab hluav taws xob sib txawv (HDMI, 5.5mm rau DC lub zog, tsis siv lub khob cij txuas txuas txuas txuas, …)

Kauj Ruam 2: Tsim LCD Zaub

Tsim cov LCD Zaub
Tsim cov LCD Zaub
Tsim cov LCD Zaub
Tsim cov LCD Zaub
Tsim cov LCD Zaub
Tsim cov LCD Zaub

Kuv siv lub vijtsam LCD los ntawm kuv lub laptop qub qub. Muaj ntau txoj kev qhia yuav ua li cas, kuv ua raws qhov no:

www.instructables.com/id/How-to-reuse-the-old-LCD-Screen-of-your-broken-Lap/

Kuv tau rhuav tshem lub hau ntawm kuv lub laptop qub, tshem tawm cov duab LCD thiab tom qab ntawd xaj kom LVDS tus tsav tsheb raug. Kuv muab tus muag khoom cov lej khoom, uas tuaj yeem pom ntawm sab nraub qaum ntawm LCD, hauv kuv qhov xwm txheej nws yog LP171WE3 (TL) (A2) - saib hauv qab daim ntawv lo rau sab xis ntawm daim duab kawg, thiab tom qab ntawd nws xa qhov tsim nyog LVDS rau kuv. Thov nco ntsoov, koj tseem yuav xav tau lub zog siv rau cov zaub, yog li thov tus muag khoom xa nws ib yam. Kuv kuj tau yuav ib lub thawv yas zoo 14.5 × 7.5 × 2cm kom haum rau lub rooj tsav tsheb kom zoo thiab muab txuas rau sab nraub qaum ntawm LCD.

Tam sim no cov zaub LCD muaj cov xim tha xim, uas tsis zoo li. Thaum xub thawj kuv tau pleev xim rau xim dub, tab sis cov xim pib tev tawm. Yog li kuv tau siv plaub daim yas yas dub rau ntawm cov hlua khi, uas ib txwm siv los khi cov ntawv los xij, txiav lawv kom haum thiab txuas lawv los npog lub thav duab. Qhov no tau saib zoo, yog li kuv txuas txhua lub xov tooj, txuas hauv HDMI rau kuv tus qub Raspberry Pi thiab Voila - nws ua haujlwm! Muaj daim duab qhia ntawm lub vijtsam, yog li kuv tau npaj siab txav mus rau qib tom ntej - cov ntaub ntawv twg los qhia rau ntawm lub vijtsam thiab yuav qhia nws li cas.

Kauj ruam 3: Teeb tsa Software

Thaum kuv tau saib hauv internet rau qee qhov qhia, yuav tsim daim ntawv qhia hnub li cas, Kuv tau tshoov siab los ntawm nplooj ntawv no https://dakboard.com/site. Lawv muab cov khoom tiav (tso saib, khoos phis tawj thiab ua haujlwm software), tab sis lawv kuj muaj kev qhia zoo rau DIY daws (https://blog.dakboard.com/diy-wall-display/). Kuv qhia koj kom ua raws cov lus qhia no, yam tsawg kawg rau thawj ntu nrog cov lus qhia ntawm kev npaj thiab teeb tsa cov kab ke ntawm Raspberry, yog li qhov browser pib thauj khoom lub vev xaib xav tau ntawm khau raj.

Qhov no ua haujlwm tau zoo, txawm li cas los xij kuv tab tom nrhiav qee qhov kev daws teeb meem, uas tuaj yeem hloov kho raws li kuv xav tau. Kuv tau txiav txim siab teeb tsa kuv tus kheej lub vev xaib thiab tsim lub vev xaib, uas yuav qhia cov ntaub ntawv ntxiv nrog rau daim ntawv qhia hnub. Kuv tau xaiv Wordpress.org, txij li nws tau sau tseg zoo thiab muaj kev txhawb nqa zoo thiab zej zog loj los pab koj. Nov yog kev qhia yuav ua li cas rau nruab Wordpress ntawm Raspberry Pi: https://projects.raspberrypi.org/en/projects/lamp-web-server-with-wordpress. Nrog Wordpress teeb tsa, nws yog lub sijhawm los tsim kuv lub vev xaib. Koj tuaj yeem siv ib qho ntawm ntau cov ntsiab lus muab, lossis tsim los ntawm kos. Xijpeem, qee qhov kev paub HTML programming xav tau rau qhov no.

Kuv tau tsim kuv nplooj ntawv, yog li ntawm sab laug daim ntawv qhia hnub tau qhia (https://sl.wordpress.org/plugins/google-calendar-events/), thaum nyob sab xis ntawm lub sijhawm thiab hnub tim tau qhia (https://www.timeanddate.com/clocks/free.html thiab https://www.arclab.com/en/kb/htmlcss/display-date-time-javascript-php-ssi.html). Kev kwv yees huab cua yog los ntawm nplooj ntawv no (https://www.1a-vreme.si/vremensko-okno/), uas muab kev kwv yees huab cua rau lub nroog Slovenian, tab sis kuv twv widgets rau lwm lub tebchaws tuaj yeem pom zoo ib yam hauv internet. Kev ntsuas kub tau sau siv AM2302 sensor (https://www.ebay.com/sch/i.html?_from=R40&_trksid=m570.l1313&_nkw=AM2302+&_sacat=0), raws li tau piav qhia thaum kawg ntawm tshooj lus no. Hauv qab yog qhov yooj yim txhua hnub suav hnub tim, uas qhia seb muaj pes tsawg hnub nyob rau qee qhov xwm txheej (nthuav rau kuv cov menyuam kom paub, pes tsawg hnub lawv yuav tau tos qee yam). Nyob rau sab xis saum toj kawg nkaus yog MetaSlider plugin (https://wordpress.org/plugins/ml-slider/), uas ua rau swb rau xaiv cov duab ntawm kuv tsev neeg. Tsis tas li kuv tau siv Background Slider plugin (https://sl.wordpress.org/plugins/background-slider-master/) los qhia kuv qee qhov duab tsis raug rau tom qab zoo dua.

Raws li tau hais ua ntej, qhov ntsuas kub hauv tsev tau siv AM2302 sensor. Muaj ntau ntau cov lus qhia yuav ua li cas thiaj ua kom sov, Kuv ua raws qhov no: https://www.modmypi.com/blog/am2302-temphumidity-sensor. Tom qab ntawd kuv tau hloov lub ntsuas no mus rau lwm tus Raspberry Pi nrog Tus Pabcuam Hauv Tsev khiav ntawm nws, vim nws yooj yim nyeem thiab tshaj tawm qhov tseem ceeb siv nws DHT Sensor tivthaiv (https://www.home-assistant.io/components/sensor.dht/). Tus Pab Tsev tseem tuaj yeem khaws qhov kub sab nraud siv ntau yam huab cua, Kuv siv YR.no tivthaiv (https://www.home-assistant.io/components/sensor.yr/). Nrog qhov ntawd, Kuv tau sau tsab ntawv siv tshuab kom sib sau ua ke sab hauv tsev/sab nraud los ntawm cov khoom no thiab sau lawv mus rau cov ntawv sau, uas tom qab ntawd tso tawm ntawm kuv daim ntawv qhia hnub ntsa. Yog xav paub ntxiv txog Tus Pab Tsev, saib lub vev xaib (https://www.home-assistant.io/).

Kauj Ruam 4: Xaiv tau - Tua Tawm Cov Zaub

Tam sim no peb muaj peb daim ntawv qhia hnub teeb tsa thiab ua haujlwm, tsuas yog txoj kev uas peb nyiam nws. Tab sis peb tsis xav kom cov zaub qhib 24/7. Peb tsuas xav kom nws nyob, thaum ib tus neeg nyob hauv tsev. Tsis tas li peb tsis xav kom nws qhib thaum ib tag hmo, thaum peb mus rau chav dej, nws ci heev! Yog li peb yuav txuas lub ntsuas hluav taws xob pom kom pom, thaum qee leej sawv ntawm nws xub ntiag, thiab ntxiv qee lub sijhawm txwv, thaum nws yuav tsum qhib.

Thov nco ntsoov tias kuv cov txuj ci txuj ci yog qhov txwv, yog li hauv qab no tsis tuaj yeem pom zoo, txij li kuv tau xaiv nws los ntawm ntau lub rooj sib tham online thiab qhia, tab sis qhov tseem ceeb nws ua haujlwm. Tseem, ib qho kev pom zoo tseem txais tos. Ua ntej peb yuav pib nrog kev sim kom tig saib/tua tus kheej. Txog qhov ntawd, peb yuav tsim ob daim ntawv (piv txwv li monitor_on.sh thiab monitor_off.sh) thiab sau qee cov cai hauv nws. Qhov yooj yim tshaj plaws los ua qhov no yog nkag mus rau hauv koj li Raspberry siv SSH thiab ntaus

sudo nano monitor_on.sh

thiab ntaus cov cai hauv qab no

tvservice -ua ntej;

startx/usr/bin/graphical_launcher `fgconsole`

Nias CTRL+X kom txuag thiab tawm, tom qab ntawd tsim cov ntawv thib ob

sudo nano monitor_off.sh

thiab ntaus cov cai hauv qab no

tvservice -tawm;

Ib zaug ntxiv, nias CTRL+X kom txuag thiab tawm. Ua cov ntaub ntawv tsim tshiab no ua tiav:

sudo chmod +x monitor_on.sh

sudo chmod +x monitor_off.sh

Tam sim no sim yog tias cov lus txib no ua haujlwm, ntaus

sudo./monitor_off.sh

sudo./monitor_on.sh

Tam sim no tus saib yuav tsum tua thiab ua raws. Kuv tau pom tias ntawm Raspberry Pi 2 nws siv yuav luag 10 vib nas this rau lub ntsuas saib kom qhib. Ntawm Raspberry Pi 3 nws siv sijhawm 1-2 vib nas this. Tom ntej no peb yuav txuas lub infrared sensor, uas yuav ua rau cov ntawv sau no. Ib zaug ntxiv, muaj ntau qhov kev qhia yuav teeb tsa Raspberry Pi thiab PIR, Kuv ua raws qhov no: https://www.instructables.com/id/PIR-Sensor-Interfacing-With-Raspberry-Pi/. Yeej, tsim cov ntaub ntawv nrog siv nano editor (piv txwv li motion_sensor.py) thiab ntaus tus lej Python tsim nyog hauv nws. Hauv qab no yog qhov piv txwv ntawm kuv cov ntaub ntawv:

ntshuam RPi. GPIO ua GPIOimport lub sijhawm import sysimport subprocessimport datetime li dtimport osGPIO.setwarnings (Cuav) # GPIO.setmode (GPIO. BOARD) GPIO.setmode (GPIO. BCM) GPIO.setup (17, GPIO. IN) #PIRturned_off = Falselastm time.time () SHUTOFF_DELAY = 180 # vib nas this Muaj tseeb: i = GPIO.input (17) yog tias kuv == 0: #Thaum cov zis tawm los ntawm lub suab sensor qis, tig saib OFFif tsis tig_off thiab time.time ()> (last_motion_time + SHUTOFF_DELAY): luam tawm "Tsis muaj neeg nkag los", iturned_off = Truetime.sleep (1) subprocess.call (['/home/pi/monitor_off.sh'], plhaub = Tseeb) elif i == 1: #Thaum tso tawm los ntawm lub suab sensor yog HIGH, tig saib ONprint "Intruder kuaj pom", itime.sleep (1) last_motion_time = time.time () sys.stdout.flush () yog tig_off thiab dt.datetime.now (). teev> 5 thiab dt.datetime. tam sim no (). teev <23: turns_off = Falsesubprocess.call (['/home/pi/monitor_on.sh'], plhaub = Tseeb) yog _name_ == '_main _': sim: tseem ceeb () tshwj tsis yog KeyboardInterrupt: GPIO.cleanup ()

Nco ntsoov tias "GPIO.setup (17, GPIO. IN)" qhia tias tus pin tso tawm los ntawm PIR txuas nrog tus pin 17 ntawm Raspberry Pi. Tus pin twg yog qhov nyob ntawm seb koj txheeb xyuas GPIO.setmode (GPIO. BOARD) lossis GPIO.setmode (GPIO. BCM). Qhov sib txawv tau piav qhia ntawm no: https://raspberrypi.stackexchange.com/questions/12966/what-is-the-difference-between-board-and-bcm-for-gpio-pin-numbering. Kuv muaj # nyob ntawm xub ntiag ntawm GPIO. BOARD, yog li nws tsis quav ntsej thiab GPIO. BCM tau siv.

Pom kab

SHUTOFF_DELAY = 180 #seconds

Nov yog tau teev tseg, ntev npaum li cas lub ntsuas hluav taws xob tau qhib txij li tau pom lub suab zaum kawg, ua ntej nws raug kaw. Qhov no muaj txiaj ntsig vim tias kuv tsis xav kom lub ntsuas hluav taws xob tua/qhib tas li thaum kuv taug kev los ntawm nws, tab sis xav kom nws qhib rau qee lub sijhawm, ua ntej nws tawm. Kuv tau xaiv qhov ncua sijhawm ntawm 180 vib nas this, yog li lub ntsuas hluav taws xob tua tawm li 3 feeb tom qab pom qhov kev tawm suab zaum kawg.

Thaum kawg, kab no

yog tig_off thiab dt.datetime.now (). teev> 6 thiab dt.datetime.now (). teev <23:

hais tias lub ntsuas saib tsuas yog qhib thaum 6:00 txog 23:00, yog li nws tsis cuam tshuam kuv thaum hmo ntuj. Cov kab

luam tawm "Tsis muaj neeg nkag los", i

thiab

luam "Intruder kuaj pom", i

yog rau kev sim cov ntawv nkaus xwb, koj tuaj yeem tshem tawm lawv tom qab, thaum koj yuav muaj nws ua haujlwm. Tam sim no sim cov ntawv:

sudo python motion_sensor.py

Koj yuav tsum pom cov lus "Pom tus neeg nkag mus", yog tias koj yoj saum lub sensor, txwv tsis pub nws yuav yog "Tsis muaj neeg nkag los". Thaum tsab ntawv no raug sim thiab ua haujlwm, teeb nws kom pib ntawm khau raj:

sudo nano ~/.config/lxsession/LXDE-pi/autostart

thiab ntxiv kab hauv qab no

@sudo/usr/bin/nab hab sej /home/pi/motion_sensor.py

Tau kawg koj yuav tsum qhia lub npe cov ntaub ntawv raug ntawm Python tsab ntawv koj tsim.

Kauj ruam 5: Dai daim Calendar

Nrog txhua qhov teeb tsa, nws yog lub sijhawm los dai daim ntawv qhia hnub ntawm phab ntsa!

Thaum xub thawj kuv tau xav txog kev zais Raspberry Pi tom qab lub vijtsam LCD, yog li tsuas xav tau ib lub xov tooj (DC zog). Tab sis txij li Raspberry khiav ntawm 5V thiab LCD zaub khiav ntawm 12V, Kuv xav tau hloov pauv ntxiv. Tsis tas li, rooj plaub Raspberry yog qhov tuab dua, uas txhais tau tias LCD yuav tau nrug li 3 centimeters ntawm phab ntsa. Yog li kuv tso tseg qhov no thiab tsuas yog tso cov khoom siv hluav taws xob LCD tom qab lub LCD, yog li tam sim no nws tsawg dua 1 centimeter deb ntawm phab ntsa. Kuv tau txais ob 5 meter ntev cables, ib qho HDMI thiab ib qho 5, 5mm rau DC lub zog siv. Ob lub xov tooj yog dawb, zoo li phab ntsa, uas txhais tau tias lawv tsis sawv tawm ntau. Kuv tau teeb lub LCD rau ntawm phab ntsa thiab muab Raspberry nyob rau sab saum toj ntawm lub tub yees ntawm sab nrauv, yog li nws tau pib zais, tseem tseem nkag tau yooj yim.

Pom zoo: