Cov txheej txheem:

Wake Me Up - Smart Alarm Clock: 6 Kauj Ruam
Wake Me Up - Smart Alarm Clock: 6 Kauj Ruam

Video: Wake Me Up - Smart Alarm Clock: 6 Kauj Ruam

Video: Wake Me Up - Smart Alarm Clock: 6 Kauj Ruam
Video: Top 9: Best Smart Alarm Clocks of 2018 2024, Hlis ntuj nqeg
Anonim
Wake Me Up - Ntse Tswb Tswb
Wake Me Up - Ntse Tswb Tswb

Ua rau kuv sawv yog lub tswb ntse uas tseem tuaj yeem siv ua lub teeb ci ntse.

Cov teeb coj hauv qab ua piv txwv lub teeb ci tuaj rau hauv koj chav. Qhov no ua rau muaj kev nyob ntsiag to, ib txoj hauv kev kom ua rau koj hnub pib.

Lub tswb nrov kuj tseem nruab nrog 4*7 ntu qhia rau nyeem lub sijhawm, tus neeg hais lus kom sawv nrog koj lub suab paj nruag uas koj nyiam, kov lub pob, lub ldr rau kho qhov ci ntawm cov kab ntawv thiab lub ntsuas kub uas koj tuaj yeem siv los saib kub ntawm koj chav.

Khoom siv

Cov npe ntawm tus nqi pes tsawg kuv tau them tuaj yeem pom ntawm no:

Microcontrollers thiab computer:

Raspberry Pi 4 Kuv siv raspberry pi 4 4GB txawm li cas los xij, ib qho raspberry pi qauv 3+ yuav tsum zoo

Arduino Ib

Arduino yog siv los tswj 4*7 ntu ntu moos saib.

Sensors:

  • TMP36: ntsuas kub
  • LDR: Lub teeb nyob ntawm tus tiv thaiv

Actuators:

  • WS2801: Ib tus zuj zus adressable ledstrip
  • LCD zaub: A 16*2 LCD zaub.
  • 4*7 ntu moos zaub

IC cov:

  • 74HC595: Hloov npe rau lub lcd zaub
  • MCP3008: 8-ntsis Analog rau digital hloov pauv
  • Logic level converter: Siv los sib tham ntawm raspi thiab arduino

Lwm cov khoom:

  • Adafruit MAX9744 lub tshuab ua kom nrov nrov los hais lus
  • Ib tus neeg hais lus, Kuv tau siv Visaton 4Ohm 8Watt tus hais lus ntau yam (Daim duab No. 2240)
  • Lub hwj chim 9volt muab lub zog rau lub zog loj
  • Lub 5volt fais fab mov los muab cov kab hluav taws xob thiab lwm yam khoom. Koj nco ntsoov tias txhua tus coj hauv cov kab ntawv tuaj yeem nqes 60mA yog li ua kom ntseeg tau tias koj lub hwj chim txaus.
  • Ob peb 220Ohm resistors
  • Ib daim ntawv me me los tso rau hauv koj rooj plaub.

Cov Cuab Yeej:

  • Ib qho hlau txuas.
  • Qee yam los ua rooj plaub (Kuv siv lub tshuab luam ntawv 3d nrog PLA thiab PETG thiab qee cov ntawv nplaum yas kom tau txais cov ntoo zoo.)

Kauj Ruam 1: Teeb tsa Raspberry Pi

Raspberry pi yog peb lub ntsiab tswj hwm micro.

Raspberry pi sau peb lub vev xaib hauv cheeb tsam, cov ntaub ntawv, tswj cov kab ntawv coj, hais lus, …

Ntu 1: Txhim Kho Raspbian

Siv qhov kev qhia no los teeb tsa raspbian:

Nco ntsoov tias SSH tau qhib

Ntu 2: Kev sib txuas

Txhawm rau kom txuas nrog internet, koj yuav tsum tau txais kev nkag mus rau koj li raspberry pi lub davhlau ya nyob twg. Kuv pom zoo siv putty. Hauv hom davhlau ya nyob twg:

wpa_passphrase "YourNetwork" "YourSSID" >> /etc/wpa_supplicant/wpa_supplicant.conf

"YourNetwork" yog lub npe ntawm koj lub network wifi thiab "YourSSID" yog tus password ntawm lub network.

Thaum koj tau ntxiv lub network sim rov pib dua Raspberry Pi.

Ntaus cov lus txib 'ping 8.8.8.8' qhov no yuav xa pob ntawv mus rau google servers yog tias koj tau txais lus teb koj lub network tau teeb tsa thiab ua haujlwm!

Ntu 3: Txhim kho cov program xav tau

Peb yuav xav tau qee qhov teeb tsa qee qhov haujlwm ntxiv kom tau txais txoj haujlwm no thiab ua haujlwm.

Ua ntej peb pib pib ua 2 cov lus txib kom ntseeg tau tias txhua yam tau hloov kho.

sudo apt hloov tshiab

sudo apt hloov tshiab

Qhov no yuav siv sijhawm me ntsis.

Apache

sudo apt nruab apache2 -y

sudo apt nruab php libapache2-mod-php -y

MariaDB

sudo apt nruab mariadb-server mariadb-client -y

sudo apt nruab php -mysql -y

PHPMyAdmin

sudo apt nruab phpmyadmin -y

Python pib

Peb yuav tsum tau teeb tsa pip kom pab tau qee lub tsev qiv ntawv sej

pip3 nruab mysql-connector-python

pip3 nruab flask-socketio

pip3 nruab flask-cors

pip3 nruab gevent

pip3 nruab gevent-websocket

Kauj Ruam 2: Txuas Hluav Taws Xob

Txuas Cov Khoom Siv Hluav Taws Xob
Txuas Cov Khoom Siv Hluav Taws Xob
Txuas Cov Khoom Siv Hluav Taws Xob
Txuas Cov Khoom Siv Hluav Taws Xob

Kuv tau ntxiv 2 lub tswv yim, 1 yog lub phiaj xwm phiajcim rau kev ntsuas lub hom phiaj. Kuv pom zoo tsim thawj lub tswv yim thiab sim ua kom txoj cai ua haujlwm.

Kuv tau ntxiv cov ntaub ntawv fritzing hauv qab no.

Kauj Ruam 3: Tsim Database

Tsim Database
Tsim Database

Nov yog cov txheej txheem database kuv tau ua. Cov lus nyob hauv Dutch tab sis kuv yuav piav qhia txhua lub rooj kom ntxaws.

Table 1: tblMuziek

Nov yog lub rooj yooj yim zoo nkauj. Nws txuag tus kws kos duab lub npe, lub npe nkauj thiab lub npe ntawm zaj nkauj.

Table 2: tblLedstrip

Cov lus no taug qab cov xwm txheej tam sim no ntawm daim kab xev nws txuag lub xeev ntawm daim kab xev. Peb xav tau qhov no rau kev ua haujlwm ntse.

Rooj 3: tblSensoren

Cov lus no taug qab cov ntsuas hauv peb lub tswb. Peb khaws lub npe ntawm lub sensor thiab MCP3008's channel

Table 4: tblMeting

Cov lus no khaws cov txiaj ntsig ntawm peb cov ntsuas ntsuas ua ke nrog lawv lub sijhawm.

Table 5: tblWekker

Lub rooj no khaws tus password thiab lub npe ntawm koj lub tswb moos (piv txwv li Chav pw) Cov lus no tsis tas yuav tsum tab sis kuv tau ntxiv vim kuv xav tias koj yuav muaj ntau dua 1 lub tswb hauv koj lub tsev.

Rooj 6: tblAlarm

Qhov no yog zaum rooj tseem ceeb tshaj plaws. Nws taug qab lub tswb uas koj tau teeb tsa thiab lub moos tau ua dab tsi (zaj nkauj twg los ua si, uas coj ua ntu zus, Hnub twg nws yuav tsum tawm mus, …). Nws yog qhov tseem ceeb heev kom taug qab ntawm 2 hnub. 1 hnub tau siv los khaws cia nyob rau teev twg lub tswb yuav tsum tawm. Lwm tus neeg taug qab lub sijhawm kawg lub tswb nrov tawm. Txhawm rau paub hnub ua haujlwm hnub twg nws yuav tsum tawm mus Kuv tau siv tus lej sib txawv uas muaj tus lej 7 tus lej. Thawj tus lej yog hnub Monday, hnub Tuesday thib ob, … Yog tias nws yog 1 ces nws yuav tsum tawm mus, yog tias nws yog 0 nws yuav tsum tsis txhob. Piv txwv: 1111100 qhov no txhais tau tias lub tswb ceeb toom no yuav tsum kaw rau hnub Monday, Tuesday, Wednesday, Thursday thiab Friday.

Kauj Ruam 4: Teeb Arduino

Cov kauj ruam no yooj yim heev. Yuav muaj qhov txuas rau kuv github ntawm cov kauj ruam tom ntej uas koj tuaj yeem rub tawm cov ntaub ntawv arduino.

Qhov kev zov me nyuam ua dab tsi?

Qhov kev zov me nyuam tos cov ntaub ntawv xov xwm los ntawm pi.

Sai li sai tau cov ntaub ntawv tau txais nws parses hla txoj hlua thiab xa rov qab lees paub rau tus pi.

Txoj hlua yuav yog ib yam zoo li no: '1201' qhov no txhais tau tias nws yog 12:01. Kuv siv ib qho anode 7sese tso saib qhov no txhais tau tias Tus lej yuav tsum siab thiab A, B, C, D, E, F, G thiab DP yuav tsum qis kom qhib rau lawv. Yog tias koj siv cov cathode ib txwm koj yuav tsum hloov pauv HIGH rau LOW & LOW rau HIGH.

Nov yog qhov txuas nrog cov ntaub ntawv ntau ntxiv txog yuav ua li cas 7 ntu qhia ua haujlwm. (nrog kev siv lub tsev qiv ntawv):

www.instructables.com/id/Using-a-4-digit-7…

Nov yog qhov txuas txog 7 ntu qhia yam tsis siv lub tsev qiv ntawv:

create.arduino.cc/projecthub/SAnwandter1/p…

Kauj Ruam 5: Raspberry Pi Backend

Raspberry Pi Backend
Raspberry Pi Backend

Koj tuaj yeem rub kuv tus lej siv Github. (https://github.com/VanHevelNico/WakeMeUp)

Yuav ua li cas rau nruab qhov program:

Lub backend tau sau hauv nab nab siv lub raj mis. Koj tuaj yeem ua qhov kev pabcuam uas pib qhov haujlwm no (app.py) tau txais.

Koj yuav tsum tso tus lej nkag mus rau hauv html cov ntaub ntawv ntawm apache server peb rub tawm ua ntej. (/var/html)

Txoj haujlwm ua haujlwm li cas?

Thaum lub tswb ceeb toom qhib rau koj lub moos tus IP chaw nyob (nws yuav tshwm ntawm lub lcd)

Thaum koj mus rau tus IP chaw nyob hauv koj tus browser koj lub khoos phis tawj yuav xa lub socket.io thov mus rau lub backend hais tias tus neeg siv khoom tau txuas nrog. Thaum cov backend tau txais qhov no ob peb xov yuav pib uas kuv yuav piav qhia hauv qab no.

Teeb

Qhov no intializes txhua yam khoom xav tau.

GetTemp

Qhov no nyeem mcp3008 channel 0 thiab hloov cov ntaub ntawv binary rau qhov kub thiab qhov tseeb thiab muab tso rau hauv cov ntaub ntawv nrog hnub tim thiab tam sim no.

GetTempGrafiek

Qhov no tau txais 20 qhov txiaj ntsig yav dhau los ntawm qhov ntsuas kub thiab tso nws mus rau tom ntej.

tijd_sturen

Txoj kev no tau txais lub sijhawm tam sim no thiab tshawb xyuas yog tias feeb hloov lawm. Yog tias nws tau hloov pauv txoj haujlwm xa lub sijhawm tshiab rau arduino siv kev sib txuas lus txuas

kos Alarmen

Qhov no yog txoj kev tseem ceeb tshaj plaws. Nws tau txais txhua lub tswb uas tau qhib thiab tshawb xyuas yog tias ib qho ntawm cov tswb no yuav tsum mus nruab nrab ntawm tam sim no thiab 5 feeb dhau los (qhov no yog qhov tsis ua kom ntseeg tau tias txhua lub tswb mus thaum nws xav tau). Yog tias lub tswb yuav tsum tawm mus peb yuav pib lub suab paj nruag, kab ntawv coj mus,… Peb nyeem lub zog rhiab tiv taus tsis tu ncua thiab thaum tus nqi poob qis dua 1000 (nyeem fsr raug nias) Peb tig lub tswb thiab hloov lub tswb hauv database. Peb teeb hnub tim uas lub tswb nrov tawm mus zaum kawg rau hnub tam sim no.

xwm txheej teeb

Txoj kev no tso tawm tus nqi ntawm cov kab ntawv coj mus thiab tig lub ledstrip rau yog tias xav tau.

lichtAanpassen

Nov yog ib txoj hauv kev ntxiv kom paub tseeb tias lub teeb coj thiab lub tswb teeb tsis sib haum.

Kauj Ruam 6: Rooj plaub

Case
Case
Case
Case
Case
Case

Qhov txuas rau kuv cov ntaub ntawv tuaj yeem pom ntawm no:

Kuv siv lub tshuab luam ntawv 3d los luam lub casing. Nws tau luam tawm hauv 4 qhov sib txawv:

  1. Cov phaj pem hauv ntej nrog lub qhov rau tus hais lus thiab qee phab ntsa rau 7 ntu tso saib
  2. Lub nplhaib sab nrauv rau daim kab xev hauv qhov sib txawv PETG.
  3. Qhov nruab nrab
  4. Lub nraub qaum nrog lub qhov rau lub lcd thiab lub qhov rau cov xaim.

Hauv tus qauv qub tsis muaj qhov rau 7 ntu qhia tab sis qhov no xav tau vim tias txwv tsis pub lub teeb ntawm 7 ntu ntu yuav tsis ci dhau.

Raws li koj tuaj yeem pom tom qab muab tag nrho cov khoom siv hauv kuv siv cov yas nplaum nrog cov ntoo zoo los ua qhov kawg zoo dua. Lub moos saib ci ntsa iab hla cov ntawv nplaum uas tsim cov nyhuv zoo nkauj heev.

Pom zoo: