logo elektroda
logo elektroda
X
logo elektroda

Internet radio and audio file player on ESP32-S3

MAJSTER XXL 100383 1227
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #481 21411347
    robgold
    Level 20  
    New file - update 3.14 on GitHub: Link

    changes from the previous version:
    - under the Src button added full-screen clock mode
    - calendar option, day of the week, month on the clock screen
    - "scroller" scrolls through station number, station name and station stream at the bottom of the clock
    - selection of banks 1-10 in the Bank menu using buttons 1-0 (0 means 10 bank)
    - reduction of the display brightness with the OK/Direct button
    - additional screen refresh of 200ms after a station change to eliminate artefacts (seems to be working fine so far)
    - option to mute completely "MUTE" under the CmdMute (ATT) button
    - option to select with remote control to read/update a given bank from SD card/GitHub server
  • ADVERTISEMENT
  • #482 21411385
    DJCheester
    Level 26  
    Hello I haven't checked the card reader, I will see, but it's not likely to be replaced very often, i.e. the card.

    Once loaded files will be for a long time, at most I will correct the position of the reader relative to the edge of the board.

    Gentlemen, software updates are springing up like mushrooms after the rain 😀 .

    I'm already looking forward to running my version of the radio, only dilemma is which soft will end up in the radio, I think I'll buy a second ESP and load both - changing the module is a snap.

    Keep it up, regards....
  • #483 21411969
    tytka
    Level 22  
    DJCheester wrote:
    PCB this version just an overview now I will improve it to make it the best it can be.


    I would suggest including more secure mounts for the SD card adapter module. If you only mount it on solder pins (located so unhappily), without more secure supports, this will not have sufficient mechanical rigidity, so that after a while the solders can let go and problems arise.

    By the way. How are you going to power this board of yours? Is any of the visible on the board, a power connector, or are you going to power it via the USB connector on the ESP module ? (I ask out of curiosity, because the latter option is suggested by the location of the ESP module on your board).
  • #484 21412084
    DJCheester
    Level 26  
    Under the ESP I'll most likely add a USB printer square socket and that's what I'll power, as for the card module, for the time being the prototype is most likely to fix the card on the front and here goes the duct tape.

    Regards...
  • #485 21412399
    tytka
    Level 22  
    And you think this board must/should be powered by a USB connector?
    In my opinion, if the SD adapter ultimately, will be somewhere else, and why reserve space for it on this board, the connector itself will suffice.
  • #486 21412419
    DJCheester
    Level 26  
    The board is universal, so there is room for an adapter just in this place so that it can be mounted immediately, you can also mount the JST 6pin socket raster 2.54 and with a cable to connect where you want, it is done for uniqueness, at startup probably will be useful direct connection later you can change, although probably will remain in this place adapter has mounting holes for distances 2mm and you can additionally fix it. Besides, the card will not be changed often.

    The same is true for the ESP, a module with a mini/microUSB socket is planned and a USB printer socket will already be coded directly into the board.

    Of course, you choose what you want and only mount one.

    Best regards...
  • ADVERTISEMENT
  • #487 21412660
    hevet
    Level 16  
    @robgold I have uploaded your latest version, two cosmetic things:
    Instead of a small ź it displays ¶

    Screen display showing a music player with radio, artist, and track information, with colorful wires in the background.

    The second thing, the clock overlaps the bank number information. You need to change the value from 201 to 208.
  • ADVERTISEMENT
  • #488 21412739
    robgold
    Level 20  
    @hevet,
    Corrected already after the release on GitHub.
    Thanks, I've already caught that too. The value x=203 for the second hand, the full clock has x=208.
    This missing "ź" is unfortunately most likely related to the Disco station. I also caught this error once, I will have to check it further in my free time, but it seems to me that it is a wrong character encoding on the station side. If I succeed, I will check it before uploading the first version of 3.15. If not, it will be in some iteration of 3.15.
  • #489 21412756
    hevet
    Level 16  
    @robgold possible, but ź converted to ¶ seen still at another station.
  • #490 21412775
    robgold
    Level 20  
    >>21412756 .
    I return the honour, indeed something is wrongly assigned:
    code C5 -> case (char)0x9B: text.setCharAt(i, 0x9C); break; // Converted to "¶" and should be ź
    You need to replace code 9C with 9F at the letter ś. Type from your finger for now for tests for case (char)0xC5:

    Screenshot showing hexadecimal data with the code C5 9B highlighted in red. .
    Code snippet showing character replacement instructions with comments. .
    Screenshot showing a character editor and bitmap for the letter ś in a character table. .
  • #491 21412812
    hevet
    Level 16  
    Ok, I've done it, I'll watch to see if it helped.

    Added after 2 [hours] 59 [minutes]: .

    @robgold now showed ź instead of ¶.
    Electronic display showing information about the Radio Disco station and the song Daj To Głośniej - Zwariowana.
  • ADVERTISEMENT
  • #492 21413196
    robgold
    Level 20  
    This is exactly what I wrote. The charms of Unicode.
    The word "louder" is 67 C5 82 6F C5 9B 6E 69 65 6A

    The question is what to replace the C5 9B characters with when, according to the table, both letters have the same code in UTF-8.
    I would go back to "ś" however "ź" is relatively less frequent.

    @MAJSTER XXL
    back to playing around with Polish diacritical marks, maybe you can advise something.

    Table of Polish diacritic character codes in various standards.
  • #493 21413253
    khoam
    Level 42  
    robgold wrote:
    Question on what to replace C5 9B characters with when according to the table both letters have the same code in UTF-8.
    .
    The attached table shows that these are two different codes: C5 B9 and C5 9B.
  • #494 21413275
    robgold
    Level 20  
    Too much in front of the computer today. At work, after work.... thanks. Corrected. Letter: "ź" is C5 BA

    In that case, in the tables we have, this character was not there. It needs to be added:
    case (char)0xBA: text.setCharAt(i, 0x9F); break;  // Zamiana na "ź"
    .
  • #495 21413353
    Szaryczlowiek83
    Level 7  
    Sorry to butt in.... But would there be a chance to add a web interface like for example. Link


    .

    Maybe I'll elaborate: I have a sencor sss1250 speaker and in the near future I'll have to open it up and replace the Aku because they hold a max of 4h and I was wondering if I shouldn't just put an esp32 in there with the radio right when replacing it.
    The speaker has an AUX input and an additional USB port (can be used as a powerbank). The only 2 things stopping me from doing it right away are the lack of space for any display and the banks stored on the card.
  • #496 21413370
    robgold
    Level 20  
    @sharyczlowiek83

    Anything can be done just time, tests, skills.
    Looking at when that project was created "23-may-2017: First release, derived from ESP8266 version" there is a long way to go ;) .
    At the moment there is a very but very simplified web page in the Evo version "fired up" on a test basis. If there is time, I will work on it.


    Screenshot of ESP32 Internet Radio interface with a list of radio stations and control options. .
  • #497 21413869
    tytka
    Level 22  
    Szaryczlowiek83 wrote:
    no space for any display and banks stored on the card.


    No problem.
    There is an internet radio project (already mentioned in this thread) that provides many options. You don't have to use a display or card in it. Stations are stored in the internal memory of the ESP module, full operation via a generated page, and possibly in addition but partially from the remote control.

    This project, here described (and being developed) is somewhat interesting, but still at the construction stage.

    MAJSTER XXL wrote:
    I am considering moving the handling of the entire file player to a separate file, so that it is easier to control visually.
    .

    In my opinion this is a very good idea.
  • #498 21414328
    robgold
    Level 20  
    @MAJSTER XXL

    I saw that you changed the pulse definition in the description from 690 to 560us in your ino file. I have started to explore this topic of the NEC protocol. Some sources give the duration of the shorter pulse as 1.25ms others 1.12ms. I finally measured it because it was bothering me, maybe it will be useful to someone else. It turns out that the short pulse (0) actually lasts 1.12ms.
    My analyser unfortunately proved too slow I had to reach for an oscilloscope ;) .

    Results from measurements:
    pulse 9ms came out almost 9ms -> 8.996ms
    pulse 4.5ms -> 4.604ms
    pulse 1.690 -> 1.696ms
    pulse 560us -> 619.52us
    signal "0" -> 1.13ms - exits symmetrically at 560us
    signal "1"-> 2.2ms

    I am uploading the oscillograms. This is to close the topic of the IR remote control.

    Oscillogram of IR signal showing pulse waveform. .
    Oscilloscope signal of IR remote with time and voltage values. .
    Oscilloscope signal display showing various time parameters. .
    Oscillogram of NEC protocol signal .
    Oscillogram showing signals with durations of 16.9ms, 16.3ms, and 619.52us. .
    Oscillogram showing signals in the NEC protocol. .
    Oscillogram of NEC protocol signals on an oscilloscope screen. .
  • #499 21414340
    hevet
    Level 16  
    In the latest version 3.14, the const int TOLERANCE = 120 is changed;
    .I had to go back to 160 because my remote practically stopped working, maybe once in 10 presses something caught.
    As for the Polish characters it is to stay as it was case (char)0x9B: text.setCharAt(i, 0x9C: break and add
    case (char)0xBA: text.setCharAt(i, 0x9F); break; // Converted to "ź"?
  • #500 21414384
    robgold
    Level 20  
    @hevet
    On the terminal you have a "debugger" which means debug pulses. Click on the remote a few times and see if all pulses are not holding the value or just one. Sometimes it is better to change the threshold for a given pulse than to raise the whole tolerance.

    NEC code OK:9D62A857 MSB-LSB: EA1546B9 ADR:B9 CMD:15
    debug-- pulse 9ms:8945 4.5ms:4628 1690us:1745 690us:646

    Yes, we leave the block "C5" as it was and add at the end the definition for "ź"

    case (char)0xC5:
            switch (text[i + 1]) {
              case (char)0x82: text.setCharAt(i, 0xB3); break;  // Zamiana na "ł" Unicode UTF-8
              case (char)0x84: text.setCharAt(i, 0xF1); break;  // Zamiana na "ń" Unicode UTF-8
              case (char)0x9B: text.setCharAt(i, 0x9C); break;  // Zamiana na "ź" Unicode UTF-8
              case (char)0xBB: text.setCharAt(i, 0xAF); break;  // Zamiana na "Ż" Unicode UTF-8
              case (char)0xBC: text.setCharAt(i, 0xBF); break;  // Zamiana na "ż" Unicode UTF-8
              case (char)0x83: text.setCharAt(i, 0xD1); break;  // Zamiana na "Ń" Unicode UTF-8
              case (char)0x9A: text.setCharAt(i, 0x97); break;  // Zamiana na "Ś" Unicode UTF-8
              case (char)0x81: text.setCharAt(i, 0xA3); break;  // Zamiana na "Ł" Unicode UTF-8
              case (char)0xB9: text.setCharAt(i, 0xAC); break;  // Zamiana na "Ź" Unicode UTF-8
              case (char)0xBA: text.setCharAt(i, 0x9F); break;  // Zamiana na "ź" Unicode UTF-8
            }
  • #501 21414508
    MAJSTER XXL
    Level 29  
    @robgold I'm fine-tuning the file player all the time, it's getting better in terms of free selection of folders and files from the scrolling lists on the screen, I'm most focused on getting it to work properly from the remote, so it may be that I'm misrepresenting something from the encoder. I have already noticed some problems with my ESP32 module- I suspect it is falling down. Symptoms are some sudden reboots when playing high bitrate MP3s (probably the most common), on FLACs most of the time, worst that and on radio with MP3s. I used to have this too, and literally after inserting a new ESP32 the problem stopped like a hand off. If anyone can diagnose the cause I'll be collecting logs from Backtrace, I'll be putting in a new ESP32 at the weekend to try it out.
    I've noticed another annoyance, when during file playback any decoder chokes for a while and after a fraction of a second it continues to play (maybe already a problem with my SD card) then on the serial sometimes no info from the Audio library about the end of file playback appears and I don't have a flag to flip to the next file, thus silence continues and the seconds counter beeps. I'm thinking of pulling the file time from the ID3 metadata, and as it passes without the current flag appearing, to also flip IndexFile forward 1.
    As for the correctness of the pulses, my remote from some Auna radio works very steadily:

    Code: C / C++
    Log in, to see the code
    .
  • #502 21414558
    hevet
    Level 16  
    These are my values

    Volume value: 13
    debug-- Time2 - Time1 = 60
    debug-- Stack control:5308
    NEC code OK:FFA857 MSB-LSB: EA15FF00 ADR:0 CMD:15
    debug-- Pulse 9ms:8997 4.5ms:4446 1690us:1623 690us:520
    Volume value: 12
    debug-- Time2 - Time1 = 59
    debug-- Stack check:5308
    NEC code OK:FFA857 MSB-LSB: EA15FF00 ADR:0 CMD:15
    debug-- Pulse 9ms:9000 4.5ms:4446 1690us:1617 690us:521
    Volume value: 11
    debug-- Time2 - Time1 = 69
    debug-- Stack check:5308
    NEC code OK:FFA857 MSB-LSB: EA15FF00 ADR:0 CMD:15
    debug-- Pulse 9ms:8997 4.5ms:4451 1690us:1620 690us:519
    Volume value: 10
    debug-- Time2 - Time1 = 62
    debug-- Stack check:5308
  • #503 21414589
    robgold
    Level 20  
    Code: C / C++
    Log in, to see the code
    @hevet

    wartość do dyskryminatora ustawione są jak poniżej:
    const int LEAD_HIGH = 9000; // 9 ms sygnał wysoki (początkowy)
    const int LEAD_LOW = 4600; // 4,5 ms sygnał niski (początkowy)
    const int TOLERANCE = 120; // Tolerancja (w mikrosekundach)
    const int HIGH_THRESHOLD = 1690; // Sygnał "1"
    const int LOW_THRESHOLD = 600;//560; // Sygnał "0"

    Twój odczyt:
    9ms: 9000
    4.5ms:4446 (ustawiony jest na 4600 a to już poza granicą)
    1690us:1617
    690us:521 (ustawiony na 600)

    Nie mieścisz się z pulsem 4,5ms. Zmień wartość na 4500 i zostaw Tolerance na 120. Powinno działać.

    @MAJSTER XXL
    zmieniałeś sobie buffor dla plików FLAC w bibliotece "audio.h" tak jak autor biblioteki poleca ? Przy pamięci PSRAM zalecane jest zwiększenie tego bufora.
    Code: C / C++
    Log in, to see the code
    .

    you have some big stack value, did you change the standard Arduino settings ?
    The standard is 8k

    It's hard to "mess with" the ESP. I use one like an emulator, I think it has thousands of programming cycles and it works.
    What else can go wrong there except the FLASH memory. At most, it will be soldered out and replaced with a new one.
  • #504 21414625
    hevet
    Level 16  
    robgold wrote:
    You are not measuring with a pulse of 4.5ms. Change the value to 4500 and leave the Tolerance at 120. It should work.
    .
    I've set it and it looks like it's working, thanks :) .
  • #505 21414665
    wirbud
    Level 13  
    >>21413353 if you want a fantastic web interface, free, self-contained recording of remote control keys (NEC - 38kHz) then yoRadio is the answer. It's a well-developed and well-thought-out radio - with superb control also from the web level. Including editing of station lists, import and export. Everything except the alarm clock ;-) I tried to compile the projects of my colleague Majster and robgold, but I couldn't manage with the libraries. There is a large group on FB at yoradio. I have already run 3 radios including the SSD1322 I bought for this project.

    Digital radio display showing 21:20 and connecting to Polish Radio Drivers, with a computer screen in the background. .
  • #506 21415424
    rp02
    Level 2  
    reverence,

    I have three questions about the project:
    - how is it possible to save permanently your own station or bank of e.g. 11, which we would like to listen to, apart from the list of items downloaded to sd card from github (Robgold) ?
    - do you plan to connect speaker via bluetooth in future (Robgold, Majster XXL) ?
    - the possibility of dimming the oled display (especially at night) or a screensaver in the form of a watch would also be welcome.

    p.s. The project is great and I am rooting for you.
  • #507 21415431
    hevet
    Level 16  
    @robgold has introduced a feature to dim the display from the remote control.
  • #508 21415746
    robgold
    Level 20  
    @rp02

    - Each bank in Evo is always written to the SD card and later read from it, unless you force a re-download from the GitHub server with a remote or second encoder. So, once you've downloaded all the banks (just switch once to each bank) you can edit any of the 16 banks on the card (they're regular TXT files) and keep your favourite stations there. Just be sure to keep the format.

    I'm working on sorting out these banks because a lot of stations don't work, I'd like to sort it all out.
    I'm also trying to swap links from remote stations broadcasting in 320k or FLAC to ones like 192, 128kbps and direct to servers.

    - For the time being, there are no plans to add audio transmission via bluetooth.
    - Display dimming is in the last version of Evo 3.14 and will be standard in Evo 3.15. There will also be a few new features. Work in progress :) .
  • #509 21415966
    rp02
    Level 2  
    thank you for the information.

    Are the wiring diagrams of the two versions identical and do they differ in the charge for esp32s3?
  • #510 21415982
    DJCheester
    Level 26  
    As far as I know this is how I am designing the PCB so far I have added ir and a USB printer socket to power the whole, pcb not yet worked out all modules will be on goldpins as below


    Visualization of a designed PCB with an ESP32-S3-WROOM-1 module and various components.
    Close-up view of a green PCB with circuit traces and solder points. .

    Unless I am unaware of something.

    We will wait to hear from the authors of the two versions i.e. MAJSTRA and robgold.

    Greetings ...

Topic summary

The discussion revolves around building an internet radio and audio file player using the ESP32-S3 microcontroller. The project includes features such as an OLED display, Wi-Fi connectivity, and audio playback capabilities. Users share their experiences with hardware setup, including issues with pin configurations, library compatibility, and troubleshooting compilation errors in the Arduino IDE. Suggestions for libraries, such as ESP32-audioI2S and WiFiManager, are provided to enhance functionality. Participants also discuss the importance of proper wiring, capacitor usage for encoders, and the potential for adding features like DLNA support and a web management interface for radio station management. Several users report on their progress, share code snippets, and offer solutions to common problems encountered during development.
Summary generated by the language model.
ADVERTISEMENT