Cov txheej txheem:
- Khoom siv
- Kauj Ruam 1: Dab Tsi DF Mini Player MP3 Module
- Kauj ruam 2:
- Kauj Ruam 3: Tswj DFMini Player Nrog Arduino
- Kauj ruam 4:
Video: Yuav Siv DFMini Player MP3 Module Nrog Arduino: 4 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:25
Ntau qhov haujlwm xav tau kev tsim suab kom ntxiv qee yam kev ua haujlwm. Ntawm cov phiaj xwm no, peb hais txog: kev nkag tau yooj yim rau cov neeg tsis pom kev, cov neeg siv nkauj MP3 thiab ua tiav lub suab los ntawm cov neeg hlau, piv txwv.
Hauv txhua qhov ntawm cov kab ke no, peb xav tau lub suab MP3 tsim tawm los txuas rau Arduino. Yog li ntawd, hauv kab lus no peb yuav kawm cov ntsiab lus hauv qab no: Kev pib ua haujlwm yooj yim ntawm DFMini Player MP3; Lub koom haum thiab teeb tsa cov ntaub ntawv suab ntawm daim npav nco; Tswj suab paj nruag nrog Arduino.
Khoom siv
PCBWay Custom PCB;
DFPlayer Mini MP3 Module - UTSOURCE;
10kR Resistor - UTSOURCE;
Hloov khawm - UTSOURCE;
Breadboard - UTSOURCE;
Arduino UNO - UTSOURCE;
Header Pin - UTSOURCE;
Kauj Ruam 1: Dab Tsi DF Mini Player MP3 Module
DFMini Player module yog lub tshuab ua suab paj nruag me me, qis nqi thiab lub zog qis uas muaj lub hom phiaj rov ua suab nrov khaws cia rau ntawm daim npav nco.
Raws li qhov no, tus qauv tuaj yeem tswj tau ntawm tus kheej ib leeg, uas yog, hauv hom no, yuav tsuas yog DFMini module, roj teeb rau lub zog, tus hais lus, khawm kom tswj nws thiab SD Card nrog cov nkauj. Lwm txoj hauv kev los tswj nws yog siv Arduino lossis lwm lub cuab yeej tswj.
Piv txwv li, Arduino yuav xa cov lus txib los ntawm kev sib txuas lus txuas nrog DFMini Player Module. DFMini Player module tau qhia hauv daim duab 1.
Txhawm rau tswj nws, nws yog ib qho tseem ceeb uas yuav tsum tau siv lub hauv paus ib leeg zuj zus. Lub voj voog no tau qhia hauv daim duab 2.
Ob lub nyees khawm qhia hauv kab lus saum toj no tau siv los hloov cov nkauj thiab tswj lub suab nrov. Qhov khawm txuas nrog tus pin IO1 yog siv los mus rau yav dhau los thiab txo lub ntim. Nrog qhov kov lub kaw lus nrawm rov qab rau zaj nkauj dhau los, txawm li cas los xij, yog tias koj nias lub pob ntau dua 1 thib ob, lub kaw lus yuav txo qhov ntim ntawm zaj nkauj.
Lub pob txuas nrog tus pin IO2 tau siv los mus rau qhov txuas ntxiv thiab nce ntim. Nrog kev kov lub kaw lus nrawm mus rau zaj nkauj tom ntej, txawm li cas los xij, yog tias koj nias lub pob ntau dua 1 thib ob, lub kaw lus yuav ua rau lub suab nkauj nce ntxiv.
Kauj ruam 2:
Hauv txoj hauv kev ib leeg, cov nkauj yuav tsum tau khaws tseg ntawm daim npav nco, raws li qhia hauv daim duab 3.
Txoj kev no, txhua lub sij hawm cov nyees khawm raug nias, lub kaw lus yuav ua si txhua zaj nkauj kom nce lossis nqis qis. Txawm li cas los xij, thaum siv Arduino lossis lwm lub cuab yeej tswj hwm, peb yuav tsum hloov kho txoj kev teeb tsa cov suab paj nruag cov ntaub ntawv ntawm SD Card.
Tam sim no, kuv yuav piav qhia yuav ua li cas tswj DFMini Player siv Arduino los ntawm kev sib txuas lus txuas.
Kauj Ruam 3: Tswj DFMini Player Nrog Arduino
Hauv cov kauj ruam no, kev tswj ntim, kev tswj hwm ntau yam, cov lus txib sib npaug thiab lwm yam yuav raug xa los ntawm Arduino.
Arduino yuav tsum sib txuas lus ntawm cov lej nrog DFMini Player thiab xa cov lus txib tswj.
Cov txheej txheem hluav taws xob ntawm kev tswj hluav taws xob tau qhia hauv daim duab 4.
Ua ntej, peb yuav tsum sib sau ua ke cov kab lus pom hauv daim duab hauv qab no. Tom qab sib dhos cov Circuit no, koj yuav tsum ntxiv cov nkauj ntawm koj daim npav nco. Hauv qib no, cov nkauj yuav tsum tau hloov pauv ua 01, 02, 03, piv txwv.
Koj tsis tuaj yeem tso cov nkauj nrog lawv cov npe, vim yuav muaj teeb meem thaum Arduino xa cov lus txib kom ua tiav txoj haujlwm tshwj xeeb. Yog li, koj yuav tsum teeb tsa raws li qhia hauv qab no.
Kauj ruam 4:
Tom qab npe cov ntaub ntawv, sau cov cai hauv qab no ntawm koj Arduino.
// Tos rau cov ntaub ntawv nkag ntawm serialwhile (Serial.available ()> 0) {hais kom ua = Serial.read (); if ((command> = '1') && (command <= '9')) {Serial.print ("Luam dua nkauj"); Serial.println (hais kom ua); hais kom ua = hais kom ua - 48; myDFPlayer.play (hais kom ua); menu_opcoes (); cov. } // Luam tawm // Nres yog (hais kom ua == 's') {myDFPlayer.stop (); Serial.println ("Music Stopped!"); menu_opcoes (); cov. } // Pausa/Txuas mus rau musica yog (hais kom ua == 'p') {pausa =! Pausa; yog (pausa == 0) {Serial.println ("Mus ntxiv …"); myDFPlayer.start (); } yog (pausa == 1) {Serial.println ("Music Paused!"); myDFPlayer.pause (); } menu_opcoes (); cov. }
// Nce ntim
yog (hais kom == '+') {myDFPlayer.volumeUp (); Serial.print ("Tam sim no ntim:"); Serial.println (myDFPlayer.readVolume ()); menu_opcoes (); cov. } yog (hais kom ua == '') {myDFPlayer.next (); Serial.println ("tom ntej:"); Serial.print ("Tam sim no khiav:"); Serial.println (myDFPlayer.readCurrentFileNumber ()+1); menu_opcoes (); cov. } // Txo ntim yog tias (hais kom ua == '-') {myDFPlayer.volumeDown (); Serial.print ("Ntim tam sim no:"); Serial.println (myDFPlayer.readVolume ()); menu_opcoes (); cov. }}} void menu_opcoes () {Serial.println (); Serial.println (F ("=========================================================== ====================================================================== ===================================== ")); Serial.println (F ("Commands:")); Serial.println (F ("[1-3] Txhawm rau xaiv cov ntawv MP3")); Serial.println (F ("[s] nres kev tsim tawm")); Serial.println (F ("[p] ncua/txuas ntxiv nkauj")); Serial.println (F ("[+ lossis -] nce lossis txo qhov ntim")); Serial.println (F (" mus tom ntej lossis rov qab taug qab")); Serial.println (); Serial.println (F ("=========================================================== ====================================================================== ==================================== ")); }
Cov cai uas tau hais los saum no yog qhov yooj yim heev thiab yuav pab koj xaiv cov nkauj los ntawm nws tus lej, nres, ncua, tswj lub ntim thiab hla txoj kab.
Kev tswj suab paj nruag suav nrog xa cov ntaub ntawv los ntawm Arduino IDE cov ntawv rau peb Arduino pawg thawj coj. Thaum xub thawj, cov txheej txheem ua rau kev teeb tsa hauv kev teeb tsa thiab txheeb xyuas yog tias SD Card tau muab tso rau hauv qhov qauv.
Yog tias nws tsis tau tso, lub kaw lus nthuav tawm cov lus ceeb toom rau tus neeg siv.
Ib qho ntxiv, lub kaw lus qhia cov lus nrog cov txheej txheem teeb tsa kev teeb tsa.
teeb tsa tsis muaj dab tsi () {// Comunicacao serial com o modulo mySoftwareSerial.begin (9600); // Inicializa serial do Arduino Serial.begin (115200); // Verifica se o modulo esta respondendo e se o // cartao SD foi encontrado Serial.println (); Serial.println (F ("DFRobot DFPlayer Mini")); Serial.println (F ("Pib DFPlayer module … Tos!")); yog (! myDFPlayer.begin (mySoftwareSerial)) {Serial.println (F ("Tsis tau pib ua:")); Serial.println (F ("1. Txheeb xyuas DFPlayer Mini sib txuas")); Serial.println (F ("2. Ntxig daim npav SD")); thaum (muaj tseeb); } Serial.println (); Serial.println (F ("DFPlayer Mini module pib ua!")); // Definicoes iniciais myDFPlayer.setTimeOut (500); // Timeout serial 500ms myDFPlayer.volume (5); // Ntim 5 myDFPlayer. EQ (0); // Equalizacao ib txwm menu_opcoes (); }
Yog tias daim npav nco tau ntxig, cov cai ntws yuav nkag mus rau lub voj ua haujlwm.
void loop () {// Tos rau cov ntaub ntawv nkag los ntawm cov lej thaum (Serial.available ()> 0) {hais kom ua = Serial.read (); if ((command> = '1') && (command <= '3')) {Serial.print ("Luam dua nkauj"); Serial.println (hais kom ua); hais kom ua = hais kom ua - 48; myDFPlayer.play (hais kom ua); menu_opcoes (); cov. } // Luam tawm // Nres yog (hais kom ua == 's') {myDFPlayer.stop (); Serial.println ("Music Stopped!"); menu_opcoes (); cov. } // Pausa/Txuas mus rau musica yog (hais kom ua == 'p') {pausa =! Pausa; yog (pausa == 0) {Serial.println ("Mus ntxiv …"); myDFPlayer.start (); } yog (pausa == 1) {Serial.println ("Music Paused!"); myDFPlayer.pause (); } menu_opcoes (); }
// Nce ntim
yog (hais kom == '+') {myDFPlayer.volumeUp (); Serial.print ("Tam sim no ntim:"); Serial.println (myDFPlayer.readVolume ()); menu_opcoes (); cov. } yog (hais kom ua == '') {myDFPlayer.next (); Serial.println ("tom ntej:"); Serial.print ("Tam sim no khiav:"); Serial.println (myDFPlayer.readCurrentFileNumber ()+1); menu_opcoes (); cov. } // Txo ntim yog tias (hais kom ua == '-') {myDFPlayer.volumeDown (); Serial.print ("Ntim tam sim no:"); Serial.println (myDFPlayer.readVolume ()); menu_opcoes (); cov. }}}
Tus neeg siv tuaj yeem xa cov cim tswj hauv qab no:
Zauv 1 txog 3: Xaiv zaj nkauj los ua si;
- Tsab ntawv s: Nres zaj nkauj; Tsab ntawv p: ncua zaj nkauj;
- Xa qhov + kos npe: Ua kom lub suab nkauj nce ntxiv;
- Xa lub - teeb liab: Txo qhov ntim nkauj;
- Xa lub teeb liab <: Xaiv zaj nkauj dhau los;
- Xa lub teeb liab>: Xaiv zaj nkauj tom ntej;
Los ntawm cov cim no, cov tsiaj ntawv, thiab tus lej, Arduino yuav tau txais lawv ntawm cov lej thiab yuav tswj cov nkauj kom ua si.
Txhua qhov xwm txheej tau nthuav tawm hauv qab no thiab sab hauv, nrog nws cov lus txib.
if ((command> = '1') && (command <= '3')) {Serial.print ("Luam dua nkauj"); Serial.println (hais kom ua); hais kom ua = hais kom ua - 48; myDFPlayer.play (hais kom ua); menu_opcoes (); cov. } // Luam tawm // Nres yog (hais kom ua == 's') {myDFPlayer.stop (); Serial.println ("Music Stopped!"); menu_opcoes (); cov. } // Pausa/Txuas mus rau musica yog (hais kom ua == 'p') {pausa =! Pausa; yog (pausa == 0) {Serial.println ("Mus ntxiv …"); myDFPlayer.start (); } yog (pausa == 1) {Serial.println ("Music Paused!"); myDFPlayer.pause (); } menu_opcoes (); }
// Nce ntim
yog (hais kom == '+') {myDFPlayer.volumeUp (); Serial.print ("Tam sim no ntim:"); Serial.println (myDFPlayer.readVolume ()); menu_opcoes (); cov. } yog (hais kom ua == '') {myDFPlayer.next (); Serial.println ("tom ntej:"); Serial.print ("Tam sim no khiav:"); Serial.println (myDFPlayer.readCurrentFileNumber ()+1); menu_opcoes (); cov. } // Txo ntim yog (hais kom ua == '-') {myDFPlayer.volumeDown (); Serial.print ("Ntim tam sim no:"); Serial.println (myDFPlayer.readVolume ()); menu_opcoes (); cov. }}
Yog li, yog tias koj ua ntawv thov txhua qib uas tau nthuav tawm, koj muaj peev xwm kawm tau:
- Kev pib ua haujlwm yooj yim ntawm DFMini Player MP3;
- Lub koom haum thiab teeb tsa cov ntaub ntawv suab ntawm daim npav nco;
- Kev tswj suab paj nruas nrog Arduino. From tus lej no, koj tuaj yeem txhim kho lwm txoj haujlwm uas xav tau siv lub suab ua lub luag haujlwm.
Kev lees paub
Kom ua tiav, peb ua tsaug rau koj kev nyeem ntawv thiab kev txhawb nqa ntawm PCBWAY. COM rau kev txhawb nqa Silício Lab hauv kev tsim cov kab lus no rau koj.
Silícios Lab ua tsaug UTSOURCE los muab cov khoom siv hluav taws xob los tsim cov phiaj xwm no.
Pom zoo:
Yuav Ua Li Cas MP3 Player Nrog LCD Siv Arduino thiab DFPlayer Mini MP3 Player Module: 6 Kauj Ruam
Yuav Ua Li Cas MP3 Player Nrog LCD Siv Arduino thiab DFPlayer Mini MP3 Player Module: Hnub no peb yuav ua MP3 player nrog LCD siv Arduino thiab DFPlayer mini MP3 Player Module. thiab ua si zoo ib yam li lub cuab yeej 10 xyoo dhau los. Thiab nws tseem muaj nkauj yav dhau los thiab nkauj tom ntej lom zem
Txawb Xov Tooj Siv Yooj Yim Siv STM32F407 Cov Khoom Siv Tshawb Pom thiab GSM A6 Module: 14 Cov Kauj Ruam (nrog Duab)
Kev Siv Xov Tooj Ntawm Lub Xov Tooj Siv STM32F407 Cov Khoom Siv Tshawb Pom thiab GSM A6 Module: Koj puas tau xav tsim qhov kev ua kom txias txias? Yog tias yog, ua li cas txog kev tsim ib qho ntawm cov neeg nyiam tshaj plaws thiab txhua tus nyiam cov khoom siv xws li Lub Xov Tooj Txawb !!!. Hauv Cov Lus Qhia no, Kuv yuav qhia koj yuav tsim lub xov tooj txawb yooj yim siv STM li cas
Kev teeb tsa Matrix LED hauv Cov Khoom Siv Hluav Taws Xob qub - Yuav Tsum Tau Cov Khoom Siv: 3 Cov Kauj Ruam (nrog Duab)
Kev teeb tsa Matrix LED hauv Cov Khoom Siv Hluav Taws Xob qub - Yuav Tsum Tau Siv Cov Khoom Siv: Lub teeb pom kev zoo los ntawm lub Windows PC dhau Bluetooth thiab LED cov txheej txheem nthuav tawm Ib co piv txwv ntawm pixel kos duab thiab cov duab ua haujlwm khiav ntawm LED Cov Ntsiab Lus ntawm PIXEL Guts Kit Hauv Cov Lus Qhia no, peb ' yuav
Yuav Siv TCRT5000 IR Sensor Module Nrog Arduino UNO: 7 Cov Kauj Ruam (nrog Duab)
Yuav Siv TCRT5000 IR Sensor Module Nrog Arduino UNO: Hauv qhov kev qhia no, peb yuav qhia koj qee qhov pib ntawm kev siv TCRT5000 IR Sensor Module. Cov hauv paus no tau qhia koj txog qhov sib piv thiab cov txiaj ntsig ntawm tus lej saib xyuas. Cov lus piav qhia: Qhov ntsuas hluav taws xob IR no siv TCRT5000 txhawm rau txheeb xyuas cov xim thiab
Tswj Cov Khoom Siv Los Ntawm Arduino Nrog Cov Neeg Siv Khoom Hloov: 8 Cov Kauj Ruam (nrog Duab)
Kev Tswj Cov Khoom Siv Los Ntawm Arduino Nrog Kev Siv Hluav Taws Xob: Lub Arduino tuaj yeem siv los tswj cov cuab yeej los ntawm kev siv cov khoom siv yooj yim hloov pauv hloov chaw