0

I have an Arduino Mega 2560 that I would like to connect to the internet using an ESP8266-12E.

Searching the internet for relevant keyphrases only yielded one type of result: The articles all explain how to program the ESP using the Arduino. Been there, done that.

Does anybody know of a way to use the ESP as a "wifi interface" for an Arduino, e.g. using a Serial interface from the Arduino?

Basically, I'd want to use the library ESP8266Wifi transparently on my Mega 2560, and maybe in conjunction with something like WifiManager - all of that running on the Mega.

The only thing I found was this: https://www.hackster.io/jeffpar0721/add-wifi-to-arduino-uno-663b9e. But this uses AT commands only.

Any hint is appreciated.

migrated from electronics.stackexchange.com Oct 31 '18 at 16:01

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

  • "Any hint is appreciated", here is my two cents: this lack of information is related to the fact that ESP8266 has processing power of its own, AND, it can handles transparently annoying things like IP stack, Wi-fi connections and so on, in such a way that you could do all your project with ESP8266 (even using the arduino IDE), and more complex projects with an ESP32. You can not use ESP's specific libraries as ESP8266Wifi transparently on a Mega2560, just because Mega has not the hardware to handle the IP / wifi stuff. Instead, Mega's application must "talk" AT commands with ESP via serial I/O – mguima Oct 31 '18 at 11:45
  • Another option it would be to use libraries to write a custom-built application to ESP8266, where ESP8266 could talk to Mega's application over SPI, i2c, serial, a bit-banged protocol, whatever. I suggest that you spend some hours reading this. But, anyways, just forget about using ESP's wifi libraries in a Mega. It won't even compile. – mguima Oct 31 '18 at 11:54
  • @mguima: Thanks for that. I already thought about leaving out the Mega right away. The PCB is already done and the Wifi option came on top if it later. Will most probably have to look into AT commands then – Atmocreations Oct 31 '18 at 15:00
  • you can program the ESP or use AT, what else is there? You can't run wifi manager on a mega... – dandavis Oct 31 '18 at 16:52
1

If you know how to write code for the esp8266, then write the networking part in the esp8266 and exchange data and commands with the sketch in Mega over Serial.

Other option is to use AT firmware with the WiFiEsp library or WiFiLink firmware with WiFiLink library.

Or you can connect the ESP-12 to Mega over SPI and use the WiFiSpiESP firmware with WiFiEsp library.

All mentioned libraries are 'clones' of the WiFi library.

0

ESP8266-01 usually come pre-programmed with the "AT" instructions interpreter for WiFi communication. If your -12 didn't, or if you've reprogrammed it, you'll need to find and download a copy of the AT interpreter to re-load.

Then you'll cross-connect one of the Mega's UARTs to the ESP (Tx > Rx and Rx > Tx), respecting the voltage level differences between the Mega and the ESP (5v vs. 3.3v). You'll need use a level-shifter or make a voltage divider for at least the Mega Tx > ESP Rx connection.

Then it's just a matter of using an existing Arduino ESP-WiFi library, or writing your own serial communications using the ESP's AT commands if you want the challenge.

I generally use the Blynk Internet of Things service and libraries as the quickest and a full-featured way to put a device online with access to/by your cellphone. It's not the only way but it's a good start.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy