logo elektroda
logo elektroda
X
logo elektroda

A simple internet radio player based on ESP8266

miszczo997 34977 15
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • A simple internet radio player based on ESP8266
    Hello
    I wanted to present a modification of the design of the Internet radio player built only using the ESP-01 module, RC filter and a few external components.
    Hardware:
    The schematic and pcb were prepared in the Eagle program version 7.7.0.
    The mp3 stream decoding is handled by the ESP8266 microcontroller overclocked to 160MHz. As the output generates a PWM signal, where the PWM itself has a resolution of only 4 bits, it was necessary to add a low-pass filter. I used the solution proposed by the @tmf user in one thread in the microcontrollers section. This is a 3-stage RC filter which should give a decrease of 18dB per octave, whose cut-off frequency I can't remember anymore. As a power outlet I gave the opportunity to use a DC connector, ark connector or ordinary goldpin. Voltage stabilization is handled by ams1117 or similar with the same pin configuration.
    A simple internet radio player based on ESP8266 A simple internet radio player based on ESP8266

    Software
    The software is a modified code that was available at this address:
    https://github.com/pvvx/mp3_decode
    I have added the ability to change radio stations using the keys. However, it is not entirely correct and has 2 bugs that I could not cope with:
    - when changing stations, before we connect to the next one, the sound will be suspended and the loudspeaker will be heard.
    - when you hold the switch button for a long time, the system will reset.
    The rest seems to work as it should. Files with modified program code are placed in the attachment.
    Comments:
    - The player can decode only mp3 streams,
    - I used wireshark + foobar to get addresses of types, addresses and bitrates of streams
    - Theoretically, the maximum bitrate is 256kbps
    - The program is compiled with the help of Eclipse + RTOS SDK, wanting to add radio stations and configure the network connection options, I recommend reading this theme.
    - Addresses and number of stations are defined in the file radiostation.c
    - The name and password for the network are defined in the file playerconfig.c
    - In the attachment I also put a compiled program with the name of the TPLINK network and the password 1234abcd, where I added stations
    
    RMF FM
    Duth radio(?)
    Maxima FM
    Radio Złote Przeboje
    VOX FM
    Radio ZET
    Polskie Radio PR1
    

    - To upload the program, it's best to configure eclipse and do it from its level, but you can do it 100% using another tool, e.g. ESP Flash Tool. Addresses to upload files you have to look for yourself, because I uploaded only with eclipse.
    - During programming, we connect the usb uart converter to the goldpin pulled out from the side of the board. After programming the system, put a jumper between the RXD and the output. I had to use such a solution because the loaded line caused the lack of programming possibilities. To switch the system to flash mode, hold the corner button and then connect the power supply.
    - The system consumes 110mA during operation
    - The sound quality is quite poor and is not suitable for listening on headphones. I obtained tolerable quality at home when connecting to the Sony FH-411R tower and adjusting the equalizer settings accordingly.
    - A version with DAC and external RAM is also available this address, but after a few hours of fighting I could not compile. If anyone can deal with it, please give me a description.
    - If anyone has any idea how to convert AAC to mp3 on the fly, please let me know how to do it.
    - All necessary files attached


    A simple internet radio player based on ESP8266 A simple internet radio player based on ESP8266 A simple internet radio player based on ESP8266 A simple internet radio player based on ESP8266
    A simple internet radio player based on ESP8266 A simple internet radio player based on ESP8266 A simple internet radio player based on ESP8266 A simple internet radio player based on ESP8266

    Yes it's a game
    [Film: a8ca227b01] https://filmy.elektroda.pl/52_1505470652.mp4 [/ film: a8ca227b01]
    [Film: a8ca227b01] https://filmy.elektroda.pl/4_1505470694.mp4 [/ film: a8ca227b01]


    best regards
    Paul
    Attachments:

    Cool? Ranking DIY
    About Author
    miszczo997
    Level 28  
    Offline 
    miszczo997 wrote 1045 posts with rating 154, helped 132 times. Live in city Lubartów. Been with us since 2009 year.
  • ADVERTISEMENT
  • #2 16700807
    Tytus Kosiarski
    Level 16  
    Hello

    Thanks for pointing out my project :)

    So fast: does your WiFi module close the existing connection to the radio server before connecting to a new server? Maybe this is the reason for this buzzing in the headphones? When you establish a connection and start receiving from the server, you first receive a few hundred bytes of text data, then the MP3 stream flies.

    I click cool :)

    Regards, KT
  • ADVERTISEMENT
  • #3 16700833
    miszczo997
    Level 28  
    Tytus Kosiarski wrote:
    Fast: does your WiFi module close the existing connection with the radio server before establishing a connection with a new, different server?
    Regards, KT

    Thank you for your comment :D
    Yes, I'm closing the connection. My guess is that the buzz is due to the DMA based pwm and still running mp3 decoding thread in the background. At the time of disconnection, probably the data with sound samples contained in the table are constantly exposed to the pwm output by dma and played until the connection is established and another series of samples is not decoded. Tried to kill mp3 decoding thread but after rebooting it didn't work properly anymore. My guess is that if you rigidly enter zeros into the buffer when you press the button, it would be fixed, but I don't know how to do it because of the multithreading of the program. Similarly, with holding down the keys, in the handling of interrupts I tried to disable the scheduler completely and run it on exit, but the program was still resetting. This is my first contact with any rtos and I do not fully understand how it all works.
  • #4 16700945
    cziter15
    Level 11  
    Cool and simple design. ESP is generally quite an interesting microcontroller.
    The module in the ESP-12 or ESP-06 version will certainly look more aesthetically pleasing.
  • ADVERTISEMENT
  • #5 16701289
    Tytus Kosiarski
    Level 16  
    I don't know what RTOS you used, but maybe there is something or similar like TaskSuspend and TaskResume? Besides, it may be worth trying to simply turn off PWM on the ESP module pin in the appropriate thread (data) when there is no data from the MP3 stream. The radio server will not translate the AAC stream to MP3, the receiver must be able to decode the received streams.
    In my radio I used the AAC decoder from here: https://embdev.net/articles/ARM_MP3/AAC_Player

    Regards, KT
  • #6 16701928
    mojomax
    Level 15  
    I wonder if it would be easy to get stereo sound.
  • #7 16701937
    Galareta
    Level 23  
    As I remember correctly, esp8266 has i2s so you can connect a DAC
  • #8 16702590
    krzysiek.b
    Level 12  
    I note that I do not know this software, but I suppose that as you called it - the crashing of the sound may be due to the fact that in the output buffer (probably ring-buffer) the samples have recently been decoded and are played over and over again. It may be enough to clear this buffer when changing stations.
  • #9 16703799
    kassans
    Level 32  
    A great project! you can be tempted by ESP-12 and add LCD2x16 after I2C :)
  • #10 16703810
    Galareta
    Level 23  
    Lcd2x16 after i2c would waste a lot of money ;) probably better some graphic OLED.
  • #11 16703816
    kassans
    Level 32  
    OLED also goes after i2c so I think that without a difference, there is a big difference in the price of such displays.
  • ADVERTISEMENT
  • #12 16703823
    Galareta
    Level 23  
    No PLN 10 oled on Ali. I2c goes, but it's nice to take over DMA.
  • #13 16705160
    kassans
    Level 32  
    What is its size? I don't think it's the size of a 2x16 screen :D
  • #14 16705292
    Galareta
    Level 23  
    It's 2.4 TFT whole, it is smaller but more text fits on it, 4 lines on 128x32 - 0.91 'or 8 on 0.96 128x64. Yes, you can read such a text calmly. The display on i2c 2x16 takes up a terrible processor. Unless I tested. OLED shines beautifully. 2.4 'TFT costs about 25 PLN. I didn't measure ESP with TFT. I only compared 2x16 with 128x64 OLED and the latter won. You would have to add some processor to support this 2x16 display, e.g. AVR tini.
  • #15 17087892
    regog
    Level 8  
    Maybe there is something or similar like TaskSuspend and TaskResume? In addition, it may be worth trying to simply disable the PWM feeding on the ESP module pin in the appropriate thread (tape) when there is no data.
  • #16 17405834
    qba1012
    Level 10  
    Great project, could use something like this.
    Would any of you be willing to sell such a gem? PW

Topic summary

The discussion revolves around a modification of an Internet radio player utilizing the ESP-01 module, featuring an RC filter and several external components. The ESP8266 microcontroller, overclocked to 160MHz, decodes MP3 streams, generating a PWM output that requires a low-pass filter to improve audio quality. Users discuss issues related to audio buzzing during server connections, suggesting potential solutions such as clearing the output buffer and managing multithreading in the program. The conversation also touches on aesthetic improvements using ESP-12 or ESP-06 modules, the possibility of adding an LCD or OLED display, and considerations for achieving stereo sound through I2S connections.
Summary generated by the language model.
ADVERTISEMENT