Cov txheej txheem:

IoT Tus Saib Xyuas Tsiaj!: 6 Cov Kauj Ruam (nrog Duab)
IoT Tus Saib Xyuas Tsiaj!: 6 Cov Kauj Ruam (nrog Duab)

Video: IoT Tus Saib Xyuas Tsiaj!: 6 Cov Kauj Ruam (nrog Duab)

Video: IoT Tus Saib Xyuas Tsiaj!: 6 Cov Kauj Ruam (nrog Duab)
Video: Tus Neeg Ruam - R-Lin Thoj | New Song [ Official MV ] Nkauj Tawm Tshiab 2023 Hmong Song 2023 2024, Hlis ntuj nqeg
Anonim
Image
Image
Pom Kev Nyeem Ntawv
Pom Kev Nyeem Ntawv

Khaws qhov muag saib koj cov menyuam nyiam thiab ua suab paj nruag lossis qhia lawv kom nyob ntsiag to thaum koj tsis nyob! Phau ntawv qhia no yuav qhia siv lub Raspberry Pi lub computer los saib xyuas lub suab nrov hauv koj lub tsev (ntawm Huab) los saib seb thiab thaum twg koj tus tsiaj chim.

Nruas yob … qhov lom zem tshaj plaws: Yog tias nws nrov nrov (zoo li Fido yog tawv lossis ua qee yam rau lwm yam), peb yuav koj tuaj yeem qhia lawv kom nyob ntsiag to lossis ua suab paj nruag!

Nrog rau Pi (thiab cov neeg hais lus), peb yuav siv SparkFun MEMS lub xov tooj cua lub suab tawm suab los ntsuas lub ntim ntim thiab ua rau lub suab tso tawm. Cov ntaub ntawv raug xa mus rau CloudMQTT kev pabcuam siv MQTT kev sib txuas lus raws tu qauv.

Lub Sijhawm Nyeem Ntawv Tag Nrho: ~ 8 feeb

Tag Nrho Cov Sijhawm: 60 feeb (tsawg dua nrog kev paub dhau los)

Ua tsaug ntau rau SparkFun rau kev txhawb nqa txoj haujlwm no! Mus saib qhov kev qhia ntawm no.

Kauj Ruam 1: Pom Kev Nyeem Ntawv

Txhawm rau tsim txoj haujlwm no, koj yuav xav tau teeb tsa kom raug, WiFi txuas nrog Raspberry Pi 3 computer nrog Raspbian OS. Nws kuj tseem pab kom paub qee qhov Python programming nrog rau cov hauv qab no: (1) yuav siv thiab tswj Raspberry Pi GPIO pins li cas; (2) MQTT kev sib txuas lus; thiab (3) analog sensors. Yog tias ib qho ntawm qhov no tsis paub, lossis yog tias koj tsuas yog xav paub (xav paub!), Txheeb tawm cov lus qhia hauv qab no!

Raspberry Pi 3

  1. Raspberry Pi 3 Starter Kit Hookup Guide
  2. Raspberry Pi GPIO
  3. SPI Kev Sib Tham nrog Raspberry Pi

MQTT Kev Sib Txuas Lus

MQTT (Xov Xwm Lus Nug Telemetry Thauj Mus Los) yog qhov nrov IoT kev sib txuas lus raws tu qauv. Peb yuav siv Paho Client Python lub tsev qiv ntawv thiab MQTT cov kev pabcuam hu ua CloudMQTT. Nov yog ntau ntxiv txog MQTT thiab yuav siv nws li cas:

  1. Tshawb Nrhiav Kev Sib Tham rau IoT
  2. Pib Pib nrog CloudMQTT
  3. Txheej txheem cej luam ntawm Dab noj hnub Paho MQTT Python cov neeg siv tsev qiv ntawv

MEMS Microphone Breakout Board

MEMS lub microphone yog lub microphone zoo sib xws, yog li peb yuav xav tau Analog-to-Digital converter ("ADC") los nyeem hauv cov lus sib piv nrog Raspberry Pi digital GPIO pins.

  1. Pib nrog SparkFun MEMS Microphone Breakout Board
  2. MEMS Microphone Datasheet
  3. MCP3002 ADC Cov Ntaub Ntawv

Kauj ruam 2: Cov ntaub ntawv

Khoom siv
Khoom siv
Khoom siv
Khoom siv
Khoom siv
Khoom siv

- Raspberry Pi 3 Qauv B.

Peb tseem yuav xav tau cov khoom siv hauv qab no: Raspberry Pi 3 Case; SD Card (yam tsawg 8 GB); Raspberry Pi 3 GPIO cable; MicroUSB fais fab cable; HDMI cable thiab HDMI-tshaj saib; USB keyboard; USB nas; hais lus nrog 1/8 lub mloog pob ntseg chaw nres nkoj.

- SparkFun MEMS Mic Breakout Board

-MCP3002 (Analog-rau-Digital Converter)

-Breadboard & M-to-M Breadboard Jumper Wires

Kauj Ruam 3: Kho lub Raspberry Pi

Configure Raspberry Pi
Configure Raspberry Pi
Configure Raspberry Pi
Configure Raspberry Pi
Configure Raspberry Pi
Configure Raspberry Pi
Configure Raspberry Pi
Configure Raspberry Pi

Kauj Ruam 1: Txheeb & Txhim Kho Tshiab Txheeb xyuas thiab txhim kho hloov tshiab ib txwm yog txoj hauv kev zoo los pib. Khiav cov lus txib hauv qab no hauv lub qhov rai davhlau ya nyob twg:

sudo apt-tau hloov tshiab

sudo apt-tau hloov tshiab

sudo rov pib dua

Kauj Ruam 2: Teeb SPI Interface rau MEMS Microphone + MCP3002

Txhawm rau siv SPI (Serial Port Interface) nyeem hauv MEMS Microphone ntawm MCP3002, peb yuav xav tau Python Dev Pob:

sudo apt-tau nruab nruab sej-dev

Peb tseem yuav xav tau SPI Interface (tej zaum yuav xav tsim lub subfolder kom txuag tau qhov no hauv):

git clone git: //github.com/doceme/py-spidev

sudo python setup.py nruab

Nov yog SPI-Dev Cov Ntaub Ntawv yog tias koj ua rau muaj teeb meem.

Kauj Ruam 3: Ua Si Suab nrog OMXPlayer

OMXPlayer yog lub suab thiab cov vis dis aus tso ua ntej ntawm Raspbian OS. Nws ua haujlwm nrog ntau hom ntaub ntawv suab, suav nrog:.wav,.mp3, thiab.m4a. Nov yog qhov peb yuav siv los ua suab rov qab thaum Fido nrov nrov. Python lub tsev qiv ntawv los tswj hwm OMXPlayer suav nrog hauv Raspbian (woo!)

Txhawm rau sim OMXPlayer los ntawm lub davhlau ya nyob twg, ntaus cov hauv qab no:

omxplayer /home/…/SongFilePath/SongFileName.mp3

Yog tias qhov ntawd tsis ua haujlwm, sim yuam nws hla lub tshuab tawm suab hauv zos:

omxplayer -o hauv zos /home/…/SongFilePath/SongFileName.mp3

Kauj Ruam 4: teeb tsa CloudMQTT Server

Tam sim no peb teeb tsa MQTT server! Txhawm rau ua qhov no siv CloudMQTT, ua cov hauv qab no:

  1. Teeb tsa CloudMQTT tus lej nyiaj (phiaj xwm "Cute Cat" yog pub dawb).
  2. Tsim qhov tshiab MyCloud piv txwv.
  3. Hauv Console, tsim txoj cai ACL tshiab.
  4. Koj tuaj yeem saib xyuas cov lus tshaj tawm hauv "Websocket" UI.

Thaum kawg, teeb tsa MQTT Paho Client Python lub tsev qiv ntawv:

pip nruab paho-mqtt

Kauj ruam 4: Tsim Nws! Kho vajtse

Tsim Nws! Kho vajtse
Tsim Nws! Kho vajtse
Tsim Nws! Kho vajtse
Tsim Nws! Kho vajtse
Tsim Nws! Kho vajtse
Tsim Nws! Kho vajtse

Pinout cov duab kos rau Raspberry Pi thiab MCP3002 nyob hauv cov duab saum toj no.

1. Ntxig MCP3002 tus pin rau hauv daim txiag (saib daim duab pinout saum toj no)

MCP3002 siv 4 tus lej SPI rau kev sib txuas lus: Clock Serial ("SCL"), Master Input Slave Output ("MISO"), Master Output Slave Input ("MOSI"), thiab Chip Select ("CS"). Cov pins no sib haum rau Raspberry Pi GPIO tus pin 11 (SCLK), GPIO tus pin 9 (MISO), GPIO Pin 10 (MOSI), thiab GPIO Pin 8 (CE0).

Ua cov kev txuas hauv qab no nrog MCP3002 tus pin:

  • Txuas Pin 1 rau Raspberry Pi GPIO Pin 8 (CE0)
  • Txuas tus Pin 2 mus rau qhov tso tawm analog ntawm MEMS Microphone breakout board
  • Txuas tus Pin 4 rau GND
  • Txuas Pin 5 rau Raspberry Pi GPIO Pin 10 (MOSI)
  • Txuas Pin 6 rau Raspberry Pi GPIO tus pin 9 (MISO)
  • Txuas Pin 7 rau Raspberry Pi GPIO Pin 11 (SCLK)
  • Txuas Pin 8 rau Raspberry Pi 3.3V tawm

2. Siv cov xov hlau txuas rau MEMS Microphone breakout board. Txuas mus rau MCP3002 thiab Raspberry Pi

  • Txuas Vcc rau Raspberry Pi 3.3V.
  • Txuas GND rau Raspberry Pi GND
  • Txuas AUD rau MCP3002 Tus Pin 2

3. Txuas txhua lub xov tooj rau Raspberry Pi thiab qhib txhua yam

Kauj ruam 5: Tsim Nws! Software

Tsim Nws! Software
Tsim Nws! Software

Peb lub hom phiaj nrog Bark Back yog ob npaug: ua rau muaj suab nrov thaum tus dev yws, thiab xa cov ntaub ntawv mus rau tus neeg rau zaub mov uas peb tuaj yeem tshawb xyuas nws.

Nov yog qhov kev pab cuam Python qhib rau qhov haujlwm no. Ua tsaug rau (thiab thov ua) kho thiab hloov kho cov cai.

Txhawm rau kom tau txais txoj haujlwm thiab ua haujlwm, koj yuav tsum ua ob yam:

- songList: Sau rau hauv kab ntawv thiab npe lub npe rau txhua zaj nkauj uas koj xav ua.

- qhab nia: Qhia koj cov ntaub ntawv CloudMQTT hauv phau ntawv txhais lus no.

Kauj Ruam 1: Nyeem hauv SparkFun MEMS Microphone breakout board

Nyeem nyob rau hauv ADC tus nqi (nruab nrab ntawm 0 thiab 1023) los ntawm MEMS Microphone breakout board (ntawm MCP3002) siv SPI lub tsev qiv ntawv thiab xam lub teeb liab ncov-rau-ncov qhov siab.

Daim ntawv qhia lub teeb liab ncov-mus-ncov qhov siab tshaj plaws rau Chav Ntim. Txoj cai tam sim no qhia txog ADC thaj tsam ntawm 0 thiab 700 (raws li kev sim nrawm) mus rau Chav Ntim nruab nrab ntawm 0 thiab 10. Txhawm rau kho qhov rhiab heev ntawm lub microphone, hloov kho ADC cov khoom siv ntau yam.

Yog xav paub meej ntawm MEMS mic, txheeb xyuas qhov kev qhia no.

Kauj ruam 2: Ua lub suab player

Ua ntej peb yuav xav tau nkauj los ua si! Koj tuaj yeem kaw suab nrawm hauv GarageBand (lossis ntawm koj lub xov tooj ntawm tes) thiab xa lawv mus rau Raspberry Pi. Hauv Python, siv lub tsev qiv ntawv txheej txheem hu rau omxplayer.

Hauv txoj cai, nkag mus rau txoj kab ntawv ntawm cov nkauj uas koj xav rov ua dua hauv * songList * sib txawv (kab 26). Lub ntim ntim tam sim no tau teeb tsa rau 7 hauv lub luag haujlwm tseem ceeb.

Kauj Ruam 3: Xa cov ntaub ntawv mus rau CloudMQTT Server

Siv Paho Client Python lub tsev qiv ntawv los sib tham nrog CloudMQTT servers. Txhawm rau nthuav dav dav: teeb tsa Client server; txhais cov txheej txheem kev sib txuas lus; txuas nrog peb daim ntawv pov thawj (aka creds); thiab sau npe thiab tshaj tawm peb cov ntaub ntawv. Feem ntau qhov no yog ua tiav hauv txoj haujlwm tseem ceeb (kab 129 - 149, thiab kab 169 - 174).

Txhawm rau txheeb xyuas cov ntaub ntawv tau txais, mus rau "Websocket UI" tab hauv CloudMQTT console.

Kauj Ruam 6: Xeem & Nruab

Xeem & Nruab!
Xeem & Nruab!

Khiav BarkBack.py program hauv Terminal lossis hauv Python IDE (koj kuj tseem tuaj yeem siv SSH los khiav qhov haujlwm tom qab koj tau tawm mus lawm).

Txheeb xyuas tias koj tau txais qib ntim hauv koj li Websocket UI tab.

Kuaj lub kaw lus los ntawm kev ua rau lub mic (npuaj, qw, tawv, thiab lwm yam) kom ntseeg tau tias cov neeg hais lus ua si hla txhua lub suab.

Thaum txhua yam tau tiav thiab ua tiav, nws tau pom zoo kom muab cov khoom sib txuas rau PCB (Luam Ntawv Circuit Board) yog tias koj npaj siab yuav nruab qhov system ntau dua li ob peb hnub.

Kev Sib Tw Microcontroller 2017
Kev Sib Tw Microcontroller 2017
Kev Sib Tw Microcontroller 2017
Kev Sib Tw Microcontroller 2017

Khiav Tawm Hauv Kev Sib Tw Microcontroller 2017

Kev Sib Tw Sensors 2017
Kev Sib Tw Sensors 2017
Kev Sib Tw Sensors 2017
Kev Sib Tw Sensors 2017

Thawj qhov khoom plig hauv kev sib tw Sensors 2017

Pom zoo: