Cov txheej txheem:

Playback Recorder Nrog Raspberry Pi: 7 Kauj Ruam (nrog Duab)
Playback Recorder Nrog Raspberry Pi: 7 Kauj Ruam (nrog Duab)

Video: Playback Recorder Nrog Raspberry Pi: 7 Kauj Ruam (nrog Duab)

Video: Playback Recorder Nrog Raspberry Pi: 7 Kauj Ruam (nrog Duab)
Video: Musicians talk about Buckethead 2024, Kaum ib hlis
Anonim
Image
Image
Cov Khoom Xav Tau
Cov Khoom Xav Tau

Nyob zoo sawv daws, Hauv cov lus qhia no kuv piav qhia yuav ua li cas kuv ua lub kaw suab playback siv Raspberry Pi. Cov cuab yeej yog Raspberry Pi tus qauv B+, nrog 7 lub khawm thawb rau saum, tus hais lus txuas nrog ib qho ntawm Pi tus usb chaw nres nkoj, thiab lub microphone txuas nrog rau lwm qhov chaw nres nkoj usb. Txhua lub pob tau cuam tshuam nrog lub suab, yog li nws tuaj yeem ua 7 suab sib txawv. Cov suab tau ua si tom qab nias lub pob me me. Txhawm rau sau lub suab tshiab, tsuas yog thawb lub pob rau ntau dua 1 vib nas this, kaw tom qab lub suab nrov, thiab tso lub pob tom kawg ntawm cov ntaub ntawv. Nws tsis tau txais ib qho yooj yim dua qhov ntawd!

Kauj Ruam 1: Cov Khoom Xav Tau

Cov Khoom Xav Tau
Cov Khoom Xav Tau
Cov Khoom Xav Tau
Cov Khoom Xav Tau

Rau qhov haujlwm no kuv xav tau:

  • Raspberry Pi tus qauv B + thiab micro SD daim npav - 29.95 $ + 9.95 $
  • Ib rooj plaub yas Raspberry Pi - 7.95 $
  • USB hais lus - 12.50 $
  • USB microphone - 5.95 $
  • Ib nrab-qhov loj me perma-proto board-4.50 $
  • 7 cov nyees khawm thawb - 2.50 $

Kuv kuj xav tau:

  • Qee cov xaim hluav taws xob
  • Txoj cai-kaum poj niam lub taub hau
  • Qee cov ntoo, xim dub thiab kua nplaum rau lub khawm khawm
  • Ib tug soldering hlau thiab solder

Kauj ruam 2: Cov Nyees khawm

Cov Khawm
Cov Khawm
Cov Khawm
Cov Khawm
Cov Khawm
Cov Khawm

Cov nyees khawm siv tau siab heev (6mm) kom lawv tuaj yeem hla cov ntaub ntawv tuab.

Kuv tso kuv 7 lub nyees khawm rau ntawm perma-proto board, uas yog zoo li lub khob cij, tshwj tsis yog cov khoom siv tau muab tso rau ntawm nws. Qhov no muaj zog dua li daim ntawv qhia zaub mov, thiab pheej yig dua li luam ntawv pcb. Txhua lub khawm txuas hauv av mus rau GPIO ntawm Raspberry Pi. Kuv tsis muaj tus tiv thaiv ntawm no txij li Pi twb muaj sab hauv rub tawm/nqis resistors uas yuav tau teeb tsa hauv qhov haujlwm. Hauv qhov no kuv tau teeb tsa lawv kom rub tawm (saib qhov program hauv qab no).

Cov nyees khawm tau muab tso rau txhua 4 kab, lossis txhua 0.4 hauv.

Kauj Ruam 3: Cov Khawm Khawm

Cov Case Case
Cov Case Case
Cov Case Case
Cov Case Case
Cov Case Case
Cov Case Case

Kuv tau ua cov ntaub ntawv yooj yim heev rau cov nyees khawm, nrog cov plywood los xij thiab cov ntoo txua ntoo. Qhov me me ntawm lub laub yuav tsum loj txaus kom muaj lub hauv paus khawm thiab lub rooj tsavxwm, tab sis me me txaus kom tso lub khawm sab saum toj ntawm rooj plaub. Kuv siv 1/4 nyob rau hauv x 1/4 hauv kab rov tav.

Tom qab ua kom ntseeg tau tias lub rooj tsavxwm haum rau hauv rooj plaub, cov dowels tau lo rau ntawm lub hauv paus ntawv. Cov qhov tom qab ntawd tau muab hlais rau ntawm daim ntawv saum toj kawg nkaus (lub rooj tsavxwm tuaj yeem siv los ua qhov cim txhua txhua 0.4 ntiv tes). Txhua qhov ntoo yog pleev xim rau, lub rooj tsavxwm muab tso rau hauv rooj plaub, thiab daim ntawv lo tau lo rau saum nws.

Kauj Ruam 4: Raspberry Pi

Raspberry Pi
Raspberry Pi
Raspberry Pi
Raspberry Pi
Raspberry Pi
Raspberry Pi

Kuv tsis xav muab cov xov hlau txuas ncaj qha rau Pi, yog tias kuv xav siv Pi rau lwm yam yav tom ntej. Yog li kuv tau muab cov xov hlau txuas rau sab xis-tus poj niam lub taub hau, thiab ntsaws lub taub hau ntawm Pi.

GPIOs siv yog 21, 26, 20, 19, 13, 6 thiab 5. Tus pin hauv av kuj tseem siv tau.

Lub microphone thiab tus hais lus tau yooj yim ntsaws rau hauv 2 ntawm 4 lub chaw nres nkoj usb.

Tus Pi tau siv los ntawm lub qhov hluav taws xob micro-usb

Kauj ruam 5: Programming

Txhawm rau program Pi, Kuv txuas nws rau internet siv tus ethernet cable, thiab tswj nws los ntawm lub khoos phis tawj deb siv VNC tus saib. Txawm li cas los xij, koj tsis tuaj yeem siv qhov teeb tsa no thawj zaug koj txuas rau Pi, vim tias OS tseem tsis tau teeb tsa thiab SSH tsis ua haujlwm. Yog li koj yuav tsum txuas lub vijtsam, keyboard thiab nas, tsawg kawg yog thawj zaug.

Nws yog qhov nyuaj heev los nrhiav cov lus txib kom kaw thiab ua suab nrov ntawm daim npav suab zoo. Nov yog cov lus txib uas ua haujlwm rau kuv:

  • aplay -D plughw: CARD = Device_1, DEV = 0 0.wav

    Plays 0.wav

  • arecord 0.wav -D sysdefault: CARD = 1 -f cd -d 20

    Cov ntaub ntawv rau siab tshaj 20 vib nas this hauv cov ntaub ntawv 0.wav, nrog cd zoo

Cov ntaub ntawv suab nyob hauv phau ntawv teev npe tsis raug (/home/pi). Cov ntaub ntawv suab rau lub beep kuj tseem tsim nyog, muab tso rau hauv phau ntawv teev npe tsis raug thiab hu ua beep.wav.

Python code nws tus kheej yog cov hauv qab no:

nab hab sej code rau Raspberry Pi playback recorder

ntshuam RPi. GPIO ua GPIO
lub sij hawm ntshuam
import os
#variables:
butPressed = [Tseeb, Tseeb, Tseeb, Tseeb, Tseeb, Tseeb, Tseeb]#yog khawm kuv raug nias,
tus pin = [26, 19, 13, 6, 5, 21, 20] #GPIO pins ntawm txhua lub pob
recordBool = Cuav#Muaj tseeb yog tias cov ntaub ntawv tseem tab tom ua
GPIO.setmode (GPIO. BCM)
rau kuv hauv ntau (0, 7):
GPIO.setup (tus pin , GPIO. IN, pull_up_down = GPIO. PUD_UP) #sets Pi tus sab hauv resistors kom rub
thaum Muaj Tseeb:
rau kuv hauv ntau (0, 7):
butPressed = GPIO.input (tus pin )#kuaj xyuas yog tias lub pob nyem
yog tias tab sis Nyuaj == Tsis tseeb:#yog lub pob nyem
timeTime = sij hawm.time ()
thaum tab sis Nias == Tsis raug thiab recordBool == Tsis tseeb:
butPressed = GPIO.input (tus pin )
yog time.time () - yav dhau losTime> 1.0:#yog tias lub pob raug nias ntau dua li ib pliag, ces recordBool Yog Qhov Tseeb
recordBool = Tseeb
yog recordBool == Muaj tseeb: #if recordBool Yog Qhov Tseeb, nws ua suab nrov nrov thiab tom qab ntawd kaw
os.system ("aplay -D plughw: CARD = Device_1, DEV = 0 beep.wav")
os.system ("arecord %d.wav -D sysdefault: CARD = 1 -f cd -d 20 &" %i) #records rau siab tshaj 20 vib nas this hauv cov ntaub ntawv i.wav, nrog cd zoo
thaum tab sis Nias == Cuav:
butPressed = GPIO.input (tus pin )
os.system ("pkill -9 arecord")#cov ntaub ntawv raug tso tseg thaum lub pob raug tso tseg, lossis tom qab 20 vib nas this
recordBool = tsis tseeb
lwm tus: #if recordBool Tsis yog, nws ua suab i.wav
os.system ("aplay -D plughw: CARD = Device_1, DEV = 0 %d.wav" %i)
sijhawm.s pw (0.1)

saib rawPlayback kaw kaw nrog ❤ los ntawm GitHub

Kauj Ruam 6: Khiav Python Script ntawm Txhua Qhov Pib

Txhawm rau khiav cov ntawv nab nab ntawm txhua Pi pib, cov kab hauv qab no tau muab tso rau hauv cov ntawv hu ua playback.desktop hauv nplaub tshev/home /pi /.config/autostart/

sau playback.py ntawm Raspberry Pi qhov pib

[Desktop nkag]
Encoding = UTF-8
Hom = Daim Ntawv Thov
Lub npe = Kev ua si
Tawm tswv yim = Nov yog daim ntawv thov rov ua dua
Exec = nab hab sej /home/pi/playback.py
StartupNotify = cuav
Terminal = muaj tseeb
Thaum = tsis tseeb

saib rawplayback.desktop tuav nrog ❤ los ntawm GitHub

Kauj Ruam 7: Xaus Qhov Cim

Thov qhia kuv tias koj xav li cas txog txoj haujlwm no hauv kab lus tawm tswv yim, qhia rau kuv paub txog koj cov lus pom zoo, thiab pov npav rau kuv hauv kev sib tw Raspberry Pi yog tias koj nyiam.

Nrhiav rau pem hauv ntej kom nyeem koj!

Pom zoo: