Introduction: Wifi Webradio With ESP8266 and VS1053 (KaraDio)

Picture of Wifi Webradio With ESP8266 and VS1053 (KaraDio)

A wifi web radio player with only two low costs boards.

2017/08/25 New release 1.6: See The hackaday page
For more informations or questions, you can enter to the Karadio facebook group

Description:

Control with any browsers (ie edge, chrome mozilla etc...).or with an external hardware panel or with the uart interface.

Memory for 256 stations

OTA upgrade

Read direct mp3 or ogg streams or playlist .pls .m3u and .xspf

Read up to a 320 kb/s stream,

New web page, Fit well on mobile or computer.

Embedded wifi configuration via the web or uart interface

Metadata displayed (ie Title of the current song if given in the stream),

All settings saved (sound setting, stations, wifi)

Server multi clients with automatic refresh for all (websocket),

The stations can be downloaded and uploaded within the web site,

Very quick responsive web by caching local information in the browser and websocket.

a led indicates the state of the equipment . Speed blink: init, 90%in 10%out: connection in progress, 10% in 90%out: Equipment ready.

External DAC i2s interface on the vs1053 enabled.

Autostart on power on if the autoplay is checked.

Step 1: Step1: What You Need

Picture of Step1: What You Need

Parts required:

A nodeMcu V3 (on aliexpress)

A VS1053 module (aliexpress)

A Fiberglass board epoxy boards (aliexpress)

2.54mm 40 Pin Stright Female Single Row Pin Header Strip PCB Connector (aliexpress)

Some wires and Soldering Iron.

A pc or other with an usb port

and an usb to micro usb cable. (aliexpress)

An external amplifier or earphone.

A prototype can also be made using a breadboard and some jumper wires.

See The hackaday page

Step 2: Step2: Build the Webradio Hardware

Picture of Step2: Build the Webradio Hardware

Follow the schematic to wire the board.

Be careful, the vs1053 is hard to soldier. Pins are very close each other.
Use a very thin iron.

Check each wire before the next step.
The power comes from the micro usb of the nodeMcu linked to the pc or a 5 volts transformer.

Step 3: Step3: Loading the Software and First Use

Picture of Step3: Loading the Software and First Use

Loading the software

You need the ESP flash download tool.

Load it at the Espressif page

The binaries files can be found on Github or hackaday

Follow the image to configure the tool depending of the tool release

To enter the flash mode of the nodeMcu, press and hold the flash button, the press the reset button. You ca release the flash button.
Start the download with the start button of the ESP flash tool.

After a while, the Finish green indication is shown.

Press the reset button of the nodeMcu. If succesful, the nodeMcu les blinks.

First use

If the acces point of your router is not known,

the webradio init itself as an AP. Connect your wifi to the ssid "WifiWebRadio", Browse to 192.168.4.1 to display the web page, got to "setting" "Wifi" and configure your ssid ap, the password if any, the wanted IP or use dhcp if you know how to retrieve the dhcp given ip (terminal or scan of the network).
In the gateway field, enter the ip address of your router.Validate. The equipment restart to the new configuration. Connect your wifi to your AP and browse to the ip given in configuration.
Congratulation, you can edit your own station list.
Dont forget to save your stations list in case of problem or for new equipments.if the AP is already know by the esp8266, the default ip is given by dhcp.
A sample of stations list can be uploaded via the web page and loaded to the webradio.

All future update will be made within the webradio interface via the ota feature.

Step 4: Some Images

Picture of Some Images

The esp8266 is an incredible processor. This project is made with the freertos environment and contains many tasks: a web client to connect to the radio stream, a web server to provide the browser interface 'and a child task for each client), an uart task to display and and send commands to the webradio, a task to manage an external panel command on the adc entry (schematic in the hardware directory on github), a task for each client websocket, etc.
It is a complex project, but the processor is really powerful. The only limit is the lack of ram, which can be removed by adding an external chip on the spi bus. See the hackaday page or github page.

The uart interface can show some debug informations and can send controls to the webradio.
For a command list see the uartinterface.txt file at

http://karadio.karawin.fr/Interface.txt

Comments

АлексейС63 (author)2017-08-08

I have experiment with STM32F103CB and OLED SSD1306_128X64, but result was bad. A don't know what i can do with it. Do you have such situation?

Its look like an inversion of sda scl

i tried to inverse sda with scl, but screen not work at all. More i took another display OLED 1306, it display the same...

Reload

https://github.com/karawin/karadio-addons/tree/mas...

May be... It is hard to found the error. I retested two oled 0.96 and 1.3 with success yesterday.

The default value on github was not for a 1306. I have changed it today. Reload the ino and regenerate please.

Unfortunately I got the same result. I compared the new source with older version. These changes I tried earlier. Display was work with your project on Arduino Micro

djuscha (author)2017-06-10

Today I connected my remote control, but the seller has sent me another with the cross below. Now when I switch is key 5 stop and play buttons 4 and 6 volume and buttons 2 and 8 stations Can man change that somehow in the library or ino?

karawin (author)djuscha2017-06-10

Which ino?
See the code. Even if you know nothing is software, i think you can understand what to change
switch(results.value)
{
case 0xFF629D:
case 0x10EF48B7: /*(" FORWARD");*/ irStr[0] = 0;Serial.print(F("cli.next\r")); break;

case 0xFF22DD:
case 0x10EFA857:
case 0x10EF42BD: /*(" LEFT");*/ irStr[0] = 0;Serial.print(F("cli.vol-\r")); break;

case 0xFF02FD:
case 0x10EF7887: /*(" -OK-");*/
{
// state?Serial.print(F("cli.start\r")):Serial.print(F("cli.stop\r"));
if (strlen(irStr) >0)
{
Serial.print(F("cli.play(\""));Serial.print(irStr);Serial.print(F("\")\r"));
irStr[0] = 0;
}
else
{
state?Serial.print(F("cli.start\r")):Serial.print(F("cli.stop\r"));
/* if (state)
Serial.print("cli.start\r");
else
Serial.print("cli.stop\r");
*/
}
state = !state;
irStr[0] = 0;
break;
}
case 0xFFC23D:
case 0x10EF28D7:
case 0x10EF827D: /*(" RIGHT");*/ irStr[0] = 0;Serial.print(F("cli.vol+\r")); break; // volume +
case 0xFFA857:
case 0x10EFC837: /*(" REVERSE");*/ irStr[0] = 0;Serial.print(F("cli.prev\r")); break;
case 0xFF6897:
case 0x10EF807F: /*(" 1");*/ nbStation('1'); break;
case 0xFF9867:
case 0x10EF40BF: /*(" 2");*/ nbStation('2'); break;
case 0xFFB04F:
case 0x10EFC03F: /*(" 3");*/ nbStation('3'); break;
case 0xFF30CF:
case 0x10EF20DF: /*(" 4");*/ nbStation('4'); break;
case 0xFF18E7:
case 0x10EFA05F: /*(" 5");*/ nbStation('5'); break;
case 0xFF7A85:
case 0x10EF609F: /*(" 6");*/ nbStation('6'); break;
case 0xFF10EF:
case 0x10EFE01F: /*(" 7");*/ nbStation('7'); break;
case 0xFF38C7:
case 0x10EF10EF: /*(" 8");*/ nbStation('8'); break;
case 0xFF5AA5:
case 0x10EF906F: /*(" 9");*/ nbStation('9'); break;
case 0xFF42BD:
case 0x10EFE817: /*(" *");*/ irStr[0] = 0;Serial.print(F("cli.stop\r")); break;
case 0xFF4AB5:
case 0x10EF00FF: /*(" 0");*/ nbStation('0'); break;
case 0xFF52AD:
case 0x10EFB847: /*(" #");*/ irStr[0] = 0;Serial.print(F("cli.start\r")); break;
case 0xFFFFFFFF: /*(" REPEAT");*/break;
default:;
/*Serial.println(" other button ");*/
}// End Case

djuscha (author)karawin2017-06-11

Super thank you!

Have now found and changed

One more question. Can you set favorite stations on the buttons 1-9
Would be so right?

case 0x10EF20DF: /*(" 4");*/ irStr[0] = 0;Serial.print(F("cli.play("4")\r")); break;

djuscha (author)djuscha2017-06-11

Station number 4 to the 4 button

Vishal Dhayalan (author)2017-05-21

Hi, i tried flashing the ESP8266 nodemcu but i get an error on the command prompt that runs alongside it:
Invalid head of packet <' '>
Exception in thread Thread-2
Exception invalid head of packet <' '>

And the download panel is stuck on the download green indication, no sign of any activity on the nodemcu.

Does this usually happen? How long does it take to flash the nodemcu usually? It's been stuck on this for awhile..

sorry, I'm not sure why the image quality has changed when i uploaded it but the images i took were good...

djuscha (author)2017-05-10

My radio has finally earned from 0.96 LCD and Russian tags. Buttons and IR has not done so far. There is one problem, after a while the radio turns off, Stoped on the display, Play through the WEB does not help, just off / on. What could be the problem?

Thanks again for such a great project and help!

karawin (author)djuscha2017-05-10

I have two different protos running 24/24. Try to improve your power supply?

djuscha (author)2017-04-28

"Arduino Pro or Pro Mini, ATmega328 (3.3V, 8MHz)" Arduino: 1.8.2 (Windows 10), Board:
Fork / exec C: \ arduino-1.8.2 \ hardware \ tools \ avr / bin / avr-gcc.exe: The file name or extension is too long.
Error compiling for the Arduino Pro or Pro Mini board.

Wanted to connect,

0.96" I2C IIC SPI Serial 128X64 White OLED LCD

but get compile error message .

what am I doing wrong?

karawin (author)djuscha2017-04-28

Which file name? the ino?

djuscha (author)karawin2017-04-29

Have all libraries reloaded and set. Go now
Many thanks!!!:)
Now I need baud rate
set to
Sys.uart ("28800")
I do not understand yet When I start after the fast Termite.exe, I see only hieroglyphs .. I have to set with Termite .exe irgent something?

karawin (author)djuscha2017-04-29

The default baud rate is 115200 to be set to the termite setting..

Efter, you can send the sys.uart command to set it to 28800 and reset the esp.

djuscha (author)karawin2017-04-29

I have flashed mini arduino with Arduino Uno and then I tried immediately with Termite exe.Das did not work. Then I put everything together. And over Nodemcu again Termite started and entered Sys.uart ("28800") and that has worked. ;)
Now I have only the problem that the time is not true: (and Russian letters are not represented correctly

karawin (author)djuscha2017-04-29

At the beginning of the code of the ino file, you have to set the

// your timezone offset
#define TZO 1

to your timezone.
Recompile and flash again.

The tzo command will be sent automatically.

djuscha (author)karawin2017-04-29

#define TZO 1 changed to #define TZO 2, reflashed. The time is on 00-01-2000 :( I'm doing something wrong?

karawin (author)djuscha2017-04-29

nothing. Sometime the ntp call fails on timeout, but it is retried periodically

djuscha (author)karawin2017-04-30

Have done so and waited. No change. Time still shows 00-01-2000

:(

karawin (author)djuscha2017-05-02

Obviously, the mini pro must be connected to the esp8266. Are you sure to use the up to date delivery?
The display is working? (station etc?)
Without detail, i can't find your problem.

djuscha made it! (author)karawin2017-05-02

Yes display shows all info ... only the time display hangs

karawin made it! (author)djuscha2017-05-02

I tested with exactly the same configuration (mini pro 3v 8Mhz)

And it show on termite in bridge between 2 usb (the nodeMcu and an usb adapter to the mini pro)

May be try to reload the ino at https://github.com/karawin/karadio-addons, but
Probably the tx to rx from mini pro to the nodeMcu is not well wired.

djuscha (author)karawin2017-05-06

Have now all newly made new Nodemcu new mini pro everything flashed. Oh yes new cables. And nevertheless the clock does not run.
What I have yet discovered when Nodemcu is connected to the computer and Termite runs when I enter sys.date command, the clock runs on my small display. However, the time after the reset or new start again away

:(

karawin (author)djuscha2017-05-06

Probably the tx from mini pro to rx of nodeMcu is not well wired.

Stop termite, it can disturb the Rx from the mini pro.
If the clock manually entered works, that means that the reception of the mini pro works, but not the mini pro tx to rx of the nodeMcu

djuscha (author)karawin2017-05-07

Now I understand nothing ... in the u8glibConf.h stands
--NodeMcu-- --Mini Pro--
Tx Rx
Gnd Gnd
VU Raw
And now you write the tx from mini pro to rx of nodeMcu is not well wired. ?!
Have now new cable taken nevertheless the time does not run
So now everything has new, new flashed, new cables and still does not run the time :( what am I doing wrong? ;(

karawin (author)djuscha2017-05-07

Please add a wire from the tx from mini pro to rx of nodeMcu

The mini pro now send the commands sys.tzo , cli.info and sys.date
I forgot to add this comment in the u8glibConf.h because it is new. But it is obvious as you sent these commands manually, the mini pro do it too.

I make all these files in my free time for free so it is very heavy to think at all things.

djuscha (author)karawin2017-05-07

I am so stupid:) ... Now goes! I could have thought of second cables to connect.Super. Many Thanks!! Now I can test whether it is stable.
Thanks again for the support!

djuscha (author)djuscha2017-05-07

I may take wrong karadio U8glib.ino? I take the zip

https://github.com/karawin/karadio-addons/blob/mas...

karawin (author)djuscha2017-05-07

I removed the zip. Please reload the ino and h files. Not yet updated the comments.

florinn2520 made it! (author)2017-05-04

Final project

karawin (author)florinn25202017-05-05

Great. Just update the display with https://github.com/karawin/karadio-addons
It adds the date and time. (need the mini-pro -> esp rx wire.)

karawin (author)2017-05-02

So it works. The mini pro send the tzo and date command to the esp as you have done manually.

АлексейС63 (author)2017-04-09

I have a small problem with the module vs1003. When switch station, previous station continues playing until ends cache in buffer, then begins to play the current station. Display and the web interface shows the current station, but playing the previous one. Please tell me how can i fix this situation.

I wonder how it is possible. Are you sure that it is the Karadio software?
Send a log please.

giltesa made it! (author)2017-03-25

Hi karawin,

I finished the wooden radio that told you I was building.

Thanks again for your work.

More information: https://giltesa.com/?p=18015

Kind regards.

karawin (author)giltesa2017-03-25

Great demonstration. And Bravo for the quality of the build.
The pluggable connector is a very good idea.

giltesa (author)karawin2017-04-04

Hello karawin,

I'm creating a web interface with Bootstrap, I have a question, What memory limit is there for interface files?

My index.html file has a size of 42KB, four times more than the original, and I have not yet finished...

I attach a link to the test web, I think it's looking good:

http://test.giltesa.com/karadio1/

Kind regards.

karawin (author)giltesa2017-04-05

This file is on flash, so 42KB is not a problem.

Go on...

nyomand1 made it! (author)2017-03-24

Awesome instruction! I got my webradio running on basic configuration. Now I just need to add a display and buttons.
Thank you karawin for sharing your work!

karawin (author)nyomand12017-03-25

You are welcome.

dom_france made it! (author)2017-03-19

Photo de ma carte arduino pro mini :

dom_france (author)2017-03-19

Et dans "u8glibconf.h" j'ai opté pour cet afficheur, j'ai donc decommenter uniquement cette zone :

U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0);// I2C / TWI

dom_france (author)2017-03-19

J'ai bien changé dans u8g.h ceci : (UG8_16BIT)

In .../Arduino\libraries\U8glib\utility/u8g.h

uncomment the following line

#define U8G_16BIT 1

dom_france (author)2017-03-19

Euh, rectificatif sur la couleur de mon fil Gnd entre NodeMcu et mini Pro : bleue

Vu (NodeMcu) -------------> RAW (mini pro) (couleur vert)

Pin Gnd (NodeMcu) -------------> Pin Gnd (mini pro) (couleur BLEUE)

Pin Tx (NodeMcu) -------------> Pin RxI (mini pro) (couleur jaune)

dom_france made it! (author)2017-03-19

Bonjour Karawin,

oui aucun pb avec le fichier u8glibconf.h, j'ai bien vu que toutes les info sur le cablage y etait inscrites, mais je dois t'avouer que entre la NodeMcu et la carte arduino pro mini, ce n'est pas evident à comprendre, je m'explique :

Entre mini pro et OLED, voici mon branchement :

Pin A4 (mini pro) --------> Pin SDA (OLED) (couleur brun sur mon montage)

Pin A5 (mini pro) --------> Pin SCK (OLED) (couleur rouge sur mon montage)

Pin Gnd (mini pro) ---------> Pin Gnd (OLED) (couleur noir)

Pin Vcc (mini pro) ---------> Pin Vcc (OLED) (couleur bland)

OK

Par contre entre mini pro et NodeMcu, la je ne suis pas sur, voici ce que j'ai fait en m'inspirant du fichier u8glibconf.h :

Vu (NodeMcu) -------------> RAW (mini pro) (couleur vert)

Pin Gnd (NodeMcu) -------------> Pin Gnd (mini pro) (couleur vert)

Pin Tx (NodeMcu) -------------> Pin RxI (mini pro) (couleur jaune)

Mon soucis, c'est que je comprend bien que l'envoi des donnees entre la NodeMcu et la carte mini pro se fait par la liaison Tx vers Rx, mon fil jaune sur mon montage, que je branche ou pas ce fil, je n'obtient rien sur l'afficheur OLED, du coup, OK, je me suis rendu compte en lisant u8glibconf.h que je n'avais pas changé la Baudrate, j'ai eu un peu de mal à comprendre la liaison UART, mais maintenant grace à ton aide, c'est bon, je me dis que maintenant, seul une erreur de cablage peut poser probleme. La pin RxI de ma carte arduino pro mini, est-ce que c'est bien celle la (sur le coté) ?

Je ne vois plus que ça.

Merci d'avance pour ton aide

DOM

dom_france (author)2017-03-19

Si quelqu'un a plus de precision la dessus :

Entre l'arduino mini pro et l'ecran OLED, pas de probleme, j'arrive a comprendre :

Graphic LCD Pinout:

Mini Pro____ _______ GLCD___

JP2 A4 LCD SDA .... Pin 3

P2 A5 LCD SCK .... Pin 4

// LCD Gnd .... Pin 1

// LCD Vcc .... Pin 2 5 volts from the minipro VCC

Par contre, entre la NodeMCU et l'arduino mini pro, j'avoue que c'est pas clair :

RESET Reset (not used))

Rx 1 to the tx of the nodeMcu

Gnd ground

jp2: A4,A5 I2C lines

Raw: 5 to 16 VDC Max

Merci pour votre aide