Cov txheej txheem:

DIY Suab Nkauj Xmas Teeb rau Cov Pib Nrog Raspberry Pi: 12 Cov Kauj Ruam (nrog Duab)
DIY Suab Nkauj Xmas Teeb rau Cov Pib Nrog Raspberry Pi: 12 Cov Kauj Ruam (nrog Duab)

Video: DIY Suab Nkauj Xmas Teeb rau Cov Pib Nrog Raspberry Pi: 12 Cov Kauj Ruam (nrog Duab)

Video: DIY Suab Nkauj Xmas Teeb rau Cov Pib Nrog Raspberry Pi: 12 Cov Kauj Ruam (nrog Duab)
Video: Musicians talk about Buckethead 2024, Kaum ib hlis
Anonim
Image
Image

Hnub no, Kuv yuav hla cov kauj ruam los siv raspberry pi kom ua rau koj lub teeb Christmas ci nrog suab paj nruag. Nrog tsuas yog qee qhov nyiaj ntawm cov khoom siv ntxiv, Kuv taug kev koj los ntawm kev hloov koj lub teeb Christmas tsis tu ncua mus rau hauv lub teeb pom kev zoo hauv tsev. Lub hom phiaj ntawm no yog mus ntawm kos. Txawm hais tias phau ntawv qhia no yog npaj rau cov neeg uas tsis paub siv linux txhua qhov thiab cov uas ua zoo ib yam, kev tsom mus rau cov tib neeg uas linux thiab raspberry pi yog qhov ua tsis tiav. Muaj ntau yam ntxiv uas tuaj yeem ua tiav nrog lub teeb pom kev zoo software thiab khoos phis tawj ntau dua, tab sis qhov no tsuas yog hais txog kev pib xwb.

Kauj Ruam 1: Khoom

Teeb tsa Pi 1: Txhim Kho Raspbian
Teeb tsa Pi 1: Txhim Kho Raspbian

Thawj qhov yuav tsum muaj:

  • Koj yuav xav tau koj lub teeb Christmas. Kuv pom zoo kom ua raws DC cov teeb ci. Yog tias koj tsis muaj ib qho, tsis txhob ua si nrog lub zog hluav taws xob, tau txais qee cov hlua LED, lossis DC siv cov hlua Christmas ua lub teeb ci.
  • Raspberry pib; kev teeb tsa sib txawv xav tau kho vajtse sib txawv

    • Yog tias koj tau txais pi xoom lossis pi x w, koj yuav xav tau ** Cov khoom siv zoo yuav muaj tag nrho cov no **

      • ib qho HDMI audio extractor
      • ib lub mini HDMI cable
      • header pins, lossis tsuas yog txuas ncaj qha rau hauv lub rooj tsavxwm
      • USB OTG adapter
      • Ib qho hlau txuas
    • Yog tias koj tau txais pi A, A+, B lossis B2, lossis xoom (tsis yog w), koj yuav xav tau wifi dongle
    • Yog tias koj tau txais cov khoom siv pi 3, tsis muaj dab tsi ntxiv
  • Ib tus neeg hais lus nrog pab hauv thiab pabcuam cable. Bluetooth suab yeej yeej ntawm pi xoom w thiab pi 3 hmoov tsis zoo.
  • daim npav nco (yam tsawg kawg 4gb), feem ntau suav nrog hauv cov khoom siv
  • Ib qho 8 channel relay board (5v)
  • Poj niam rau poj niam header pins

Kev xav tau ib ntus: qhov no yog ib ntus yog li kuv xav qhia tsuas yog siv yam koj tau muaj rau ob peb teev nws yuav xav tau

  • USB nas thiab keyboard
  • Nkag mus rau HDMI saib lossis TV
  • Lub USB hub yog tias hloov pauv ntawm nas thiab keyboard ua rau muaj kev ntxhov siab thiab koj lwm USB chaw nres nkoj tau nyob

Yeem yeem

  • Lub hwj chim loj uas koj yuav siv rau tag nrho koj cov teeb

    Yog tias koj mus rau txoj kev no, koj kuj yuav tsum tau ua txoj hlua hluav taws xob, lossis txiav ib txoj hlua txuas ntxiv thiab siv nws ua koj lub hwj huam qaum

  • nrog rau koj tus pi nrog tus hloov pauv phaw
  • thiab tej zaum txawm tias lub teeb hluav taws xob siab dua yog tias xav tau nrog cov hloov hluav taws xob

Kauj Ruam 2: Teeb Tus Pi 1: Txhim Kho Raspbian

Teeb tsa Pi 1: Txhim Kho Raspbian
Teeb tsa Pi 1: Txhim Kho Raspbian

Thawj kauj ruam yog kom tau raspbian ntawm koj lub cuab yeej. Kuv yuav npog tag nrho cov no hauv ib qho thaiv, thiab npog cov cuab yeej sib cais.

Kuv pom zoo rub tawm noob los ntawm pi foundation

Tsuas yog unzip, thiab theej rau koj daim ntawv tshiab micro SD daim npav. Qhov ntawd yog nws. Thaum koj qhib koj tus pi, nws yuav coj koj los ntawm kev teeb tsa.

Kauj Ruam 3: Teeb Tus Pi 2: Teeb SSH thiab VNC

Teeb tsa Pi 2: Teeb SSH thiab VNC
Teeb tsa Pi 2: Teeb SSH thiab VNC
Teeb tsa Pi 2: Teeb SSH thiab VNC
Teeb tsa Pi 2: Teeb SSH thiab VNC

Muaj SSH thiab VNC teeb tsa txhais tau tias koj yuav tsis xav kom tus pi ntsaws rau hauv qhov tsis zoo ntawm cov xov hlau. Txhua yam yuav ua tau los ntawm 2 lub qhov rais ntawm koj lub laptop lossis txawm tias los ntawm koj lub xov tooj. Peb yuav nquag ua ntej peb cov lus txib nrog "sudo", qhov no yeej tseem ceeb muab peb cov lus txib rau tus tswj hwm txoj cai.

  1. Ua ntej hloov koj tus password. Qhib lub davhlau ya nyob twg qhov rai thiab ntaus cov hauv qab no thiab koj yuav raug hais kom nkag mus rau tus password tsis raug (raspberry) thiab tom qab ntawd muab koj tus kheej lo lus zais.

    sudo passwd lus

  2. tam sim no theej koj tus IP chaw nyob nrog cov lus txib hauv qab no

    ifconfig

Tam sim no mus rau cov ntawv qhia zaub mov, thiab qhib rau SSH thiab VNC. Tam sim no koj tuaj yeem rov pib lub pi thiab tshem nws los ntawm tus saib, keyboard, thiab nas.

Kauj Ruam 4: Teeb Tus Pi 3: Siv Bitvise SSH txhawm rau Nkag Mus Rau Koj Tus Pi

Teeb Tus Pi 3: Siv Bitvise SSH txhawm rau Nkag Mus Rau Koj Tus Pi
Teeb Tus Pi 3: Siv Bitvise SSH txhawm rau Nkag Mus Rau Koj Tus Pi

Kuv pom zoo bitvise vim tias nws muaj kev koom ua ke SFTP, nrog rau kev sib cuam tshuam zoo. Nkag mus rau koj tus IP chaw nyob uas koj tau theej ua ntej, siv lub npe siv pi, thiab koj tus password tshiab. Khaws qhov chaw nres nkoj pib (22). Lub davhlau ya nyob twg yuav tsum qhib thaum koj xaiv tus ID nkag mus.

Kauj Ruam 5: Teeb Tus Pi 4: Hloov Kho Koj Tus Pi

Ua ntej koj ua lwm yam, khiav qhov hloov tshiab

  1. Ua ntej, koj hloov kho lub tsev qiv ntawv ntawm cov pob khoom twg muaj nrog

    sudo apt-tau hloov tshiab

  2. Thaum nws ua tiav, koj yeej nruab qhov hloov tshiab nrog

    sudo apt-tau hloov tshiab

  3. Rau qhov ntsuas tau zoo, xyuas kom tseeb tias koj li firmware tau hloov kho tshiab (qhov no yuav tsum tau ua tiav los ntawm kev hloov kho tshiab)

    sudo rpi-hloov tshiab

Kauj Ruam 6: Teeb Tus Pi 5: Txhim Kho Lightshowpi

Teeb tsa Pi 5: Txhim Kho Lightshowpi
Teeb tsa Pi 5: Txhim Kho Lightshowpi

Ib feem ntawm cov kauj ruam no muaj ncaj qha rau ntawm lub vev xaib lightshowpi. Kuv yuav suav nrog lawv kom yooj yim. Kuv yuav ntxiv qee qhov kev piav qhia nyob rau ntawd.

  • sudo apt-tau nruab git-core

    apt-tau yog dab tsi tau txais cov pob khoom, thiab ntawm no peb yuav nruab git-core, kev vam khom (cov haujlwm git-core xav tau los ua haujlwm) yuav cia li ntxiv

  • cd ~ ib

    cd yog hloov cov npe, thaum ~ txhais tau tias/tsev/*username*/, qhov no nws yuav yog/tsev/pi/; siv qhov ntawd lossis ~ yuav tsum ua haujlwm ib yam nkaus

  • git clone

    Qhov ntawd tsuas yog theej theej cov ntawv tais ceev tseg uas peb xav tau

  • cd lightshowpi

    tam sim no peb txav mus rau daim nplaub tshev peb nyuam qhuav rub tawm

  • git fetch && git checkout ruaj khov

    tam sim no peb tau txais cov ntaub ntawv xav tau

  • cd/tsev/pi/lightshowpi

    peb txav mus rau daim nplaub tshev raug; hauv linux, tshwj tsis yog tias peb tsim cov kab ke sib txuas, peb ib txwm yuav tsum tau txav mus rau qhov raug nplaub tshev ua ntej tso cov ntawv sau

  • sudo./install.sh

    qhov no ua qhov kev teeb tsa tiag tiag; qhov no siv sijhawm li 3 teev ntawm kuv tus lej xoom w

  • sudo rov pib dua

    tam sim no peb reboot

Kauj Ruam 7: Txuas koj Cov Khoom

Txuas Koj Cov Khoom
Txuas Koj Cov Khoom

Txawm li cas los xij koj kawg ua kom muaj zog rau koj cov cuab yeej nyob ntawm seb koj tab tom siv dab tsi. Muaj ntau txoj hauv kev xaiv ntawm no, tab sis qhov kawg ntawm hnub ntawd, koj yuav xav tau 5v rau koj tus pi, txawm tias dhau los ntawm USB, lossis siv tus pin header thiab kev cai daws teeb meem zoo li kuv tau ua. Txhua lub zog koj tab tom cuam tshuam yuav tsum yog DC. AC kab hluav taws xob yuav ua haujlwm zoo xwb, tab sis nws ua rau muaj kev pheej hmoo ntxiv. Tsawg hluav taws xob nyob nyab xeeb dua.

Kauj Ruam 8: Txuas Koj Cov Khoom 2: Soldering Pins

Txuas Koj Cov Khoom 2: Soldering Pins
Txuas Koj Cov Khoom 2: Soldering Pins

Yog tias koj siv tus lej xoom, koj yuav tsum tau xaum lub taub hau taub hau, lossis txuas cov xov hlau ncaj qha ntawm tus pin qhov lawv tus kheej.

Kauj Ruam 9: Txuas Koj Cov Khoom 3: Txuas Tus Pi mus rau Pawg Neeg Tawm Tswv Yim

Txuas Koj Cov Khoom 3: Txuas Tus Pi mus rau Pawg Thawj Coj
Txuas Koj Cov Khoom 3: Txuas Tus Pi mus rau Pawg Thawj Coj
Txuas Koj Cov Khoom 3: Txuas Tus Pi mus rau Pawg Neeg Tawm Tswv Yim
Txuas Koj Cov Khoom 3: Txuas Tus Pi mus rau Pawg Neeg Tawm Tswv Yim

Peb siv wiringpi tus lej tus lej. Muaj lwm txoj hauv kev rau npe lub rooj sib tham nyob ntawd, tsuas yog siv daim ntawv uas kuv tau muab, lossis mus rau wiringpi.com

Los ntawm pawg thawj coj saib xyuas, nrog tus pin rau koj, ntawm sab laug mus rau sab xis, koj yuav txuas rau cov hauv qab no ntawm pi

  1. pin 20: Ground
  2. pin 11: GPIO 0
  3. pin 12: GPIO 1
  4. pin 13: GPIO 2
  5. pin 15: GPIO 3
  6. pin 16: GPIO 4
  7. pin 18: GPIO 5
  8. pin 22: GPIO 6
  9. pin 7: GPIO 7
  10. pin 4: 5 v

Yog tias koj tab tom txhawb koj tus pi los ntawm tus pin header, tom qab ntawd +5v yuav mus rau tus pin 2, thiab - (hauv av) yuav mus rau tus lej 6.

Kauj Ruam 10: Txuas Koj Cov Khoom 4: Txuas Koj Cov Txuas

Txuas Koj Cov Khoom 4: Txuas Koj Cov Txuas Txuas
Txuas Koj Cov Khoom 4: Txuas Koj Cov Txuas Txuas
Txuas Koj Cov Khoom 4: Txuas Koj Cov Txuas Txuas
Txuas Koj Cov Khoom 4: Txuas Koj Cov Txuas Txuas

Cov relays ua haujlwm zoo li hloov. Txawm li cas los xij koj yuav xaim koj lub teeb ncaj qha rau koj lub zog, ua li ntawd, tab sis tom qab ntawd txiav cov xov hlau nyob thiab tso txhua qhov kawg ntawm cov xaim txiav ntawm ib qho ntawm kev xa tawm. Txhua qhov kev tshaj tawm muaj 3 lub davhlau ya nyob twg. 2 ntawm lawv nyob ua ke, thiab ua kom lub zog sib txuas sib cais lawv, lwm qhov txuas nrog rau lub davhlau ya nyob twg nruab nrab thaum lub zog xa tawm. Daim duab me me ntawm lub ces kaum zoo qhia koj tias ib qho twg yog cais (hauv liab). Qhov kev tawm tsam xaus (thawj thiab zaum kawg) ntawm txhua qhov kev sib txuas yuav tsis txuas nrog. Yog tias koj xav tau, koj tuaj yeem ua ib txwm-siv thiab siv 2 hauv qhov ntsuab, nws tsuas yog txhais tau hais tias lub teeb pom kev zoo yuav rov qab. Tej zaum nws yuav muaj txiaj ntsig yog tias koj xav kom lub teeb teeb rau tom qab lub suab paj nruag xaus.

Kauj Ruam 11: Xeem Nws

Kuaj Nws
Kuaj Nws

Kuv siv cov LED me me no los ntsuas kuv lub rooj tsavxwm, tab sis tiag tiag koj tuaj yeem tsuas yog saib lub teeb liab uas nyob ntawm pawg thawj coj saib xyuas. Txhua qhov kev tshaj tawm twb muaj nws tus kheej LED.

  • Tsis txhob hnov qab mus rau lub nplaub tshev lightshowpi ua ntej

    cd/tsev/pi/lightshowpi/

  • Tom qab ntawd siv ib qho ntawm cov lus txib ntsuas no

    • sudo python py/hardware_controller.py -xeev = flash
    • sudo python py/hardware_controller.py -xeev = ploj mus

Txhawm rau xaus qhov ntsuas, siv CTRL+C

Kauj ruam 12: Txaus siab rau

Txaus siab rau!
Txaus siab rau!

Tam sim no nws yog lub sijhawm los teeb koj lub teeb Christmas tiag tiag, thiab txaus siab rau qhov ua yeeb yam. Tsis txhob hnov qab mus saib kuv cov vis dis aus tag nrho!

Txhawm rau khiav koj thawj zaj nkauj, siv cov ntaub ntawv demo muab los ntawm lub teeb pom kev zoo devs

sudo python py/synchronized_lights.py --file =/home/pi/lightshowpi/music/sample/ovenrake_deck-the-halls.mp3

Txhawm rau ua lwm tus tub, tsuas yog hloov lub npe ntawm mp3 ntawm qhov kawg ntawm cov lus txib ntawd. Nov yog qhov uas sftp feature ntawm bitvise tuaj; koj tuaj yeem yooj yim nyem thiab rub koj cov ntaub ntawv.

Pom zoo: