Cov txheej txheem:

ESP32 Audio Player: 6 Kauj Ruam (nrog Duab)
ESP32 Audio Player: 6 Kauj Ruam (nrog Duab)

Video: ESP32 Audio Player: 6 Kauj Ruam (nrog Duab)

Video: ESP32 Audio Player: 6 Kauj Ruam (nrog Duab)
Video: WLED Sound Reactive - ESP32 WROOM с микрофоном, добавляем функцию светомузыки 2024, Hlis ntuj nqeg
Anonim
ESP32 Audio Player
ESP32 Audio Player

Vim muaj tus kabmob sib kis, Kuv tau siv sijhawm nyob hauv tsev ntau dua li ib txwm nyob rau rau lub hlis dhau los. Nws yog qhov tsis yooj yim sua uas ib tus neeg yuav nkees nyob hauv tsev, yog li kuv tau ua lub suab nrog ESP32 kom dhau sijhawm. ESP32 tuaj yeem siv ua lub kaw lus ywj pheej los khiav cov ntawv thov, tsuas yog ntsaws rau hauv kab, txuas lub cuab yeej, thiab teeb tsa nws. Nrog rub tawm cov haujlwm sib txawv, cov neeg ua si tuaj yeem paub SD daim npav ua suab paj nruag ua haujlwm, Internet muaj nuj nqi hauv xov tooj cua, thiab suab paj nruag tswb muaj nuj nqi.

Tam sim no kuv xav qhia kuv cov txiaj ntsig thiab qhia koj yuav ua li cas.

Khoom siv

Kho vajtse:

  1. MakePython ESP32 (WROVER, koj tuaj yeem tau txais nws los ntawm qhov txuas no:
  2. MakePython Audio (koj tuaj yeem tau txais nws los ntawm qhov txuas no:
  3. Micro SD daim npav
  4. USB cable
  5. Suab/lub mloog pob ntseg nrog 3.5mm suab txuas

Software:

  1. Arduino IDE Cov
  2. Rub tawm nkauj (.mp3 lossis.wav) rau SD daim npav.

Kauj ruam 1: Kev sib txuas

Kev sib txuas
Kev sib txuas
Kev sib txuas
Kev sib txuas

Txuas ob lub laug cam raws li tus pin. VCC txuas nrog 3v3

Kauj Ruam 2: Ib puag ncig Programming

Txhawb ESP32

Ua raws li Cov Lus Qhia Txhim Kho ntxiv ESP32 kev txhawb nqa yog tias koj tseem tsis tau ua nws:

github.com/espressif/arduino-esp32

Nruab Tsev Qiv Ntawv

  1. Adafruit SSD1306 thiab cov tsev qiv ntawv nyob.
  2. ESP32-audioI2S.

Koj tuaj yeem tau txais cov ntawv zip los ntawm Github:

github.com/Makerfabs/Project_MakePython_Audio_Music

Unzip cov ntaub ntawv no. Qhib koj Arduino IDE thiab mus rau Sketch> suav nrog Tsev Qiv Ntawv> Tswj Tsev Qiv Ntawv> Ntxiv. ZIP Library.

Tom qab ntawd qhib daim nplaub tshev: "\ Project_MakePython_Audio_Music / old-src / esp32_mp3 / ESP32-audioI2S". Thiab koj yuav pom qhov hais kom sai uas lub tsev qiv ntawv teeb tsa tiav.

Kauj Ruam 3: Txog Txoj Cai

Suab Ua Si

  • Qhib cov ntaub ntawv "/Project_MakePython_Audio_Music/music_player.ino". Koj tuaj yeem tau txais txoj cai los ntawm Github:
  • Lus ceeb toom: MicroPython Audio tuaj yeem rub tawm yam tsis tau ntsaws. Thaum rub tawm qhov program, thov tig qhov hloov pauv tom ntej ntawm 3.5mm Audio interface rau lub Suab ntsaws rau rub tawm ua tiav.

  • Hloov kho lossis ntxiv cov ntawv hauv cov zaub.

void lcd_text (Cov ntawv hlua)

Hloov qhov ntim thawj zaug:

audio.setPinout (I2S_BCLK, I2S_LRC, I2S_DOUT);

audio.setVolume (14); 0… 21…

Hloov nkauj:

yog (digitalRead (Pin_next) == 0)

{Serial.println ("Pin_next"); yog (file_index 0) file_index--; lwm file_index = file_num - 1; open_new_song (file_list [file_index]); print_song_time (); button_time = millis (); }

Upload cov cai

Web Xov tooj cua

  • Koj tuaj yeem tau txais cov cai los ntawm qhov txuas:
  • Lub vev xaib xov tooj cua xav tau txuas rau Is Taws Nem, koj yuav tsum hloov pauv WIFI cov ntaub ntawv.

const char *ssid = "Makerfabs";

const char *password = "20160704";

Ntxiv, rho tawm lossis hloov kho xov tooj cua chaw nyob hauv cov cai hauv qab no:

Txoj hlua noj = {

"0n-80s.radionetz.de: 8000/0n-70s.mp3", "mediaserv30.live-streams.nl:8000/stream", "www.surfmusic.de/m3u/100-5-das-hitradio, 4529.m3u "," stream.1a-webradio.de/deutsch/mp3-128/vtuner-1a "," mp3.ffh.de/radioffh/hqlivestream.aac ", // 128k aac" www.antenne.de/webradio /antenne.m3u "," listen.rusongs.ru/ru-mp3-128 "," edge.audio.3qsdn.com/senderkw-mp3 "," macslons-irish-pub-radio.com/media.asx "};

Txuas mus rau lub vev xaib xov tooj cua:

tsis muaj dab tsi open_new_radio (String station)

{audio.connecttohost (chaw nres tsheb);

Tswb

  • Koj tuaj yeem tau txais cov cai los ntawm no:
  • hloov lub tswb sijhawm hauv cov cai hauv qab no:

const char *ntpServer = "120.25.108.11";

const ntev gmtOffset_sec = 8 * 60 * 60; // Tuam Tshoj+8 const int daylightOffset_sec = 0; Txoj hlua clock_time = "17:39:00"; Txoj hlua clock_time2 = "17:42:00";

Pib thiab tau txais lub sijhawm , thiab "gmtOffset" tau siv los teeb tsa thaj tsam sijhawm

// pib thiab tau txais lub sijhawm

configTime (gmtOffset_sec, daylightOffset_sec, ntpServer); Serial.println (F ("Nyeem tau npt lub sijhawm."));

Hloov kho lub tswb moos suab paj nruag:

void lub voj ()

{printLocalTime (); audio.loop (); yog (millis () - button_time> 600) {yog (tswb_flag == 0) {yog (showtime ()! = 0) {open_new_song ("clock.wav"); tswb_flag = 1; display.setCursor (0, 24); display.println ("TSUAS !!!!!"); display.display (); ncua (1000); button_time = millis (); }}

Kauj ruam 4: Case

Case
Case

Cov ntaub ntawv tuaj yeem tau txais los ntawm:

www.makerfabs.com/esp32-audio-fixture-kit.html

3D tsim

tsim rooj plaub raws li koj nyiam. Yog tias tsis xav tsim nws ib ntus, koj tuaj yeem tau txais cov ntawv tsim los ntawm no:

github.com/Makerfabs/Project_MakePython_Audio_Music

3D luam ntawv

Hloov koj cov ntawv luam tawm mus rau lub tshuab luam ntawv siv daim npav SD. 3D luam ntawv tuaj yeem ua tiav cov ntaub ntawv tsim tawm sai.

Los ua ke

Sib dhos rooj plaub thiab ob lub laug cam, thiab koj tuaj yeem tau txais lub suab tshiab.

Kauj ruam 5: Kev ua haujlwm

Kev ua haujlwm
Kev ua haujlwm
  • Fais fab ESP32 ntawm Micro USB thiab lub vijtsam LCD qhia cov ntaub ntawv yooj yim ntawm zaj nkauj.
  • Sab laug sab laug tuaj yeem hloov nkauj lossis channel xov tooj cua, thiab nias sab hauv kom ncua kev ua si.
  • Kev hloov pauv ntawm sab laug tuaj yeem ua rau nce lossis txo lub ntim, nias sab hauv kom kaw lossis nres lub tswb.

Pom zoo: