Cov txheej txheem:

NHL Txaj Hockey Lub Teeb thiab LCD: 4 Kauj Ruam (nrog Duab)
NHL Txaj Hockey Lub Teeb thiab LCD: 4 Kauj Ruam (nrog Duab)

Video: NHL Txaj Hockey Lub Teeb thiab LCD: 4 Kauj Ruam (nrog Duab)

Video: NHL Txaj Hockey Lub Teeb thiab LCD: 4 Kauj Ruam (nrog Duab)
Video: This handshake brawl is going completely viral 2024, Hlis ntuj nqeg
Anonim
Image
Image
NHL Txaj Hockey Lub Teeb thiab LCD
NHL Txaj Hockey Lub Teeb thiab LCD

Taw qhia

"NHL Light" yog rau cov kiv cua hockey uas xav ua raws lawv pab neeg, tab sis tsis tuaj yeem saib txhua qhov kev ua si. Nws yog qhov zoo tshaj plaws yog tias nws ua piv txwv lub hom phiaj nrog lub hockey hockey (kev cai rau koj pab neeg), thiab lub teeb.

Ntxiv rau lub suab hockey thiab lub teeb, "NHL Light", muaj cov duab uas muab tam sim no, lossis qhov kev ua si tsis ntev los no cov qhab nia, sijhawm ua si lossis sijhawm ntawm kev ua si tom ntej, thiab hnub tim thiab sijhawm tam sim no.

"NHL Lub Teeb" sau rau ntawm cov npe yooj yim ntawm cov khoom, uas yooj yim rau sib dhos cov khoom siv hluav taws xob, thiab cov cai uas muaj pub dawb.

Nta

  1. Lub vev xaib raws kev teeb tsa rau xaiv koj pab neeg thiab wifi
  2. Ua lub teeb thiab suab nrov thaum koj pab pawg sib tw (txawm tias thaum koj yog pab neeg nyob deb)
  3. Plays suab tshaj tawm pib ntawm qhov kev ua si
  4. Plays lub suab tshaj tawm qhov xaus ntawm qhov kev ua si
  5. Muab sijhawm thiab hnub tim ntawm kev ua si tom ntej, yog tias tsis muaj kev ua si game.
  6. Qhia tawm lub sijhawm tam sim no thiab sijhawm, yog tias kev ua si tseem tab tom ua.
  7. Qhia hnub tim thiab sijhawm tam sim no.

Kauj Ruam 1: Kauj Ruam 1: Sib Sau Koj Qhov

Kauj Ruam 1: Sib Sau Koj Qhov
Kauj Ruam 1: Sib Sau Koj Qhov

Nov yog cov npe ntu.

  1. Raspberry Pi W*

    1. Amazon
    2. Kuv nyiam kom tau txais kuv los ntawm Microcenter, tab sis tuaj yeem pom hauv online tsawg dua ntawm lwm qhov chaw.
    3. $10
  2. SD Card (4gb yam tsawg kawg nkaus)*
  3. hais lus - Amazon - ~ $ 2 *
  4. amp - PAM8403* - Amazon - ~ $ 1 txhua
  5. teeb - Amazon - ~ $ 5
  6. Rooj plaub - $ 1*

    1. Michael tus
    2. Kuv pom zoo cov ntaub ntawv ntoo me me los ntawm Michael lub khw khoom siv tes ua, tab sis yuav tawm mus rau koj!
  7. I2C 2004 LCD - $ 3-7

    1. Amazon
    2. Txoj cai txhawb nqa 3 hom LCD's, tab sis I2C 2004 yog qhov kuv tau txiav txim siab raws li tus nqi zoo tshaj plaws thiab qhov loj me. (SSD1306 kuj tseem tuaj yeem ua tau)
  8. 2 transistors - 2N2222A- Amazon
  9. Lwm Cov Hluav Taws Xob / solder12V
  10. fais fab mov - Amazon
  11. 12V -> 5V tus nqi hloov pauv - Amazon

*Muaj qhov hloov pauv thaum nws los txog rau xaiv qhov no.

NCO TSEG: Koj tuaj yeem pib ua rau feem ntau ntawm txoj haujlwm no nrog koj li Raspberry Pi xwb, thaum koj tos lwm yam khoom xa tuaj.

Kauj Ruam 2: Kauj Ruam 2: Txuas thiab Hluav Taws Xob

Kauj Ruam 2: Txuas thiab Hluav Taws Xob
Kauj Ruam 2: Txuas thiab Hluav Taws Xob
Kauj Ruam 2: Txuas thiab Hluav Taws Xob
Kauj Ruam 2: Txuas thiab Hluav Taws Xob
  1. Sib Sau Teeb

    1. Kev txuas rau lub teeb yog kom khiav 12 + mus rau qhov pom kev.
    2. Khiav tsis zoo los ntawm lub teeb los ntawm ib qho ntawm cov transistors.
    3. Lub emmetter ntawm transistor mus rau hauv av.
    4. Tus neeg sau ntawm transistor mus rau Raspberry Pi.
  2. Sib dhos suab

    1. Khiav txoj cai lossis sab laug suab los ntawm PI mus rau lub amp
    2. Khiav +5V rau lub amp
    3. Khiav amp av mus rau qhov thib ob transistor.
    4. Khiav lub emmetter ntawm 2nd transisitor rau hauv av
    5. Khiav tus sau ntawm transistor mus rau Raspberry Pi
  3. Sib dhos cov hlua rau PI
  4. Nov yog cov lus qhia pinout rau PI (qee qhov no tau teeb tsa los ntawm JSON)

    1. LCD

      1. 3 - SDA
      2. 5 - TSO
      3. 5 - VCC (+5)
    2. AMP 8 (GPIO 14)
    3. Teeb 10 (GPIO15)
    4. Suab Zoo - GPIO 18

Kauj Ruam 3: Kauj Ruam 3: Txheej Txheem Txheej Txheem Txheej Txheem Software

  1. Npaj Raspberry Pi W.

    1. Rasberry pi yuav tsum tau khiav qhov tsis ntev los no ntawm Raspbian (lossis lwm yam Debian).
    2. Pom zoo kom ua raws cov lus qhia no:
    3. Nco ntsoov suav nrog wifi wpa_supplicant file.
    4. Muab cov ntaub ntawv ssh tso rau hauv sdcard kom tso cai ssh nkag mus.
  2. Npaj cov software thib peb:

    1. Kuv tau siv cov txheej txheem no kom rub tag nrho cov cuab yeej xav tau thib peb, tab sis xav tias dawb los ua cov haujlwm no, thiab tshuaj xyuas kom paub tseeb tias tsis muaj cov kauj ruam ua tsis tiav.
    2. Rub tawm thiab khiav cov ntawv hauv qab no:

Nov yog kev rhuav tshem dab tsi ntawm cov ntawv teeb tsa rau teeb tsa lub operating system ua. Nws yog qhov zoo tshaj los khiav cov kab no ntawm tus kheej, yog li koj tuaj yeem saib rau qhov ua yuam kev.

Tsab ntawv Header:

#!/bin/sh -e #tuaj yeem hu los ntawm #curl -sL https://raw.githubusercontent.com/wga22/nodejs/ma… | sudo -E bash - # TODO: automate tsab ntawv no nrog qee yam xws li: curl -sL https://raw.githubusercontent.com/wga22/nodejs/ma… | sudo -E bash - # TODO: teeb tsa wifi # TODO: teeb tsa passwd thiab tso cai yuam sij # sau tseg:

Hloov kho software ntawm qib OS:

#apt-tau txais cov khoom (apt-tau hloov tshiab && apt-tau -y hloov kho)> /dev /null apt-tau txais deb-upgrade -y #General Dev apt-tau nruab -y git tsim-qhov tseem ceeb nab npawb-dev nab nab-pip nab hab sej-smbus libasound2-dev nodejs # GPIO apt-tau nruab -y raspi-gpio nab nab-duab python-smbus libasound2-dev #networking apt-tau nruab -y choj-utils hostapd dnsmasq apt-tau huv -y

Kev teeb tsa Networking. Ib feem ntawm lub hom phiaj ntawm no yog kom tso cai rau teeb tsa ntawm qhov chaw nkag, txuas rau koj tus kheej wifi, tab sis qhov no tseem tsis tau sim tag nrho tam sim no. Tam sim no pom zoo kom siv wpa_supplicant txoj hauv kev teeb tsa wifi.

#networking setupecho nhllight>/etc/hostname #TODO: txhim kho/etc/hosts #TODO: teeb tsa br0 mkdir/etc/hostapd/ #ceeb toom: lwm qhov teeb tsa tau ua tiav ntawm cov ntaub ntawv teeb tsa thiab plhaub rub tawm raws li ib feem ntawm qhov hloov tshiab

Hloov kho Node thiab node cov tsev qiv ntawv

#update nodecd/tmp export nodeversion = 8.9.0 #wget https://nodejs.org/dist/v7.4.0/node-v7.4.0-linux-… #wget https://nodejs.org/dist/v7. 4.0/node-v7.4.0-linux-… wget https://nodejs.org/dist/v7.4.0/node-v7.4.0-linux-… tar -xvf node-v $ {nodeversion} -linux-armv6l. tar.xz cd node-v $ {nodeversion} -linux-armv6l rm -f *.md rm -f LICENSE cp -R */usr/local/rm -R/tmp/node-v $ {nodeversion} -linux- armv6l rm /tmp/node-v${nodeversion}-linux-armv6l.tar.xz #TODO: ua sym txuas rau node binary? apt -tau tshem tawm -y --purge npm node nodejs

#Node teeb tsa mkdir/opt/nhl mkdir/opt/nhl/cav mkdir/opt/nhl/horns mkdir/opt/nhl/node_modules/

#hloov kho Node

#nruab node kev vam khom rau hauv nhl phau ntawv xa tawm NODE_PATH =/usr/local/lib/node_modules

#HACK - TODO - kho tus neeg ceg tawv uas tsis tuaj yeem teeb tsa thoob ntiaj teb

cd/opt/nhl npm install lame # lame, yog neeg ceg tawv, yuav tsis txhim kho thoob ntiaj teb cp -R/opt/nhl/node_modules/lame $ NODE_PATH npm nruab tus hais lus #wont nruab thoob ntiaj teb cp -R/opt/nhl/node_modules/hais lus $ NODE_PATH npm nruab i2c-bus #wont nruab thoob ntiaj teb cp -R/opt/nhl/node_modules/i2c-bus $ NODE_PATH npm nruab oled-i2c-bus #wont install globally cp -R/opt/nhl/node_modules/oled-i2c-bus $ NODE_PATH npm nruab lcd #wont nruab thoob ntiaj teb cp -R/opt/nhl/node_modules/lcd $ NODE_PATH npm nruab lcdi2c #wont nruab thoob ntiaj teb cp -R/opt/nhl/node_modules/lcdi2c $ NODE_PATH

npm nruab oled-font-5x7 #wont nruab thoob ntiaj teb

cp -R/opt/nhl/node_modules/oled-font-5x7 $ NODE_PATH

npm nruab onoff #yuav tsis nruab thoob ntiaj teb

cp -R/opt/nhl/node_modules/onoff $ NODE_PATH

#npm teeb tsa pm2 #yuav tsis nruab thoob ntiaj teb

#cp -R/opt/nhl/node_modules/pm2 $ NODE_PATH #npm install express #wont install globally #cp -R/opt/nhl/node_modules/express $ NODE_PATH

# ib qho qauv thoob ntiaj teb

npm nruab qhia lub cev -parser tus menyuam_process pm2 -g

Rub qhov tseeb code:

#pull git codecd/opt/nhl #JSON yog ib zaug tsim wget -tsis -cache -O /opt/nhl/nhl_config.json https://raw.githubusercontent.com/wga22/nodejs/ma… #wget -O /opt/nhl/NHL_work.js https://raw.githubusercontent.com/wga22/nodejs/ma… #call automated script to install everything else for NHL curl -sL https://raw.githubusercontent.com/wga22/nodejs /mav … | sudo -E tsoo -

Download tau lub suab!

#pull hornscd/opt/nhl/horns curl -sL https://raw.githubusercontent.com/wga22/nodejs/ma… | sudo -E tsoo -

hloov kho Raspberry pi cov ntaub ntawv teeb tsa - - yuav xav tau hloov pauv rau koj li kab ke

#config cov ntaub ntawv hloov tshiab#ntxiv suab cp /boot/config.txt /boot/config.txt.bak printf '\ ndtoverlay = pwm-2chan, pin = 18, func = 2, pin2 = 13, func2 = 4' >> / boot/config.txt #turn rau i2c printf '\ n / ndtparam = i2c1 = on / n' >> /boot /config.txt printf '\ n / ndtparam = i2c_arm = on / n' >>/boot/config. txt ua

#TODO: qhov no puas xav tau? Cp /etc /modules /etc/modules.bak printf '\ ni2c-dev / ni2c-bcm2708 / n' >> /etc /modules

amixer cset numid = 1

#TODO: teeb ntim, 60%?

Siv lub tshuab siv tshuab, xws li bootup thiab hloov kho cov cai:

# hloov tshiab rc.local# NCO TSEG: txav cov ntawv, vim tias ib tus qauv suav nrog "tawm" hauv kab kawg, yog li tsis tuaj yeem yooj yim ntxiv mv /etc/rc.local /etc/rc.local.bak kov /etc/rc.local chmod u+x /etc/rc.local printf '#!/bin/sh'> /etc/rc.local printf '\ n /etc/bootup_nhl.sh> /tmp/rclocal.log' >>/etc/rc.local printf '\ n tawm 0' >> /etc/rc.local

#TODO: xav tau ntxiv qee yam los ua qhov software hloov tshiab txhua lub lim tiam zoo li no# Tej zaum tsuas yog luam daim ntawv no ncaj qha mus rau rc.weekly nplaub tshev? rm /etc/cron.weekly/nhl_updater printf '#!/bin/sh / ncurl -sL https://raw.githubusercontent.com/wga22/nodejs/ma… | sudo -E bash -'> /etc/cron.weekly/nhl_updater chmod u+x /etc/cron.weekly/nhl_updater

Lwm yam khoom, xws li teeb tsa lub sijhawm sijhawm:

ln -sf/usr/qhia tawm/zoneinfo/America/New_York/etc/localtime

# hloov kho ib puag ncig sib txawv nrog node_path

cp/etc/environment /etc/environment.bak printf '\ nexport NODE_PATH =/usr/local/lib/node_modules / n' >>/etc/environment #TODO: txhais qhov no rau ntawm tus kheej.ipaddress = process.env. NODEJS_IP; #TODO: self.port = process.env. NODEJS_PORT || 80;

Siv PM2 rau kev teeb tsa tus neeg rau zaub mov:

#TODO: ntsuas teeb tsa PM2cd /tmp /npm nruab -g pm2 pm2 pib cd /opt /nhl pm2 pib NHL_work.js --node-args = "-max_old_space_size = 100 nthuav tawm-gc" pm2 pib webserver.js --node -args = "-max_old_space_size 100M" pm2 txuag pm2 pib tawm 0

Kauj Ruam 4: Kauj Ruam 4: Hloov kho JSON Configuration

Teeb koj cov ntaub ntawv teeb tsa JSON rau pab pawg koj nyiam, thiab lwm yam. Cov ntaub ntawv no nyob hauv /opt /nhl GO CAPITALS! config JSON cov ntaub ntawv

Lub software siv JSON cov ntaub ntawv los teeb tsa kho vajtse thiab pab pawg koj tab tom ua. Pab pawg tuaj yeem teeb tsa los ntawm lub vev xaib uas yuav ua haujlwm, tab sis kev teeb tsa kho vajtse xav tau teeb tsa tus kheej:

Nov yog kev piav qhia ntawm txhua tus nqi tau:

  • myteam: qhov no yog 3 tsab ntawv ntawm pab pawg koj xav ua raws
  • debug: Qhov muaj peev xwm ua tau yog 1 (tseeb) lossis 0 (cuav), thiab yuav tswj hwm kev txiav tawm ntau npaum li cas.
  • cov zis: qhov no yog cov txheej txheem uas cov qhab nia/cov ntsiab lus yuav tsum tau qhia. Qhov tseem ceeb yog:

    • lcd: qhov no yog 2004 lcd
    • console: qhov no yuav sau tsuas yog rau lub davhlau ya nyob twg (rau kev ua kab hais kom ua)
    • oled: txhawb nqa rau SSD6404 oled zaub
  • teeb: muaj ob hom teeb pom kev zoo

    • tswb: qhov no yuav tsav ib zaug GPIO rau kev qhib/tua lub transistor
    • multi-led: txhawb nqa ntau xim, lossis ntau leds
    • tsis muaj: tsis muaj lub teeb txuas
  • amp: qhov no yog GPIO uas tsav lub transistor rau lub amp

Pom zoo: