logo elektroda
logo elektroda
X
logo elektroda

Internet radio and audio file player on ESP32-S3

MAJSTER XXL 100866 1227
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1111 21512505
    simw
    Level 27  
    Changing parameters, SD preview, changing volume yes.

    Added after 30 [minutes]:

    robgold wrote:
    OK, delete the configuration files, last station file, last bank file, generally try with a clean card.
    .
    I've done this before, I wrote above about formatting the SD card.
    I have now fired up yet another test board. Also here after removing the card.
    I have now uploaded the icons, but this has not changed anything.
    To summarise:
    - when clicking on the station, only the bar with the Volume value shows on the display.
    - after removing the card the change of the station starts to work correctly
    - formatting does not help.
  • ADVERTISEMENT
  • #1112 21512668
    robgold
    Level 20  
    In that case, I suspect you have an error in the definition of the remote codes - remote.txt file. The web server uses the remote code assigned to rcCmdOk to change stations.
    In your browser write: http://NUMER IP/update?station=21 instead of 21 you can give any other station number, You should get a station change and reply OK. If this does not happen then show the remote.txt file. When the card is missing the radio uses the settings stored in the program code for the rc-406 remote so everything works.
  • #1113 21512903
    simw
    Level 27  
    robgold wrote:
    In that case, I suspect you have an error in the definition of the remote control codes - the remote.txt file.
    .
    It turns out that there was no remote.txt file on the SD at all.
    It wasn't until the web upload that the station selection started working correctly.
    Shouldn't the remote.txt file be loaded onto the SD card by default if there isn't one there?
  • #1114 21513030
    DJCheester
    Level 26  
    Hello, today I uploaded the latest version (downloaded today) and left only on the arte remote with changed codes and icon files - uploaded the radio without encoder does not respond to buttons only vol+ works what is wrong the file looks like this

    Code: Text
    Log in, to see the code


    What am I doing wrong?

    Greetings ...

    Added after 5 [minutes]:

    And the serial keeps displaying a different button and different values even though I press VOL- all the time.

    Code: Text
    Log in, to see the code
  • ADVERTISEMENT
  • #1115 21513081
    robgold
    Level 20  
    @DJCheester you have an incorrectly defined remote.txt file. Every line in the correct file ends with a semicolon. The program recognises by this that it has read the code in question to the end. In your case, there is no semicolon anywhere.

    It must be like this:
    Code: C / C++
    Log in, to see the code
    .

    Instead of:
    Code: C / C++
    Log in, to see the code


    @simw this is the only file that won't generate itself because there's nothing to generate from but good point, I need to put in a safeguard so that the config array doesn't rewrite itself to null values if there's no remote.txt file. Thanks for catching this error.
  • #1116 21513130
    DJCheester
    Level 26  
    It works, thanks I hadn't noticed this important detail.

    Just a remark, on the main WEB radio a RADIO/ZEGAR button would be nice.

    I've just listened to the hour ticker, a nice feature but I want to disable it by default when switching on the radio.

    In the code it is implicitly responsible for this fragment ??

    bool timeVoiceInfoEveryHour = true;

    I think I can compile it like this

    bool timeVoiceInfoEveryHour = false;

    And in general, if this radio is already so extended, maybe an Alarm Clock ??
    And active and inactive mode (we assume that the ESP32 is constantly powered.
    A matter of stopping the stream and possibly some graphics when inactive for a certain time then blanking out

    That's my thoughts - I'm testing for now everything is working ;) .

    Greetings ...
  • #1117 21513141
    robgold
    Level 20  
    @DJCheester I don't really understand why you are changing the code and complicating things for yourself. In the CONFIG settings at the bottom of our options: Time Voice Info Every Hour. Set it to OFF and the radio will never tell you the time again. Also displayMode can be set permanently and you don't have to change anything on the remote control after switching on -> Display Mode (0-2), 0-Radio scroller, 1-Clock, 2-Three lines without scroll. From what I have seen you haven't run the configuration yet because the radio on the terminal reported a missing config.txt file. This is created when the configuration is first saved.

    A change in the code has a lower priority than the config file. The settings from the file always take precedence.
  • #1118 21513153
    DJCheester
    Level 26  
    Well, if the value is saved, there's nothing to change, so I've turned the chatterbox off,

    I'm just asking more out of curiosity.

    On the other hand, I often switch the clock RADIO and the remote control is not always at hand, sometimes I have the WEB open on my smartphone and the button on the main page would be useful for quick access.

    I know the configuration has already been tested and everything works fine.

    I asked about active and sleep mode because in my conversion I would also need it for the input selector.

    E.g. a variable like true false and when true the radio plays and false the radio does not play some graphics on the oled and then fades out.

    I am now slowly testing the keyboard, building it on a contactor before I mount the resistors on the PCB.

    Greetings ...
  • #1119 21513176
    hevet
    Level 16  
    @robgold my suggestion for a change in the code, after saving the configuration, automatic return to the home page after 3 seconds.

    Change
    request->send(200, "text/html", "<h1>Configuration Updated!</h1><a href=\"/\">Go Back</a>");
     saveConfig(); 

    to
    request->send(200, "text/html", R"rawliteral(
          <html>
            <head>
              <meta charset="UTF-8">
              <title>Updated</title>
              <script>
                let seconds = 3;
                function countdown() {
                  if (seconds > 0) {
                    document.getElementById("countdown").textContent = seconds;
                    seconds--;
                    setTimeout(countdown, 1000);
                  } else {
                    window.location.href = "/";
                  }
                }
                window.onload = countdown;
              </script>
            </head>
            <body style="font-family: sans-serif; text-align: center; padding-top: 50px;">
              <h1>Configuration Updated!</h1>
              <p>Redirecting to home in <span id="countdown">3</span> seconds...</p>
              <a href="/">Go Back Now</a>
            </body>
          </html>
        )rawliteral");
        
        saveConfig(); 
    .
  • #1120 21513184
    DJCheester
    Level 26  
    Robgold I built the keyboard according to the scheme

    Electrical schematic of a keyboard with resistors.

    I gave the resistors 1k because that's what I had - the voltage is evenly distributed between the resistors how to now start the measurement or when I select keyboard debug in the web options it shows me ON but on the OLED or on the serial monitor nothing happens.

    Greetings ...
  • #1121 21513192
    hevet
    Level 16  
    @DJCheester add in browser after IP address /adc
  • #1122 21513197
    DJCheester
    Level 26  
    Well I added and I have the thresholds I changed the neutral to 3850 because that's how much I have on the card created a file

    this is from the serial

    Code: Text
    Log in, to see the code



    and after pressing (shorting) the resistors the voltage on pin 9 changes but neither in the serial monitor nor on the OLED I have a reading ???
  • #1123 21513206
    hevet
    Level 16  
    Hold down the encoder button until the adc reading appears
  • #1124 21513211
    DJCheester
    Level 26  
    Good reading I have on the serial I did not include in the main configuration

    Now I have to make sense of it thank you ;)

    Greetings ...
  • #1125 21513293
    robgold
    Level 20  
    @DJCheester please check out this mode with the option to display ADC values on the OLED. I haven't tested this at my place yet so it would be nice if you could give it a test.
    You enable this on the ADC page by clicking on the debug ADC option.

    Screenshot of ADC threshold settings for keyboard buttons with an ADC Debug ON/OFF option. .


    I have added a Display Mode change. Sometimes I too missed it and the remote control is too far away. Still will probably add a button to make the hour say. Laziness driving development to the full ;) .

    ESP32 Web Radio interface with station selection and OLED display mode options.
  • ADVERTISEMENT
  • #1127 21513314
    robgold
    Level 20  
    True and you have to open your eyes to press the button anyway ;)
  • #1128 21513607
    Lechuuu
    Level 13  
    Does the audio jerk on some stations for you too? This applies to software v3.17.52 and v3.17.53 - > check random stations, e.g. bank 1 station 18 (radio note). On older soft v3.17.36 and earlier it is ok
  • #1130 21513634
    Lechuuu
    Level 13  
    Ok, I already know what the problem was.... in config I had set Radio Scroller Refresh Time (20-100ms) to 20 ms which was probably too low, I increased it and the problem went away
  • #1131 21513654
    robgold
    Level 20  
    @Lechuuu The two main changes between 3.17.36 and 52.53 are the change of the dimmer function and the separation of the Scroller and VU Metera functions. If you set the times too low the ESP unfortunately has to do a lot of operations. The software is somehow not super optimised. I currently have 40ms for the VU and 65ms for the Scroller. I will think about how to set it better. Perhaps I will set the VU Meter permanently and only the Scroller can be adjusted.
  • ADVERTISEMENT
  • #1132 21513938
    gabar5
    Level 12  
    I soldered everything off the Sony st-s120 board, added resistors. I have a reading of 4227, regardless of whether I plug in the 9 pin. After entering debug adc I have readings on every switch (jumping +/- 20), after saving new settings it doesn't work properly, i.e. I press auto - "7" appears, or dimmer works, other buttons work incorrectly or not at all.
  • #1133 21513966
    DJCheester
    Level 26  
    robgold wrote:
    please check this mode with the option to display ADC values on the OLED.


    Hi I only checked this on the serial monitor where or with what to enable the reading on the OLED.
    When debugging the ADC it changes very quickly on the serial monitor.

    robgold wrote:
    I added the Display Mode change. Sometimes I also missed it and the remote is too far away.
    .

    I also missed this ;) Thanks.

    Lechuuu wrote:
    Do you also get jerky audio on some stations? This applies to software v3.17.52 and v3.17.53


    It was jamming for me too but maybe because I was combining at the same time with the ADC

    gabar5 wrote:
    I have a reading of 4227, regardless of whether I plug in the 9 pin.


    I also get this reading when the ADC pin is hanging in the air.
    To make the ADC work properly on this pin stick a voltmeter in and the voltage should change there.
    For this to work there needs to be a resistor ladder and the switches cause the resistance to change

    I have this schematic and these resistor values, the keyboard works stably

    Circuit diagram of a resistor ladder with switches.

    The voltage spread at these values is about 0.15V for the next switch which on the ADC pretty much breaks down every 200 or so at readouts.

    With the keyboard from Sony you need to do exactly as in Robgold's photo, and be sure to replace the switches with new ones - the old ones sometimes have 200 ohms or more when pressed.

    In my case it's better because I have old disassembled switches and after wiping them they are like new.

    To keep the values stable it is worth closing the circuit with a 470k - 2.2M resistor to ground.

    The value 4227 doesn't bother me at all KeyboarButtonNeutral I have the maximum value of 4095.

    Actually, it's interesting, because a 12-bit converter should give just such a value of 4095, but I don't know where the higher value comes from.

    These are my ADC values

    Screenshot of ADC settings for ESP32 Radio with key thresholds. .

    Greetings ...
  • #1134 21514093
    gabar5
    Level 12  
    @DJCheester Thanks, I will replace the switches.
  • #1135 21514102
    DJCheester
    Level 26  
    Hello again I have a problem with updated via Web one value despite changes all update except this one.

    Table with keyboard button threshold settings, with one field marked with an orange circle showing the value 2040. .

    The value on the card remains the same despite typing and clicking update, only a manual change in a txt file and saving results in a change, i.e. reading is correct only writing to the cell does not work for me at least.

    But otherwise ok 😀 <br />

    Greetings ...

    Added after 1 [hours] 23 [minutes]:

    gabar5 wrote:
    Thanks, I'll replace the switches.


    Measure with an ohm meter first when pressed it should indicate a few ohms at most.

    See if you have wired the keyboard circuit correctly as even old switches should work and generate ADC thresholds.

    It's best to make a new PCB I'm just making a new one for my hardware then everything will be securely connected.


    Image of a green printed circuit board with several buttons and electronic components. .
    View of a printed circuit board with sockets and conductive traces on a blue background.

    After a correct reading you will have on the serial monitor

    Code: Text
    Log in, to see the code


    Oh and the issue of the keyboard test to start with I did it on a contact board and I don't recommend it because there were often different values due to the lack of good contact between the resistors.

    In the end I soldered resistors in series and short-circuited other points with ground, and such a circuit only started to work stably.

    A good connection is very important ...

    Best regards ...
  • #1136 21514411
    robgold
    Level 20  
    @gabar5 Have you replaced the buttons ? The old keys can give you a very high resistance and then the ranges overlap. I'm not saying that this keyboard works perfectly, but it really catches very few such erroneous keys. In fact, it sometimes happened to me on the digits.

    @DJCheester The transducer has 12 bits but I read somewhere that this range is a bit wider and therefore you also get measurements above 3.3V. Regarding the value of keyboardButtonThreshold_Auto - Display Mode I actually forgot to include it when updating the variables to write. I will upload a corrected version later.

    Additionally, there will be some change. We are going back to one loop refresh of scroller and VUMeter as it was 3.17.36.
    On stations playing with autoDJ at night (RMF Classic) where Stream Title is refreshed every 2-3sec (includes a counter for the watchdog) the two loops cause the display to flash. Almost invisible, but still... VUmeter trinkets are nice, but they absolutely must not cause the radio to become breathless or have any stream problems. So there will be one adjustment setting for both Scroller and VU Meter. A setting of 50ms seems optimal.

    As for the keyboard, solder one on a universal board. Stylets are not suitable for such things. In addition, if you change the ESP module you will have to recalibrate the keyboard.
  • #1137 21514499
    gabar5
    Level 12  
    @robgold Well I just didn't swap and that's probably the cause, I'll sit down to it in the evening, although I'm surprised that in debug mode they catch fairly constant values and work reproducibly, but after saving to file it doesn't work, I've only saved 4 buttons and it's also a moot point.
    Oh well, I'll replace the switches and the performance will probably improve.
  • #1138 21515785
    rysin
    Level 12  
    You are so combinative with these panels, and the Chinese have produced a finished panel .

    Small electronic panel with a blue PCB, 1.3-inch display, and knob. .

    I bought it in combined offers with a 1.3'' display at a discount for £12.
  • #1139 21515856
    DJCheester
    Level 26  
    rysin wrote:
    You are combining so much with these panels, and the Chinese have produced a finished panel .

    I bought it in combined offers with a 1.3'' display at a discount for £12.
    .

    You see I am combining because I want to be able to decide whether I use an encoder for myself and which OLED I use. This is the essence of DIY that everyone can do as they wish, buying this once that under our code probably will not approach and two this Chinese cheap something unfortunately I do not like because too small OLED and when buying such toys practically less and less is your work in these projects.

    We (some of us) are planning to mount the radio in old tuner housings, which involves individual layout and adding keyboard circuits, and unfortunately this Chinese module is useless for this.

    Apropos of that, many of you are planning to convert a Sony tuner, if I had such a tuner or the front panel itself, I could dimension the PCB and design the circuits for the keyboard to be compatible with our radio. At the end one would create Gerber files and the Chinese would make such a PCB as needed.

    Greetings...
  • #1140 21516104
    robgold
    Level 20  
    @rysin
    The display module you found is nice but not suitable for this project without a lot of interference with the program code. Firstly it has less resolution secondly control over i2c. All graphic functions to be rebuilt. Obviously doable but it's long hours of writing and "debugging" the code.

    @gabar5
    I connected a Sony keyboard to my radio for a moment. It works brilliantly. Two values were to be calibrated but the rest works fine. The display of the values on the OLED from the ADC also works fine.

    @DJCheester
    The board on the Sony is quite complex in shape, lots of milling for the mounts and on top of that it is very large. So I did a quick count about it about $65. Quite a lot, the one that is after desoldering does its job quite well. I think for 1-2pc it's not worth redrawing it.

    I uploaded version 3.17.58 to GitHub Link .
    This version runs on a single millis loop, by adjusting its refresh we also affect the VUmeter. As it solves the problem of stations transmitting the autoDJ counter we will return to a separate adjustment. ADC recording is corrected. Now all variables should save correctly. There is a button to change the OLED mode on the web page. New way to control brightness using SetContrast instead of setting registers. This should work for displays supported by the u8g2 library and not just the SSD1322.

    Sony_ST-120_WebRadioConversion Link .
    I have separated the Sony radio conversion files and a separate project has been created on GitHub. I'll be uploading print files, pictures, schematics and a list of parts to purchase for converting the Sony tuner to internet radio there.

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