Cov txheej txheem:

PAB: a Personal Audio Box: 5 Kauj ruam
PAB: a Personal Audio Box: 5 Kauj ruam

Video: PAB: a Personal Audio Box: 5 Kauj ruam

Video: PAB: a Personal Audio Box: 5 Kauj ruam
Video: ЗАПРЕЩЁННЫЕ ТОВАРЫ с ALIEXPRESS 2023 ШТРАФ и ТЮРЬМА ЛЕГКО! 2024, Hlis ntuj nqeg
Anonim
PAB: a Personal Audio Box
PAB: a Personal Audio Box

Lub tswv yim rau txoj haujlwm no tau yug los los ntawm qhov yuav tsum tau khawb peb qhov loj ntawm HiFi system, uas tam sim no tau mus txog qhov kawg ntawm lawv lub neej. Ib qho ntxiv, kuv xav tau chaw ntau ntxiv hauv txee rau lwm yam khoom, yog li kuv tau siv lub sijhawm los pib kawm ntawm Tus Kheej Lub Suab los hloov txhua txoj haujlwm ntawm peb lub vintage "loj heev".

Raspberry Pi3B+ zoo li yog qhov kev xaiv zoo tshaj plaws rau cov laj thawj no:

  • Daim ntawv me me thiab kev siv hluav taws xob tsawg;
  • Lub suab PCM tso tawm nrog qhov ua tau zoo;
  • Qhov muaj ntawm mopidy, lub suab paj nruag txuas ntxiv siv mpd raws tu qauv;
  • Kev koom ua ke siab ntawm cov peev txheej: nkauj hauv zos, CDROM, xov tooj cua, Spotify, Tunein, thiab lwm yam.

Kev koom ua ke nrog ob peb lwm yam ntxiv, Kuv muaj peev xwm los ua kom tiav thiab tsis muaj lub taub hau, muaj peev xwm ua suab paj nruag los ntawm CDs, cov ntawv hauv zos, xov tooj cua online, Spotify playlists, podcasts. Thiab los ntawm kev siv lub ntsej muag, tam sim no kuv tuaj yeem tswj hwm nws cov haujlwm los ntawm ib qho khoom siv txuas nrog LAN (smartphone, khoos phis tawj, ntsiav tshuaj).

Khoom siv

  • Raspberry PI3B+
  • Cov ntaub ntawv DVD qub
  • CDROM nyeem ntawv
  • 5v-5A fais fab mov
  • Supercapacitors
  • Ntau yam khoom siv (transistors, LED, relay, Op-Amp): saib cov ncauj lus kom ntxaws

Kauj Ruam 1: Cov Ntaub Ntawv thiab Txheej Txheem ntawm Cheeb Tsam

Case thiab Layout ntawm Cheebtsam
Case thiab Layout ntawm Cheebtsam
Case thiab Layout ntawm Cheebtsam
Case thiab Layout ntawm Cheebtsam
Case thiab Layout ntawm Cheebtsam
Case thiab Layout ntawm Cheebtsam
Case thiab Layout ntawm Cheebtsam
Case thiab Layout ntawm Cheebtsam

Thawj qhov teeb meem kuv ntsib yog xaiv thiab nrhiav rooj plaub uas tsim nyog. Nrhiav tsis muaj dab tsi nyob hauv tsev, Kuv pom qhov pheej yig DVD player ntawm Amazon rau ob peb daus las, tab sis txhua yam zoo sib xws yuav zoo txaus. Cov ntaub ntawv muaj qhov ntev no: 27cm x 20cm x 3.5cm.

Kuv tshem tawm tag nrho cov ntsiab lus, khaws tsuas yog lub rooj tsavxwm me me los tswj lub hauv ntej LED, lub hwj huam khawm thiab USB nkag. Tom qab ntawd kuv tau npaj cov txheej txheem sab hauv rau cov khoom tshiab (saib daim duab).

Kauj Ruam 2: Lub Suab Tso Lub Suab Tso Tawm

Lub Suab Tso Lub Suab Tso Tawm
Lub Suab Tso Lub Suab Tso Tawm
Lub Suab Stereo Sensing Hloov
Lub Suab Stereo Sensing Hloov
Lub Suab Stereo Sensing Hloov
Lub Suab Stereo Sensing Hloov

Vim li cas thiaj hloov lub suab tsis siv neeg? Qhov xav tau tshwm sim los ntawm qhov tseeb tias kuv tau mloog TV ntau zaus dhau los ntawm HiFi lub tshuab hluav taws xob, tab sis kuv tsis xav xaiv qhov hloov pauv ntawm lub tshuab hluav taws xob txhua lub sijhawm. Nrog rau lub voj voog no, lub tshuab tso tawm suab ib txwm zoo ib yam, thiab lub hauv paus tau txiav txim siab los ntawm Lub Suab Tso Suab Tso Siab.

Schematic yog ncaj-rau pem hauv ntej. Thaum PAB tsis ua si, lub suab xa mus rau HiFi tau los ntawm TV. Yog tias PAB ua si, tus xa ntawv xaiv lub suab los ntawm Raspberry.

Kauj Ruam 3: Super-Capacitors Box

Lub thawv Super-Capacitors
Lub thawv Super-Capacitors
Lub thawv Super-Capacitors
Lub thawv Super-Capacitors

Raws li paub, kev cuam tshuam tam sim ntawm lub hwj chim muab rau Raspberry ua rau lub zog tam sim tam sim tsis ua tiav ntawm cov txheej txheem kaw, muaj kev pheej hmoo cuam tshuam rau kev ua haujlwm thiab yog li nws tag nrho cov haujlwm. Supercapacitor sib txawv los ntawm ib txwm muaj lub tshuab hluav taws xob hauv ob yam tseem ceeb: nws cov phaj tau muaj thaj tsam loj dua thiab qhov nrug nruab nrab ntawm lawv yog me dua, vim tias cov insulator cuam tshuam ua haujlwm sib txawv dua li cov pa dielectric. Nrog rau cov txheej txheem no, lub peev xwm loj heev (nyob rau hauv kev txiav txim ntawm ntau kaum tawm ntawm Farads) cov khoom siv hluav taws xob tuaj yeem ua thaum tswj qhov loj me. Lub tswv yim yog li ntawd los tsim 5v "tsis" ntawm supercapacitors thiab qhib kev kaw thaum tsis muaj qhov ntsuas hluav taws xob raug kuaj pom. Txoj hauv kev no, nws yuav tsis tsim nyog los cuam tshuam nrog tus kheej kom qhib qhov kev kaw, tab sis tsuas yog tshem lub ntsaws (lossis qhib qhov hloov) kom ntseeg tau tias muaj kev nyab xeeb kaw.

Kev hais txog cov txheej txheem, lub zog siv tau siv rau sab laug lub davhlau ya nyob twg thiab Schottky diode tiv thaiv kev rov qab los ntawm tam sim no rau lub zog siv. Ob qhov 1.2Ω 5W lub zog tiv thaiv hluav taws xob sib txuas txwv tus nqi tam sim no ntawm supercapacitors, txhawm rau tiv thaiv lub zog siv. Tsis muaj cov resistors no, qhov siab tshaj tam sim no xav tau los ntawm ob lub supercapacitors tso tawm yuav luag yuav muaj peev xwm ua puas lub hwj chim. Lub hwj chim diode yuav tsum yog hom Schottky txhawm rau txhawm rau ntxig qhov qis tshaj qhov poob qis hauv koob nrog 5V bar.

Ob lub supercapacitors tau txuas nrog ua ke kom ntseeg tau qhov siab tshaj ntawm 5.4 volts ntawm lawv qhov kawg (txhua lub supercapacitor yog 10F, 2.7V) thiab ob lub resistors nyob rau hauv parallel mus rau lub peev xwm sib npaug ntawm kev them nyiaj tam sim thiab lav qhov tso tawm qeeb thaum Raspberry tig tawm. Ob qhov 1KΩ resistors sib npaug rau cov tswv yim faib 5V ntawm lub zog hluav taws xob hauv ib nrab kom coj lub teeb liab tsim nyog txhawm rau txheeb xyuas lub zog tsis ua haujlwm (txuas nrog Raspberry GPIO 7). Tsis zoo li cov roj teeb lithium niaj hnub no, supercapacitors lav yuav luag tsis muaj pes tsawg tus nqi thiab kev tso tawm mus, yam tsis poob yam ntxwv.

Vim li no yuav muaj peev xwm ua kom Raspberry muaj zog thiab ua haujlwm rau lub sijhawm xav tau los ua qhov kev kaw haujlwm ib txwm muaj. Qhov pib ntawm txheej txheem kaw yuav raug tshuaj xyuas los ntawm cov haujlwm uas khiav ntawm Raspberry uas yuav saib xyuas qhov xwm txheej ntawm GPIO 7, uas yog qib sib txuas nrog. Thaum lub hwj chim raug txiav tawm, GPIO tus pin 7 hla ntawm qib qis thiab ua rau kaw. Nov yog qhov chaws:

#!/usr/bin/env nab hab sej

ntshuam RPi. GPIO ua GPIO ntshuam subprocess GPIO.setmode (GPIO. BCM) # siv GPIO suav tus lej GPIO.setwarnings (Cuav) INT = 7 # tus pin 26 saib xyuas Lub Hwj Huam Muab # siv lub zog rub_up los tsim GPIO.setup siab (INT, GPIO. IN, rub_up_down = GPIO. PUD_UP) def lub ntsiab (): thaum Tseeb: # teeb tsa cuam tshuam rau ntawm qhov ntog ntog thiab tos kom nws tshwm sim GPIO.wait_for_edge (INT, GPIO. FALLING) # xyuas tus pin qib dua yog GPIO.input (INT) == 0: # tseem qis, kaw Pi subprocess.call (['poweroff'], plhaub = Tseeb, / stdout = subprocess. PIPE, stderr = subprocess. PIPE) yog _name_ == '_main_': lub ntsiab ()

Qhov kev zov me nyuam yuav tsum raug cawm hauv/usr/local/bin/.py thiab teeb tsa kom khiav thaum Raspberry pib. Los ntawm kev ntsuas ua tiav, lub peev xwm ntawm ob lub supercapacitors tau ua pov thawj txaus kom ntseeg tau tias lub sijhawm kaw rau Raspberry. Yog tias xav tau sijhawm ntau dua, nws yuav txaus los qhia ob lwm lub supercapacitors sib xws rau cov uas twb muaj lawm, lossis hloov lawv nrog ob lub peev xwm loj dua.

Kauj Ruam 4: Sib Sau thiab Siv USB Chaw

Sib sau ua ke thiab Siv USB Ports
Sib sau ua ke thiab Siv USB Ports

Thaiv Cov Qauv qhia pom yuav ua li cas txuas ntau lub cuab yeej rau PAB ntawm lub npav loj 3 (+5v, USB thiab lub tso suab).

Nco ntsoov tias CD nyeem ntawv lub hwj chim tau txuas ncaj qha mus rau Lub Hwj Huam Lub Hwj Chim loj los ntawm "Y" cable, thaum lub suab tawm mus rau Raspberry. Plaub qhov chaw nres nkoj USB Raspberry tau siv rau:

  • CD nyeem ntawv;
  • 250GB pendrive khaws cov nkauj hauv zos (mp3, m4a, wma, flac, thiab lwm yam);
  • a 16GB micro SD-card (nrog USB adapter) khaws tag nrho cov thaub qab ntawm lub ntsiab Raspi SD (saib hauv qab);
  • kev sib txuas rau sab nraud USB chaw nres nkoj ntawm rooj plaub.

Sab nraud USB chaw nres nkoj tuaj yeem siv los ua suab paj nruag sab nraud lossis txhawb lub zog sab nraud. Hauv kuv qhov xwm txheej, Kuv tab tom siv lub zog Bluetooth sab nraud xa tawm raws li kuv tau pov tseg Raspi sab hauv ib qho vim qhov qis thiab tsis ruaj khov. Nrog rau sab nraud bluetooth Kuv tab tom tsav tsheb 2 lub tso suab sib txawv hauv tsev.

16GB micro SD daim npav (nrog USB adapter) tuav tag nrho Raspberry thaub qab. Kuv tab tom siv rpi-clone, uas tau nthuav tawm los ua qhov haujlwm zoo heev uas tso cai kom muaj kev ua haujlwm tag nrho ntawm Raspberry yam tsis tas yuav tshem tawm sab hauv SD. Kuv tau pauv ntau zaus SD no nrog sab hauv, yam tsis muaj teeb meem. Yog li kuv tau teeb tsa cronjob rau cov neeg siv hauv paus:

#Backup ntawm sda - txhua hmo Wednesday

15 2 * * 3/usr/sbin/rpi -clone sda -u | mail -s "PAB backup on SD - done"

Tom qab ntawd kuv tau rov siv lub zog qub khawm ntawm rooj plaub kom kaw thiab rov pib dua Raspberry, ua raws cov lus qhia no:

Kauj ruam 5: Software thiab Operating System

Software thiab Operating System
Software thiab Operating System
Software thiab Operating System
Software thiab Operating System
Software thiab Operating System
Software thiab Operating System

Lub hauv paus tseem ceeb ua haujlwm ntawm PAB yog Raspbian tsawg heev (Debian Buster) nrog ntau qhov tshwj xeeb ntxiv:

  • rpi-clone rau kev thaub qab tseem ceeb;
  • ssmtp, yooj yim MTA kom xa ntawv tawm ntawm qhov system;
  • udevil, tso cai rau automount ntawm USB tsav;
  • abcde, txhawm rau lob kuv cov CD sau thiab muab ntim rau txhua hom suab;
  • mopidy, puv Music Player Daemon nrog pawg ntawm plugins.

Kuv tau sau tag nrho PAB Teem Sijhawm server thov siv nab hab sej 3 thiab cua daj cua dub, uas nws cov cai tawm ntawm qhov txwv ntawm tsab xov xwm no, tab sis kuv tuaj yeem muab cov lus qhia ntawm kev thov. Nrog Tus Teem Sijhawm koj tuaj yeem teeb tsa cov npe nkauj rau txhua lub sijhawm ntawm koj hnub, sib txawv hnub ua haujlwm txij hnub so.

Lub software tseem ceeb uas khiav PAB yog mopidy. Txog kev teeb tsa thiab teeb tsa mopidy (dav heev) thov xa mus rau nws cov ntaub ntawv ntawm no:

Nov yog cov plugins uas tau teeb tsa:

  • Mopidy-Alsamixer
  • Mopidy-Internetarchive
  • Mopidy-Local-Sqlite
  • Mopidy-Podcast
  • Mopidy-Scrobbler Cov
  • Mopidy-Soundcloud
  • Mopidy-Spotify
  • Mopidy-Spotify-Tunigo
  • Mopidy-Cd
  • Mopidy-Iris
  • Mopidy-Hauv Zos-Duab
  • Mopidy-TuneIn

Txhawm rau kom tau txais kev tswj hwm puv ntawm PAB, Kuv tau xaiv qhov Iris frontend txuas ntxiv (saib duab). Nov yog daim ntawv thov web muaj zog heev nrog cov yam ntxwv hauv qab no:

  • Puv web-based interface tswj rau Mopidy
  • Txhim kho kev txhawb nqa rau cov tsev qiv ntawv hauv zos (txhawb los ntawm Mopidy-Local-Sqlite)
  • Xauj thiab tswj cov playlists thiab lem
  • Tshawb nrhiav cov nkauj tshiab, nrov thiab cuam tshuam (txhawb los ntawm Spotify)
  • Pub dawb
  • Kev koom ua ke nrog:

    • Spotify
    • LastFM
    • Ntse
    • Snapcast
    • Icecast

Ua li no, Kuv muaj kev ywj pheej los tswj kuv lub suab paj nruag los ntawm yuav luag txhua qhov chaw (khoos phis tawj, ntsiav tshuaj, smartphone).

Pom zoo: