Cov txheej txheem:

LittleUnicorn: Raspberry Pi Baby Monitor: 5 Kauj Ruam
LittleUnicorn: Raspberry Pi Baby Monitor: 5 Kauj Ruam

Video: LittleUnicorn: Raspberry Pi Baby Monitor: 5 Kauj Ruam

Video: LittleUnicorn: Raspberry Pi Baby Monitor: 5 Kauj Ruam
Video: Raspberry Pi 5: First Insights 2024, Lub Xya hli ntuj
Anonim
LittleUnicorn: Raspberry Pi Baby Monitor
LittleUnicorn: Raspberry Pi Baby Monitor

Kuv muaj menyuam ntxaib thiab cov menyuam saib lub suab hais txog kuv. Txhua lub sijhawm nws tawm mus, Kuv tau txais lub siab tawm hws yog tias nws txhais tau tias lwm hmo tsis tsaug zog.

Yog li kuv ua Little Unicorn. Nws lub ntsej muag menyuam saib ua los ntawm:

  • 2 x raspberry pis,
  • Pimoroni Unicorn HAT HD,
  • USB Mini Mic
  • nab hab sej coding
  • LEGO Ghostbusters firestation (xaiv tau)

Kauj ruam 1: Teeb Pis

Teeb lub Pis
Teeb lub Pis
Teeb lub Pis
Teeb lub Pis

Koj ob leeg Raspberry Pis yuav tsum nyob rau tib lub network wifi. Txhua qhov kuv pom zoo yog rau Raspbian OS.

Yog tias koj teeb tsa lawv los ntawm kos koj yuav xav ntxiv koj cov ntsiab lus wifi. Kuv tau pom txoj hauv kev yooj yim tshaj plaws los ntawm kev kho cov ntaub ntawv `wpa_supplicant`, raws li tau qhia hauv Raspberry Pi Foundation cov lus qhia, kom yog txoj hauv kev ntseeg tau tshaj plaws. Kuv muaj ob peb Pis hauv tsev, Pi 3 thiab Pi xoom (uas xav tau wifi dongle).

Ib qho ntawm tus pis yuav ua lub suab server thiab lwm tus yog tus txais. Kuv siv Pi 3 ua tus neeg rau zaub mov thiab Pi Zero ua tus txais/tus neeg siv khoom.

Rub tus lej LittleUnicorn nab nab rau ntawm txhua tus Pis. Yog tias koj tau teeb tsa git, txoj hauv kev yooj yim los ua qhov no yog nrog:

git clone https://github.com/zemogle/littleunicorncd littleunicorn nab hab sej setup.py nruab

Yog tias koj tsis muaj git teeb tsa koj tuaj yeem nruab nws los ntawm kev tso tawm, tab sis koj yuav xav tau cURL lossis wget nruab:

wget

tar -xvf 1.0.tar.gz cd LittleUnicorn -1.0 python setup.py nruab

NB Python <3 tam sim no tsis pom zoo yog li kuv xav tias koj siv Python 3+. Yog tias koj tsis muaj nab nab 3, koj yuav tsum tau nruab nws.

Kauj ruam 2: Server Set Up

Muaj qhov xav tau rau pyaudio tab sis qhov no tsuas yog xav tau rau tus neeg rau zaub mov (piv txwv li ib qho nrog USB mic uas mus rau hauv tus menyuam chav pw). Koj tuaj yeem nruab qhov no tsis muaj mob ua pob. Qhov no yuav rub tawm txhua qhov kev vam khom koj xav tau thiab teeb tsa nws rau koj:

sudo apt-tau nruab python3-pyaudio

Koj tuaj yeem nruab tag nrho lwm qhov kev xav tau los ntawm cov ntaub ntawv xav tau:

sudo pip3 nruab -r ~/littleunicorn/requirements.pip

Tam sim no koj lub server yuav tsum npaj mus! Tua tawm tus neeg rau zaub mov:

cd Littleunicorn

sej3 server.py

Koj yuav tsum pom cov lus xwm txheej zoo li cov hauv qab no:

======== Khiav ntawm https://0.0.0.0:8080 ========

(Nias CTRL+C kom tawm)

Yog tias koj tsis pom cov lus no thiab tau txais qhov yuam kev nws yuav luag yog koj li sej teeb tsa tsis raug. Qee zaum nws yuav muaj teeb meem nrog lub microphone. Hauv qhov xwm txheej twg sim lwm lub qhov (socket) USB.

Kauj Ruam 3: Teeb Tus Txais

Nov yog qhov uas lom zem. Lwm qhov hauv koj lub tsev (lossis hauv tib chav rau kev sim), tso Unicorn HAT HD ntawm koj tus neeg txais Rasperberry Pi thiab tso lub zog.

Nruab Pimoroni software

Koj yuav tsum tau teeb tsa software rau qhov no. Cov neeg zoo ntawm Pimoroni tau sau lub tsev qiv ntawv nab nab zoo rau qhov no. Lawv GitHub repo qhia koj raws nraim yuav ua li cas rau nruab nws.

Nruab LittleUnicorn software

Qhov no zoo ib yam nkaus li hauv qib dhau los (piv txwv li rau server), yog li tsuas yog ua raws cov lus qhia no.

Kuaj nws tawm

Thaum qhov ntawd tau teeb tsa tag nrho coj koj LittleUnicorn rau qhov tig.

N. B. Qhov no xav tau tias koj tau tso tus neeg rau zaub mov khiav hauv cov kauj ruam dhau los thiab koj paub lub npe lossis tus IP chaw nyob ntawm Pi nws tau ua haujlwm.

Cov ntaub ntawv client.py siv kev sib cav sib cav ntxiv rau lub npe/IP ntawm tus neeg rau zaub mov. Qhov no muaj txiaj ntsig tshwj xeeb vim tias qhov sib txawv hauv kev tso cov header pins lub zog tawm tswv yim ntawm cov qauv sib txawv pi.

Yog tias koj lub server ua haujlwm ntawm Pi nrog IP chaw nyob 192.168.1.10 thiab koj xav tig cov zaub los ntawm 90 degrees, koj tuaj yeem pib ua raws li hauv qab no:

cd Littleunicorn

python3 client.py 192.168.1.10 90

Kauj ruam 4: Automating Start Up

Tej zaum koj tsis xav kom tau nkag mus rau txhua lub sijhawm koj rov pib dua txhua Pi. Koj tuaj yeem siv tus saib xyuas lossis cron los pib ua qhov no ntawm khau raj. Cron yog qhov yooj yim tshaj plaws thiab tau teeb tsa ua ib feem ntawm Raspbian.

Ntawm tus neeg rau zaub mov

Kho koj tus crontab los ntawm kev ntaus sudo crontab -e tom qab ntawd nkag mus rau hauv qab no hauv kab lus hais tawm kab (piv txwv li tom qab tus pib nrog #)

@reboot python3 /home/pi/littleunicorn/server.py >> /home/pi/unicorn.log 2> & 1

Ntawm tus txais

Kho qhov crontab ntawm tus txais pi thiab ntxiv cov hauv qab no

@reboot python3 /home/pi/littleunicorn/client.py 192.168.1.10 90 >> /home/pi/unicorn.log 2> & 1

90 yog kev sib hloov ntawm cov zaub zoo li ua ntej. Hloov qhov no thiab IP chaw nyob rau qhov tsim nyog.

Kauj Ruam 5: Xaus

Image
Image
Xaus
Xaus
Xaus
Xaus

Nov yog qhov haujlwm me me, xoom-xaim rau txhua tus neeg uas tsis mob siab rau lawv txhais tes qias neeg nrog me ntsis ntawm kab hais kom ua haujlwm.

Kuv yog menyuam yaus ntawm 80s yog li … lub tswb nrov tau tshoov siab los ntawm PacMan

  • Jelly Beans - qhov no yog kev ua haujlwm ib txwm muaj. Muaj ib txwm muaj suab nrov hluav taws xob lub mic tuaj tos
  • Txiv kab ntxwv Ntsuj Plig (Clyde) - tus txais tau tab tom nrhiav rau server. Txheeb xyuas koj tau nkag mus rau tus IP raug thiab koj tuaj yeem nkag mus rau server server.
  • Blue Ghost - Thaum lub suab nrov dhau qhov pib (koj tuaj yeem tinker nrog nws hauv txoj cai) koj yuav pom xiav PacMan dab. Mus thiab saib yog tias koj tus menyuam tsis ua li cas!

Kuv tshwm sim kom muaj LEGO Ghostbusters hluav taws lub tsev yog li kuv tau tso Me Unicorn rau hauv qhov ntawd, uas zoo li tsim nyog.

Pom zoo: