Cov txheej txheem:

DIY Tsawg-Voltage Sab Nraud Teeb Pom Kev Zoo Siv Raspberry Pi: 11 Cov Kauj Ruam (nrog Duab)
DIY Tsawg-Voltage Sab Nraud Teeb Pom Kev Zoo Siv Raspberry Pi: 11 Cov Kauj Ruam (nrog Duab)

Video: DIY Tsawg-Voltage Sab Nraud Teeb Pom Kev Zoo Siv Raspberry Pi: 11 Cov Kauj Ruam (nrog Duab)

Video: DIY Tsawg-Voltage Sab Nraud Teeb Pom Kev Zoo Siv Raspberry Pi: 11 Cov Kauj Ruam (nrog Duab)
Video: Leej Muam Dai Siab official audio by Dang Thao & J Vang 2024, Kaum ib hlis
Anonim
DIY Tsawg-Voltage Sab Nraud Teeb Pom Kev Zoo Siv Raspberry Pi
DIY Tsawg-Voltage Sab Nraud Teeb Pom Kev Zoo Siv Raspberry Pi
DIY Tsawg-Voltage Sab Nraud Teeb Pom Kev Zoo Siv Raspberry Pi
DIY Tsawg-Voltage Sab Nraud Teeb Pom Kev Zoo Siv Raspberry Pi
DIY Tsawg-Voltage Sab Nraud Teeb Pom Kev Zoo Siv Raspberry Pi
DIY Tsawg-Voltage Sab Nraud Teeb Pom Kev Zoo Siv Raspberry Pi

Vim li cas?

Kuv yuav tsum lees, Kuv, zoo li ntau lwm tus, kiv cua loj hauv internet ntawm yam (lossis IoT). Kuv tseem tseem nkees nkees tag nrho kuv lub teeb, khoom siv, lub qhov rooj pem hauv ntej, lub qhov rooj rau tsheb thiab leej twg paub dab tsi ntxiv rau hauv internet nthuav tawm. Tshwj xeeb nrog cov xwm txheej zoo li kev sib tsoo tsis ntev los no ntawm Amazon S3 cov kev pabcuam thiab muaj kev ruaj ntseg zoo ib yam. Puas yog peb tseem muaj cov cuab yeej IoT uas peb siv? Yuav ua li cas yog tias koj tus muab kev pabcuam hauv internet txwv kev pabcuam lossis nws poob qis? Ntau lub ntsiab lus ntawm qhov ua tsis tiav rau kuv.

Dhau 3 xyoos dhau los, Kuv tau muaj qhov kev tshawb nrhiav tawg thiab kawm nrog Raspberry Pi thiab thoob plaws lub sijhawm ntawd tau muaj lub sijhawm los ua txhua yam los ntawm kev siv lub tshuab ua teb tsis siv neeg, txhawm rau rov kho kuv lub tshuab luam ntawv laser qub los ntawm kev sib txuas hauv network thiab ntes tau ntawm qee qhov kev ua si qab zib retro (txawm hais tias Arduino tseem yog kuv thawj txoj kev hlub …).

Hauv lub xyoo dhau los, Kuv tau ua haujlwm ntxiv lub sam thiaj qab thiab txhim kho kuv lub tiaj nraum qaum tsev. Kuv paub kuv xav tau qee qhov teeb pom kev sab nraum zoov tab sis tsis txaus siab rau cov kab ke thiab lawv tsis muaj kev sib txuas. Sib sau ua ke kev tshoov siab los ntawm ib puag ncig lub vev xaib, Kuv tau hacked ua ke qhov ua haujlwm tau zoo rau kev ua haujlwm qis-qhov hluav taws xob sab nraum zoov teeb pom kev zoo, ua kom muaj kev sib txuas sib cais rau koj lub network hauv zej zog (tuaj yeem nthuav tawm yog tias koj xav tau) thiab yoog raws txaus kom nthuav dav thiab hloov kho rau koj tus kheej lub siab lub ntsws.

Kev lees paub:

TheFreeElectron - Yooj Yim thiab Intuitive Web Interface rau Koj Raspberry Pi - yog tias koj tau dai rau ntawm lub vev xaib, txheeb xyuas ntawm no, kev tshoov siab rau sab server

CodePen - qhov zoo kawg rau CSS kev tshoov siab thiab kawm

Code Academy - Kuv yog tus qub tsev kawm ntawv HTML txiv leej tub, nrog qee tus. NET & C# pov rau hauv. Python, CSS, Javascript, PHP - txhua yam tau txhawb nqa mus rau qib siv tau/hackable nrog kev pab los ntawm Code Academy.

Txheej txheem cej luam:

Lub zog hluav taws xob qis (12V teeb/xa tawm & 5V RPi/xa tawm) muab los ntawm tib lub zog ATX

Raspberry Pi teeb tsa nrog Apache (web server), WiringPi (kev tswj hwm GPIO) siv PHP (server-side) nplooj ntawv tseem ceeb nrog Javascript (tus neeg siv sab) & Python (ntawv sau) rau saib xyuas GPIO xwm txheej thiab nthuav tawm cov ntaub ntawv cuam tshuam rau lub vev xaib tseem ceeb. Lub thawv ntawv (hauv kev zais) siv los tswj GPIO tus pin, uas tswj kev xa tawm, uas tswj lub teeb! Nws yog qhov khawv koob.

Los ntawm txoj kev, koj yuav pom cov duab hauv tsev (kab ke, cov thawv sib txuas, thiab lwm yam) - me ntsis sab nraum qhov kev qhia no. Kuv yuav tsom mus rau lub zog hluav taws xob ntawm lub kaw lus. Txog koj kom nws ua pov thawj huab cua (yog xav tau) lossis zoo nkauj (yog xav tau) lossis ob qho tib si (xav tau).

Zoo siab los qhia thiab tos ntsoov rau lub zej zog cov lus tawm tswv yim no. Cia peb dov - pib kom tiav.

Kauj Ruam 1: Kho Vajtse, Qhov Chaw & Cov Cuab Yeej

Kho vajtse, Qhov & Cov cuab yeej
Kho vajtse, Qhov & Cov cuab yeej

Puas muaj ntu zoo dua los siv? Yog lawm

Kuv puas tau txais kuv lub kaw lus ua haujlwm tau zoo nrog cov ntu no? Yog lawm

Koj puas yuav sim qee yam txawv me ntsis? Vim li cas ho tsis?! Kho vajtse/Software

  1. RaspberryPi - lub tshuab ntxhua khaub ncaws zoo dua thiab RPi3 zoo vim koj yuav xav tau wifi

    • Piv txwv tias: Koj tau txais kev thauj khoom tshiab ntawm Rasbian
    • Piv txwv tias: Koj tau hloov tus password tsis raug & koj tau pab SSH (nrog lub vijtsam)
    • Los yog tsis muaj lub vijtsam (saib Kauj Ruam 1)
  2. ATX Lub zog siv hluav taws xob - rov ua dua yog qhov zoo tshaj plaws, Kuv muaj kuv los ntawm kev ua si qub qub - xyuam xim rau watts thaum ua haujlwm tawm pes tsawg lub teeb uas koj xav tau thiab hom phiaj, saib rau [email protected]+Amp fais fab kev tsheb nqaj hlau - qhov no yog cov xaim xaim thiab yuav muab RPi nrog lub zog tsis tas yuav tsum ua tag nrho cov tshuab nqus dej
  3. Teeb Sab Nraud (12v) - cov no tau zoo heev: qis wattage, tsim nyog tsim nyog, tus nqi tsim nyog
  4. 5v thiab/lossis 12v Relay Modules
  5. Qee hom tsev nyob - Kuv siv 8X8X4 PVC Junction Box
  6. Notepad ++ w/ NppFTP - siv los thauj thiab kho cov ntaub ntawv RPi sai
  7. Putty - siv los teeb tsa ob peb pob ntxiv ntawm RPi

Qhov

  1. Sab nraum zoov ntsuas 12v fais fab cable
  2. Cov hlua hlau
  3. 1/2 "PVC & qee txoj cai sib koom tes - 2 ko taw thiab 2 txoj cai rau txhua txoj kab sib txawv uas koj npaj yuav khiav
  4. Qee qhov ethernet cable
  5. Hlau dhia - ntau tus txiv neej/poj niam sib txuas
  6. Ua rau koj tus kheej Molex txuas
  7. Thaum tshav kub kub ntsws tubing
  8. Daim Kab Xev Hluav Taws Xob
  9. MicroUSB Cable
  10. Tsis teb los tau: Cov xov hlau txuas no zoo heev - siv cov no txhua lub sijhawm (cov menyuam yaus lub tsheb muaj zog, lub vaj ntse (cov txuas txuas txuas txuas) thiab USB fais fab txuas ATX rau RPi)

Cov cuab yeej

  1. Cov khub zoo ntawm cov hlau txiav - ntawm sab me
  2. Phillips Ntsia Hlau
  3. Ib khub me me ntawm rab rab qhov ntswg
  4. Yeem: Voltmeter nrog ntsuas txuas mus ntxiv - ntau cov xov hlau thiab muaj txiaj ntsig zoo rau kev txheeb xyuas teeb meem …
  5. Qee lub sij hawm

Kauj Ruam 2: Paub Txog Koj Lub Hwj Huam Fais Fab

Paub Paub Koj Lub Hwj Huam Fais Fab
Paub Paub Koj Lub Hwj Huam Fais Fab
Paub Paub Koj Lub Hwj Huam Fais Fab
Paub Paub Koj Lub Hwj Huam Fais Fab

Ua tibzoo saib txhua qhov tsis sib xws ntawm cov xov hlau uas ua rau lawv txoj hauv kev tawm ntawm koj lub zog ATX. Nyob ntawm koj lub hnub nyoog, koj yuav muaj lub xov tooj sib txuas tseem ceeb (20-22 pins - pinout duab) ntxiv rau lub zog rau txhua yam ntawm lwm yam khoom - tsav, daim npav duab, lub zog pabcuam, thiab lwm yam.

  • +5VSB (Stand By) kab yog xim liab. Qhov no yuav mob siab rau koj RPi - lub zog txhua lub sijhawm
  • PS_ON kab ntsuab. Thaum qhov no txuas nrog hauv av, nws yuav qhib cov khoom siv liab thiab daj
  • +5V kab yog liab. Ib txoj kab tuaj yeem siv hluav taws xob 2-3 5v xa tawm
  • +12V kab yog daj. Koj yuav xav tau 3-4 los tso lub teeb pom kev sab nraum zoov
  • GROUND/COMMON kab yog xim dub. Koj yuav xav tau ob peb ntawm cov no rau txhua tus ntawm lwm cov xim
  • Tag nrho lwm cov xim yuav tsis siv rau txoj haujlwm no

Kauj Ruam 3: Npaj Cov Khoom Siv Hluav Taws Xob

Ua ntej, Kuv me ntsis ntawm qhov tsis lees paub:

Koj tab tom cuam tshuam nrog kab hluav taws xob, yog tias koj tsis paub/lossis hwm yam koj tab tom ua - koj tuaj yeem ua rau koj tus kheej raug mob, lossis tsis zoo … Ua ntej koj txuas ntxiv, nco ntsoov lub sijhawm no thiab txhua lub sijhawm, koj ua haujlwm nrog lub zog ATX tsis txuas muab khoom thiab muab sijhawm rau tso tawm ua ntej koj qhib nws qhib. Kuv tsis muaj lub luag haujlwm rau koj qhov tsis hwm thiab ua raws qee txoj cai yooj yim kom koj nyab xeeb.

OK! Tsiv mus!

  1. Tshem lub hwj huam hluav taws xob thiab tos 10-15 feeb rau cov khoom siv hluav taws xob tso tawm
  2. Siv phillips ntswj ntsia hlau thiab tshem cov ntsia hlau tawm ntawm rooj plaub fais fab (FYI, kev lees paub tsis zoo - yog vim li cas thiaj li zoo dua qub)
  3. Txiav tawm txhua tus Molex/cov khoom sib txuas yog li koj muaj cov kab xaim dawb
  4. Sib cais thiab teeb tsa cov kab liab, ntsuab, daj, liab thiab dub
  5. Ua tib zoo txiav tag nrho lwm cov xov hlau sab hauv rooj plaub - koj yuav tsis xav tau lawv thiab qhov no yuav txuag chaw
  6. Cap qhov kawg ntawm cov xov hlau txiav nrog me me ntawm kab xev hluav taws xob
  7. Kaw qhov ntaub ntawv rov qab nrog tsuas yog cov xov hlau uas koj xav tau los ntawm cov khoom siv, nco ntsoov txiav cov xov hlau tsis nyob ze cov cua sov lossis kiv cua

Kauj ruam 4: Fais fab rau Pi

Lub zog rau Pi!
Lub zog rau Pi!
Lub zog rau Pi!
Lub zog rau Pi!
Lub zog rau Pi!
Lub zog rau Pi!

Ua ntej koj pib tswj kev xa tawm, cia peb tau txais RPi txhua lub zog.

Nco ntsoov, Kuv tsis tau npog qhov pib ntawm kev tau txais RPi thaum pib teeb tsa (Thauj khoom OS rau SD daim npav, teeb tus password tshiab & ua kom SSH) - txheeb xyuas rov qab ntawm kho vajtse/software ntu (kauj ruam 2) rau txuas mus rau qhov txuas zoo cov ntawd.

Ua tibzoo saib thawj daim duab - cia peb tsim cov hlua sib txuas uas yuav coj txoj kab ntshav los ntawm ATX hla mus rau RPi:

USB rau ATX Power Cord

  1. Siv koj lub tshuab txiav hlau, txiav koj lub micro USB qaum kom ze rau USB kawg dua li micro USB kawg
  2. Ua tib zoo hle lub tes tsho sab nrauv ntawm txoj kab
  3. Koj yuav tsum muaj 4 xov hlau (Dub, Liab, Ntsuab & Dawb)
  4. Tawm 1/2 "mus rau 3/4" ntawm cov xim dub thiab liab thiab hle cov qhov kawg kom pom tooj liab
  5. Txiav Ntsuab & Dawb tag, koj yuav tsis xav tau lawv - qhov no tsuas yog rau lub zog nkaus xwb, tsis muaj cov ntaub ntawv
  6. Siv ob peb ntawm cov xov hlau uas koj txiav los ntawm koj lub zog ATX (Liab & Dub)
  7. Txuas lawv mus rau USB txuas

    • Ob peb txoj hauv kev los ua qhov no - txhawm rau kom muaj sia nyob ntev:

      • (A) Tshem tawm ob qho kawg, siv lawv ua ke thiab tom qab ntawd siv qee qhov cua sov ua rau nws tag nrho
      • (B) Twist ob txoj hlua tawm qhov ntev, tom qab ntawd cua sov poob
      • (C) Txuas ob daim kawg nrog qee qhov xaim me me
      • (D) Twist ob daim ntawv xaus ua ke thiab qhwv nrog qee daim kab xev hluav taws xob
  8. Yog tias koj tab tom siv cov khoom sib txuas, hle lwm qhov kawg thiab txhuam 1/4 " - 3/8" tus nqi nthuav tawm rau hauv qhov txuas (nco ntsoov kom phim qhov zoo thiab tsis zoo sab)
  9. Yog tias koj tab tom siv lub txuas txuas, hle cov kab xaim liab liab los ntawm ATX thiab ib qho dub thiab ib zaug ntxiv, saib qhov zoo thiab tsis zoo (liab doog rau liab thiab dub rau dub)
  10. Yog tias koj tsis siv lub txuas, tsuas yog xaim txiv ntoo rau lawv.

Thaum txuas nrog lub zog hluav taws xob thiab RPi, kos ob zaug kom paub tseeb tias koj tsis muaj lwm txoj hlua uas tau rub tawm ib puag ncig thiab ntsaws lub zog rov qab los. Thaum koj qhib lub hwj chim, koj yuav tsum muaj Raspberry Pi ua haujlwm!

Yog tias tsis yog - txheeb xyuas koj qhov kev sib txuas, qhov zoo, hauv av, thiab lwm yam.

Tsis muaj tsuav? Siv koj lub ntsuas hluav taws xob txuas txuas mus xyuas koj qaum. Yuav tsum hnov lub suab nrov nrov thaum kov ob qho kawg. Tsis tas li, txheeb xyuas kab ntawv ntshav los ntawm ATX lub zog xa khoom yog +5v.

Tseem tsis mus? Sim xaim liab rau +5v, tuaj yeem siv qhov ntawd tab sis yuav hloov pauv mus ntxiv me ntsis thiab siv cov wattage ntau dua.

Tam sim no cia so ntawm lub khoos phis tawj thiab ua haujlwm ntawm peb qhov soft skillz.

Kauj Ruam 5: SSH Nkag mus rau RPi & Nqa qee Cov Software

SSH Nkag mus rau RPi & Nqa qee Cov Software
SSH Nkag mus rau RPi & Nqa qee Cov Software

Ah, kev zoo nkauj ntawm qhib qhov chaw… zoo heev…

Cia peb pib nrog me ntsis Putty.

Muaj ntau tuj ntawm cov peev txheej zoo nyob rau ntawm qhov me me tab sis lub zog me me program. Yog tias koj tau txais SSH qhib thiab koj tus password tsis raug hloov ces koj tau teeb tsa tag nrho. Cia peb tua nws thiab rub qee pob khoom tshiab & software.

Qhib Qhov Chaw yog Qhov Zoo Tshaj Plaws

Cia peb pib nrog txhua qhov tseem ceeb:

$ sudo apt-tau hloov tshiab

$ sudo apt-tau hloov tshiab

Yog rau txhua lo lus nug.

Tam sim no cia peb tau WiringPi Library - ua rau GPIO tswj tau ntau dua.

$ sudo apt-tau nruab git-core

Yog rau txhua lo lus nug - tam sim no los tsim nws:

$ git clone git: //git.drogon.net/wiringPi

$ cd ~/wiringPi $./build

Kawg, tab sis tsis tsawg kawg - ib lub web server zoo kawg:

$ sudo apt-tau nruab apache2 php5 libapache2-mod-php5

Yog tias txhua yam mus tau zoo, koj yuav tsum tuaj yeem ntaus tus IP chaw nyob ntawm RPi thiab pom "Nws Ua Haujlwm!"

Tom qab ntawd muab koj tus kheej nkag mus:

$ sudo chown pi: pi/var/www/html/$ sudo chmod 755/var/www/html/

Nco Ntsoov Ntawm IP Chaw Nyob

Ib qho laj thawj kuv nyiam qhov IoT tsim no nws yog kuv li. iIoT yog tias koj xav tau. Tsis tas yuav txhawj xeeb txog 'huab' lossis lwm yam kev pabcuam. TAB SIS, koj yuav tsum txiav txim siab seb koj xav kom nws ua haujlwm li cas rau koj tus kheej. Qhov tseem ceeb rau ib qho kev xaiv twg yog xav tau kev ruaj khov, IP chaw nyob ruaj khov - txwv tsis pub, koj yuav tsis paub tias yuav mus qhov twg kom tig koj lub teeb rau thiab tua. Kuv tus kheej siv qhov kev xaiv (C), tab sis koj hu.

Ob peb txoj kev xaiv:

  • (A) IP chaw nyob rau RPi
  • (B). Kev tso npe hauv cheeb tsam
  • (C) Tso cai rau koj lub router teeb tsa ib qho, txhua lub sijhawm. Nyob ntawm koj lub peev xwm router - saib rau qhov chaw hu ua 'Chaw Nyob Tshwj Xeeb' feem ntau nyob hauv Advanced LAN teeb tsa.

Kauj Ruam 6: Txuas rau RPi Ntawm NotePad ++ SSH

Txuas rau RPi Via NotePad ++ SSH
Txuas rau RPi Via NotePad ++ SSH
Txuas rau RPi Via NotePad ++ SSH
Txuas rau RPi Via NotePad ++ SSH

Kuv yuav siv Notepad ++ txhawm rau kho qhov HTML, PHP, Python, Javascript & CSS cov ntaub ntawv thiab ntsaws rau hauv hu ua NppFTP kom sai thiab yooj yim tau txais cov kev hloov pauv ntawd rau koj RPi - zoo nkauj, yooj yim thiab nrawm. NppFTP los txog tam sim no hauv 32-ntsis version, tab sis yog tias koj mus 64-ntsis, tam sim no tau txhawb nqa ib yam nkaus, tab sis koj yuav tsum tau teeb tsa nws tus kheej.

  1. Qhib Notepadd ++
  2. Plugins NppFTP Qhia NppFTP Qhov rai (tseem tuaj yeem xaiv cov ntawv me me nrog cov cim txuas txuas)
  3. Hauv NppFTP qhov rai, xaiv lub cim COG thiab 'Profile Settings'
  4. Qhov no yuav tsum tsis muaj dab tsi rau koj yog tias koj tsis tau siv qhov no, xaiv 'Ntxiv Tshiab'
  5. Hostname = RPi IP Chaw Nyob ntawm koj lub network
  6. SFTP yog hom, nrog Chaw nres nkoj 22 (SSH)
  7. Lub npe siv yog 'Pi' thiab Lo lus zais yog koj tus password tshiab hloov tshiab … puas yog?!
  8. Tsis tas li, teeb tsa koj cov npe teev tseg rau '/var/www/html/' - yuav ua rau yooj yim dua
  9. Ntaus lub cim txuas thiab xaiv cov ntaub ntawv uas koj nyuam qhuav ua - yuav tsum zip koj txoj cai rau koj phau ntawv teev npe tshiab

Qhib cov ntawv yuav nqa cov ntawv hauv zos rau koj lub tshuab, txuag nws yuav cia li thauj koj cov kev hloov pauv mus rau RPi.

Qhib qhov index.php, gpio.php, css.css thiab script.js hauv Notepad ++, tom qab ntawd koj tuaj yeem xa lawv mus rau html nplaub tshev.

Muab nws sim los ntawm kev nkag mus rau tus IP chaw nyob ntawm koj RPi - koj yuav tsum pom koj li kev tswj hwm nplooj nplooj ntawv tsis raug.

Yog tias tsis yog, txheeb xyuas thiab paub tseeb tias txhua cov ntaub ntawv tau ua tiav ntawm RPi, kuj, xyuas kom tsis muaj lwm qhov 'ntsuas hauv html nplaub tshev.

Yog tias koj pom nplooj ntawv thauj khoom, ua tiav! Wb tham ntau ntxiv txog cov ntaub ntawv koj tso rau ntawm koj RPi thiab lawv yuav pab koj li cas tswj koj lub teeb pom kev zoo!

Kauj Ruam 7: Tus Txheej Txheem Txheej Txheem & Index.php

Tus Txheej Txheem Txheej Txheem & Index.php
Tus Txheej Txheem Txheej Txheem & Index.php
Tus Txheej Txheem Txheej Txheem & Index.php
Tus Txheej Txheem Txheej Txheem & Index.php

Kuv lub hom phiaj tseem ceeb yog kom muaj kev tswj hwm teeb pom kev zoo los ntawm qhov yooj yim, web-based interface uas tuaj yeem thauj khoom los ntawm ib lub cuab yeej. Qhov tshwm sim yog nplooj ntawv nrog tus lej zoo, muaj ntau chav rau koj los ua nws tus kheej thiab ntau yam lus zoo nkauj.

Raws li koj tuaj yeem pom los ntawm thawj daim duab - Javascript suav nrog hauv index.php yog siv los hu rau gpio.php thaum lub xeev ntawm peb lub npov (piv txwv li hloov) hloov pauv. gpio.php tom qab ntawv sau thiab nyeem gpio pins.

Cia peb pib nrog index.php hauv cov ntawv txuas. Kuv yuav coj nws ib ntu ib zaug, taw qhia thaj chaw thiab qee cov ntawv tshwj xeeb los pab koj.

Thawj qhov txuas yog rau CSS cov ntawv teev npe & tus cim kev cai uas yog 32X32 bitmap nrog kev txuas ntxiv ntawm '.ico'

Qhov thib ob yog Javascript me ntsis, kho qhov piv txwv ntawm w3schools tweaked kom ntxiv qee AM/PM thiab cov nyuv ntsais (tsuas yog qhov kuv xav kom nws tshwm rau kuv, tej zaum koj xav tau nws txawv?)

Ua ntej tshaj, me ntsis ntawm PHP - qhov no yuav ua haujlwm ua ntej - tsuas yog ntawm tus neeg rau zaub mov (tsis tuaj yeem pom nws hauv qhov chaw ib zaug nplooj ntawv thauj khoom) - kuj yog vim li cas tsis tuaj yeem txuas ntxiv siv nws los sau tus lej pin.

$ nm_array = array ("Koj Hloov 1", "Koj Hloov 2", thiab lwm yam..);

// qhov no yog qhov koj ntxiv thaj chaw koj yuav xav tau cais tswj lub teeb // Koj tuaj yeem ntxiv ntau yam raws li koj xav tau/xav tau - nws tau teeb tsa kom suav thiab tsim cov hloov pauv kom haum

$ wthr_array = array (); // khoob tam sim no, tab sis tuav cov ntaub ntawv taw qhia nyob ntawm tus ntawv Python

Lub voj tom ntej yuav siv PHP's 'system' thiab 'exec' ua haujlwm los teeb tsa txhua tus qauv pin siv WiringPi (txhua qhov tawm) thiab tom qab ntawv nyeem lawv. Nrog ntau qhov peev txheej tuaj yeem hloov pauv, Kuv xav kom ntseeg tau tias nplooj ntawv tshiab yuav pom qhov xwm txheej tam sim no. Ib Javascript tom qab yuav nyeem cov no thiab teeb tsa lub npov kom txheeb xyuas lossis tsis kos raws li.

Thaum kawg, yog tias koj xav kom ua tsab ntawv Python txhawm rau rub cov ntaub ntawv taw tes thiab sau $ wthr_array.

Tom ntej Tom ntej ntu div "header" - txhua ntawm ntawm cov npe khoom sawv cev cov ntsiab lus ntawm cov ntim hauv lub taub hau ntawm nplooj ntawv web (Lub Sijhawm, Npe & Temp.)

PHP voj uas yuav voj raws tus lej hloov npe koj tau ntxiv rau $ nm_array.

Dab tsi tseem ceeb ntawm no yog tias nws tseem muab tus lej PIN nyob rau hauv kev txiav txim ua ntu zus. Pib nrog PIN0 txog tus lej, tab sis txwv tiag tiag raws li tus lej GPIO pins muaj nyob ntawm koj li RPi, yog li 16. Qhov no yuav yog qhov tseem ceeb heev hauv cov kauj ruam tom ntej thaum peb pib tswj cov khoom.

Ob peb daim ntawv ceev ntawm qee qhov ntawm lwm cov ntaub ntawv:

puag.css

Koj tus kheej cov xim (web, rgb, thiab lwm yam) rau nplooj ntawv tau teeb tsa kab 68, 111 thiab 134. Kuv tau xaiv cov no vim tias lawv yog cov xim tib yam kuv tus kws tshaj lij ntawm tus poj niam xaiv rau kuv los pleev xim rau lub qab rooj tshiab, yog li nws pab txhawm rau txhawm rau cuam tshuam rau hauv qhov chaw uas lub interface feem ntau ua tiav.

Pib ntawm kab 194 yog qhov uas koj tuaj yeem kho qhov zoo thiab hnov ntawm qhov hloov pauv

gettemp.py

Qhov yooj yim super Python tsab ntawv no tau npaj rau pob zeb sai li sai tau thaum koj tau txais koj tus lej API los ntawm huab cua hauv av, ntxiv rau yuav qhia koj qee qhov txheeb cais txog kev siv koj nplooj ntawv (txhua lub sijhawm nplooj ntawv rub tawm hu - yog li koj tuaj yeem pom qee cov ntaub ntawv.)

Kauj Ruam 8: Tswj Cov Khoom Nrog 12V

Tswj Khoom Nrog 12V
Tswj Khoom Nrog 12V
Tswj Khoom Nrog 12V
Tswj Khoom Nrog 12V
Tswj Khoom Nrog 12V
Tswj Khoom Nrog 12V

Tej zaum koj tau pom tias koj lub zog siv hluav taws xob tsis ua suab ntau. Lub kiv cua tsis nyob, tsis muaj hluav taws xob rau kab daj lossis liab, thiab lwm yam.

Qhov ntawd yog vim tias peb yuav xav tau GREEN (PS_ON) txuas nrog hauv av kom tig tau lub zog tseem ceeb.

Cia peb tau txais ib qho ntawm cov ntawv tshaj tawm.

  1. Sawb & txuas GREEN xaim rau hauv ib qho ntawm qhov txuas txuas
  2. Sawb & txuas ib lub xov tooj cua BLACK rau hauv ib qho ntawm cov chaw txuas mus ib sab ntawm ntsuab

Ok, tam sim no siv ob peb ntawm koj lub xov tooj jumper - RED & BLACK ob tus poj niam & TXHUA yam xim poj niam ntawm ib sab thiab txiv neej ntawm lwm tus.

  1. Seem ib qho kawg ntawm ob lub RED & BLACK tawm ntawm ib sab poj niam thiab txuas nrog xaim txiv ntoo RED rau PURPLE (tib yam koj RPi txuas nrog) thiab BLACK rau BLACK
  2. Cov poj niam ntawm cov no yuav mus rau RED relay kom zoo, thiab BLACK rau qhov tsis zoo
  3. Cov xim uas koj xaiv yuav mus txiv neej rau GPIO (saib daim duab - peb yuav mus nrog WiringPi PIN 0)

    NCO TSEG: Kuv tab tom siv kab hlua txuas rau GPIO, tab sis koj tuaj yeem ncaj qha mus rau lub taub hau ntawm RPi

  4. Tus poj niam sab yuav mus rau "teeb liab" lossis S tus pin ntawm kev xa xov

Lub taub hau rov qab mus rau koj nplooj ntawv tseem ceeb (IP chaw nyob ntawm koj RPi) - thawj qhov hloov pauv, tej zaum tsuas yog hloov pauv, tam sim no yuav tsum siv ATX PS tawm ntawm kev tos, ncaws kiv cua thiab pib xa kua txiv mus rau txhua 12V, 5V & 3.3 V kab.

Dab tsi txias, yog tias koj tuaj yeem nres ntawm no. Tsuas yog xaim koj lub teeb pom kev zoo rau ob peb kab 12V thiab koj yuav muaj qhov yooj yim, hloov pauv digital los tswj nws.

Tab sis qhov kev lom zem nyob qhov twg? Tom ntej no, Kuv yuav tham txog teeb pom kev zoo ntxiv rau txoj hauv kev ntxiv ntau qhov hloov pauv thiab tswj hwm koj li teeb pom kev zoo.

Kauj Ruam 9: Kev Tswj Ntau Nrog Lub Hwj Chim (thiab Cov Ntaub Ntawv) Tshaj Ethernet (P (& D) oE)

Kev Tswj Ntau Nrog Lub Hwj Huam (thiab Cov Ntaub Ntawv) Tshaj Ethernet (P (& D) oE)
Kev Tswj Ntau Nrog Lub Hwj Huam (thiab Cov Ntaub Ntawv) Tshaj Ethernet (P (& D) oE)
Kev Tswj Ntau Nrog Lub Hwj Huam (thiab Cov Ntaub Ntawv) Tshaj Ethernet (P (& D) oE)
Kev Tswj Ntau Nrog Lub Hwj Huam (thiab Cov Ntaub Ntawv) Tshaj Ethernet (P (& D) oE)
Kev Tswj Ntau Nrog Lub Hwj Huam (thiab Cov Ntaub Ntawv) Tshaj Ethernet (P (& D) oE)
Kev Tswj Ntau Nrog Lub Hwj Huam (thiab Cov Ntaub Ntawv) Tshaj Ethernet (P (& D) oE)

Tej zaum koj yuav tau xav tsis thoob tias txhua yam ntawm ethernet cable yog dab tsi uas kuv tau ntxiv rau hauv cov npe khoom.

Siv tus ethernet, peb tuaj yeem xa 5V nrog rau GPIO teeb liab txoj cai nrog rau lwm qhov kev sib txuas txuas ntxiv txhawm rau ntxiv kev tswj hwm peb cov teeb pom kev zoo. Tej zaum koj xav cais kev tswj hwm qee thaj tsam ntawm lub tiaj? Puas yog cov hauv ntej thiab nraub qaum? Qhov no yuav pab kom qhov ntawd.

Kuv yuav tawm tswv yim thiab qee qhov kev coj ua zoo tshaj plaws thiab koj tuaj yeem kho nws kom haum rau koj cov kev xav tau.

Ua tibzoo saib daim duab thawj thiab thib ob. Siv kab +5V los ntawm peb cov khoom siv hluav taws xob, Kuv xa qhov ntawd los teeb tsa cov kab sib txuas sib txuas ntawm Ethernet cable.

  1. Ua tib zoo hle cov txheej sab nrauv los ntawm ethernet cable - koj tsis xav kom puas 24-23 AWG xov hlau
  2. Xaiv ob lub teeb xim thiab ua tib zoo ntsuas lawv - ib qho yuav yog qhov hluav taws xob thiab lwm qhov hauv av

    NCO TSEG: Lub tswv yim zoo heev rau teev cov xim twg yog dab tsi rau thaum koj xaim mus rau lwm sab

  3. Seem qhov xaus ntawm ob lub xov hlau thiab xaim mus rau RED (+5v) thiab BLACK av ntawm koj lub zog siv (duab 2)
  4. Ua tib yam rau lwm cov xim hlau, tab sis xaim xaim jumper los ntawm GPIO Pin hloov

Molex cov khoom sib txuas kuv txuas rau hauv cov khoom siv tau los yooj yim ntawm no. Nqa 3 pawg sib tw sib tw, crimp lawv rau hauv tus poj niam Molex txuas nrog nrog 3 qhov txuas txuas thiab lawv yuav txuas txoj cai rau kev xa tawm. (daim duab 3). Nco ntsoov koj saib qhov kev xaj khoom, kuv xa rov qab xav tau lawv nyob hauv +, - & S. Yog tias koj ua Molex cable tsis nyob hauv qhov kev txiav txim, nws yuav nyuaj rau rov kho lawv dua.

Yog tias koj "pigtail" txoj kab hluav taws xob ethernet rau koj qhov kev xa rov qab ces koj tuaj yeem khiav kab no txhua qhov chaw koj xav tau thiab coj mus rhaub rau nws ntawm ntau qhov chaw.

Kuv tau sim qhov no nrog ntau dua 100ft ntawm ethernet nrog qhov txwv qhov poob qis thiab qhov zoo GPIO teeb liab tias, vim yog cov khub sib tw, yog qhov ruaj khov thiab tiv thaiv los ntawm kev cuam tshuam.

Kauj Ruam 10: Teeb Pom Qhov Yard

Teeb Pom Yard!
Teeb Pom Yard!
Teeb Teeb Yard!
Teeb Teeb Yard!
Teeb Teeb Yard!
Teeb Teeb Yard!

Muaj ntau txoj hauv kev koj tuaj yeem ua qhov no. Kuv yuav npog qee cov ntsiab lus dav dav thiab cov kauj ruam kom ntseeg tau tias koj lub kaw lus ua haujlwm tau zoo thiab nyab xeeb.

Nco ntsoov tias koj yuav faus cable rau qhov no. Cov kab ntawv kuv txuas rau yog qhov kuv siv thiab tau ntsuas rau kev faus hauv av uas txhais tau tias yuav tsum tau ceev faj ntxiv kom tsis txhob txiav mus rau hauv kab kab, kab hauv internet LOSSIS YUAV TSUM MUAJ TSEEB, kab hluav taws xob … thov hu rau hauv zos "hu ua ntej koj khawb" yog tias koj tsis paub meej. Tsis tas li, taug qab qhov zoo thiab qhov tsis zoo. Kuv ib txwm paub cov kab ntawv nrog "cov lus" (ntawv dawb) yog qhov tsis zoo thiab dawb paug yog kab zoo)

Txij li thaum kuv tau ntxiv rau ntawm lub sam thiaj tom qab, Kuv tau npaj ua ntej me ntsis thiab muab cov thawv sib txuas nyob ib puag ncig ntawm kuv ib puag ncig tshiab, uas ua rau qhov no yooj yim dua. Koj tuaj yeem yooj yim raws txoj kab yooj yim hauv qab koj lub lawj, paving pob zeb, thiab lwm yam.

Ua ntej tshaj, Kuv tau khiav kab 12V hla lub thawv sib txuas (daim duab 2).

Cov xaim ntawd tau poob mus rau hauv av, hla 1/2 "PVC txoj kab nrog lub kaum sab xis hauv qab, nqis mus rau hauv av txog 6-8". Trench uas tawv nrog peb cov av rocky (yuav tsum tau siv lub pickaxe) tab sis tej zaum koj nyob qhov chaw uas muaj av tiag …

Cov kab tuaj txog (daim duab 4), dua nrog lub kaum sab xis thiab 1/2 PVC thiab txuas rau tsob ntoo. Kuv tau xaus qhov sau rau sab saum toj ntawm PVC nrog cov silicon me ntsis kom cov hlau tsis txhob raug rub sau los ntawm kiddos

Rau qee qhov kev teeb tsa, koj tuaj yeem nres ntawm no thiab muaj koj lub teeb taw tes nce mus rau tsob ntoo. Kuaj nws tawm hmo ntuj kom pom qhov koj xav tau. Yog tias koj xav kom teeb pom kev nqis los … txuas ntxiv mus.

Kuv siv cov hlau xaim, ua tib zoo saib xyuas kom tsis txhob xaim hlau txhawm rau coj nws mus tom qab tsob ntoo (daim duab 5)

Thaum koj muaj kab, koj yuav tsum tau ntswj qhov txuas rau ntawm tsob ntoo. Thaum muaj kev nyab xeeb, siv cov hlau txuas los txuas qhov zoo rau liab thiab tsis zoo rau xiav lossis dub ntawm lub teeb pom kev zoo. Qhwv cov kev sib txuas me ntsis ntawm kab xev hluav taws xob kom pab tsis txhob ntub dej.

Yaug thiab rov ua rau ntau lub teeb uas koj xav khiav!

Kuaj nws los ntawm kev tua lub xov tooj, iPad lossis khoos phis tawj thiab mus rau koj li RPi IP chaw nyob.

Qhov kawg uas yuav tsum tau tshwm sim yog ua kom ntseeg tau tias koj RPi thiab kev sib txuas tau zoo thiab zoo nyob hauv lub thawv sib txuas lossis lwm hom kev npaj - dua, dhau qhov uas tau hais tseg ntawm no.

Kauj Ruam 11: Kev Txhim Kho Hauv Kev Txhim Kho & Kev Txhim Kho

Yog li dab tsi ntxiv thiab yuav txhim kho li cas? Nrhiav rau lub zej zog no los pab, tab sis kuj muaj ob peb lub tswv yim uas kuv tau siv txij li muab qhov no ua ke lossis kuv tab tom ua haujlwm ntawm lwm cov haujlwm ib puag ncig lub tsev.

Hloov Kho Huab Cua

Pib siv Accuweather API hloov chaw WeatherUnderground (tsis txuas ntxiv API kev pabcuam) - 'gettemp.py' ntxiv los qhia yuav ua li cas!

Ntxiv Lub Cev Lub Cev

Kuv tau khaws 4 lub khawm khawm zoo ib yam li kuv pom nyob ib puag ncig peb chav sib tham hauv chav haujlwm thiab txij li ntawd, txuas nws mus txog 4 GPIOs uas tau saib xyuas los ntawm cov ntawv nab nab thaum chav nyob. Tam sim no tseem tuaj yeem siv cov no ua lwm txoj hauv kev rau tig nws ib leeg thiab tawm thiab txoj kev uas kuv tau tsim cov nplooj ntawv tseem ceeb, nws yuav tshuaj xyuas seb lub xeev tam sim no ntawm tus lej GPIO yog thawj zaug yog li koj tsis muaj teeb meem tawm tswv yim. Cov neeg ntawm touchplate.com tau pab tau zoo tshaj los teb kuv cov lus nug kom nws ua haujlwm - ua tsaug!

Cov ntaub ntawv sib txawv los ntawm Huab Cua Hauv Qab

Kuv tau pib rub qis cov ntaub ntawv astrological los ntawm WU (hnub tuaj, hnub poob, thiab lwm yam). Kuv tabtom ua haujlwm kom lub teeb tuaj thiab tawm 30 feeb ua ntej hnub poob thiab tawm ntawm qee lub sijhawm ib yam nkaus. Yuav siv qee qhov kev ntsuas sib piv rau qhov no, tab sis tsis yog RPi qhov siv tau zoo tshaj plaws, yog li ua si nrog software daws teeb meem.

Ntxiv Auto-On/OFF

Kuv lub sam thiaj sab nraub qaum yog pob zeb 10 mev uas peb nchuav tau li 2 xyoos dhau los. Xyoo dhau los no peb muaj huab cua tsis zoo-ib hnub nws yuav yog 35-40F sab nraum, tom ntej no, 70-80F nrog 60-80% cov av noo. Qhov no ua rau hws rau ntawm slab, ua rau nws nplua heev. Txhawm rau tawm tsam qhov teeb meem no, Kuv tau ntxiv cov ntawv nab nab los rub tawm hnub ua ntej lub hnub (txhawm rau txiav txim siab kwv yees li qhov ntsuas kub rau qhov slab) thiab dewpoint los txiav txim siab yog tias cov xwm txheej raug cai los tsim cov dej ntws tawm ntawm lub sam thiaj (https:// www. weatherquestions.com/What_is_condensati… Yog tias lub sijhawm qis dua li dewpoint - tom qab ntawd cov kiv cua tuaj, yog tias tsis yog, lawv nyob twj ywm. yog tias 'AI' tau tig rau cov kiv cua. Kuv tau ntxiv 4 cov ntaub ntawv: dryout.py, auto_on.py & auto_off.py (qhov chaw hauv cov nab hab sej nplaub tshev) thiab hloov kho tshiab index.php (qhov chaw hauv cov ntawv tais ceev tseg) - koj ' yuav tsum tau hloov kho koj li huab cua hauv qab API tus yuam sij.

Hauv lub davhlau ya nyob twg:

$ sudo crontab -e

Tom qab ntawd ntxiv cov hauv qab no mus rau hauv qab:

#txhua txhua teev, txheeb xyuas qhov ntsuas kub/dewpoint kom pom tias yuav tsum tau qhib kiv cua

0 * * * */usr/bin/python /var/www/html/python/dryout.py

Tam sim no txhua teev, dryout.py yuav khiav. LOS YOG koj tuaj yeem siv qhov no los ua tus qauv rau lwm txoj haujlwm, tej zaum tig lub teeb rau thiab tawm siv lwm qhov txhais? Hnub poob/hnub tuaj? LOS YOG yog nws tsuas yog kub sab nraud thiab koj xav kom cov kiv cua tuaj yeem tuaj yeem yog lub sijhawm. mus txog qib XX?

Ntxiv Motion Sensors

Tso ob peb lub suab txav ze ntawm qhov nkag, siv tus qauv ethernet txhawm rau txhawm rau lub zog thiab cov ntaub ntawv I/O yuav yog qhov yooj yim. Tom qab ntawd tsab ntawv nab nab yooj yim los saib xyuas thiab teeb lub teeb rau thiab tawm. Yuav yog qhov lom zem me ntsis ntxiv rau qhov haujlwm.

Vam tias qhov tsawg kawg no muab rau koj thiab lub tswv yim tias qhov no muaj txiaj ntsig thiab feem ntau, koj tuaj yeem rov ua qhov uas kuv tau siv tam sim no ua tiav ntau dua ib hlis. Cov lus teb zoo los ntawm cov phooj ywg thiab tsev neeg thiab paub koj yuav zoo ib yam yog tias koj tau tawm mus thiab tau ua! Ua tsaug rau taug kev nrog kuv thiab thov qhia rau kuv paub ntawm cov lus tawm tswv yim, tweaks lossis cov lus nug koj yuav muaj! - tus neeg tu tsev

Pom zoo: