Mega Wifi: ESP8266 or ESP32? -- what library?

I need to make a Mega Wifi capable for a music project that can play long mixes, and is based on the Sparkfun VS1053 shield with SD. I need to remotely control the player. Both as an http server and straight serial to the IDE monitor. After some research on this forum, I have ruled out the ESP-01 (8266). Appreciate getting some information about:

1- Is there a Wifi module for the Mega that does not need programming and would offer both web server and serial?

2- Is there any reason not to prefer an ESP32 over the ESP-12 8266 NodeMCU, except that it is an overkill?

3- What is the best connection to the Mega - SPI or Serial Tx/Rx?

4- What library package should be used for the NodeMCU? Is this an IDE board?

5- For USB Serial to a Windows PC, what monitor software would you recommend for the PC (besides the IDE monitor)?

Any help would be greatly appreciated, thank you.

Why the Mega. What is your project.
Adding a processor with WiFi capability to another processor is usually not recommended.
If you go this path, then an ESP-01 is still the preferred board for this kludge.
And no, you cant use WiFi without programming.

The project is a music project that can handle long mixes, and is based on the Sparkfun VS1053 shield with SD. I need to remotely control the player.

The project uses the SFEMp3Shield and SdFAT libraries. I tried to use a native ESP32 without the Mega, but the library would not compile. As the MCU must hand feed the MP3 stream byte by byte with interrupts to the VS1053, I don't think I would be able to port the libraries to a ESP32.

A shield sort-off limits your options to a full-sized Arduino.
I think an ESP-01 kludge is the way to go. It already has more capabilities than you need.
A NodeMCU or ESP32 added to a Mega is overkill (and maybe harder to manage).
Lots of projects out there to add an ESP-01 to a Mega.
Try to use one of the three extra serial ports.

1 Like

OK, how do I program an ESP-01? Has no port. What library do I use? By project do you mean here on or on Github - can you give me a link? I really don't know how to proceed. Thanks

With an ESP-01 programmer.

Aliexpress item
At least, that is the manual switching version; I would recommend in preference the automatic version which while it does include the reset button, initiates the programming directly from the Arduino IDE:
Aliexpress item
Mind you, using an ESP-01 as an attachment rather than the main project, you generally use the "AT" command set which is necessarily clumsy, but this is your choice I suppose. :roll_eyes:

1 Like

Thanks. Unfortunately I don't have a programmer to program the ESP-01. I think I will go back to the ESP32, which I already have running as a web server. Or shall I port the VS1053 library and SdFat to the ESP32?

May I ask what is the best method to communicate between the Mega and the ESP32? Would that be the SoftwareSerial library? Or SPI? Any help for interfacing is greatly appreciated. Do you know of any project that interfaces two MCUs together?

Never use SoftwareSerial on a Mega.
As said, use one of the three spare hardware serial ports of the Mega, assuming you go for serial.

1 Like

That would be by far the most sensible approach.

Don't! :upside_down_face:

There are several wifi radio projects using the esp32 with VS1053 so there are working libraries out there (although may not be compatible with your current setup?, I don't know if it is something you already have set up but now want to add wifi?)

You could set up your esp32 as a web server and link it to the mega via hardware serial to pass some basic info. between them. It would be nice to have it all running on an esp32 though.
You can split the project in to separate sections and work on each individually which will make it easier.
i.e. Web interface, serial link between the two devices etc.

If you want to display info on your computer then I would suggest having a look at Processing.
I have a demo sketch here of how to pass serial data to it: misc/Processing-receive_data_via_serial.pde at main · alanesq/misc · GitHub
Search for "the coding train" for lots of info on what you can do with Processing

The esp32 is not much more expensive than the esp8266 these days and is much more powerful

for serial see: Serial Communication Between Two Arduino Boards - Iotguider

for wifi see:

1 Like

You probably don't need one. The ESP-01 modules and the ESP8266 shields come with the AT firmware pre-programmed on the ESP8266. So you only need to program the Mega board, as usual by uploading sketches via the Arduino IDE.

You would only need to program the ESP8266 if you wanted custom firmware or to update to a newer version of the standard AT firmware than the one provided by the chip manufacturer.

1 Like

Or to make it perform the entire project. Not so relevant in this case here since you need a lot of I/O which you would have to provide with port expanders - not that using them is particularly difficult. Using the ESP-32 instead sounds more practical with teh current constraints as alanesq mentions.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.