I've been trying to figure out how to get my ESP8266-equipped Arduino Mega to actually connect and talk to the internet and, well, do useful stuff.
Well, technically, to a Raspberry Pi connected via Ethernet to the same router that the ESP8266 will connect to, but it's the same basic idea and eventually I intend to connect it to the outside world, e.g. ThingSpeak, Twitter, WeatherUnderground, Google Drive, etc.
I've done all the proper wiring with the necessary level shifting and voltage regulation and such to get the two boards properly connected and talking to each other, and have verified it via AT commands and doing a successful search for local APs, using the Serial Monitor and PuTTY. Now I need to figure out how to best logically connect it to other TCP/IP-connected devices like the RPi.
I realize that I can just hard-code the necessary AT commands to connect to the router, establish a TCP connection, issue HTTP commands like GET or POST, etc. But it seems rather clunky, and you have to do all your validation and error correction.
I've seen various ESP8266 libraries on github that supposedly give you the same WiFi/TCP functionality on your Arduino that you'd get with a more "standard" WiFi or Ethernet shield that uses the standard WiFi libraries that come with the Arduino.
But there are a bunch of them and I'm not sure which is best or most popular, and they appear to be intended for people who want to program and use the ESP8266 as a standalone MC w/o an Arduino.
There's also a MySQLConnect library written for the Arduino that allows you to directly connect and talk to a MySQL DB, which would actually be perfect for my needs as the whole purpose of connecting my Arduino Mega to the internet is to save readings from a weather stations I've developed to a MySQL DB on my Raspberry Pi.
But it appears to be based on the above-mentioned standard Arduino WiFi or Ethernet shields and libraries, which use SPI to connect the shields to the Arduino, and probably wouldn't work with the ESP8266, which uses serial, at least not without some modification, which my limited C++ isn't qualified at present to tackle.
So, basically, what's the best/preferred way to get an ESP8266-equipped Arduino to connect and talk to the internet, both generally, and specifically to talk to a MySQL DB:
1 - Hard-coded AT commands
2 - Arduino ESP8266 library (and if so which one?)
3 - MySQLConnect (and would it need to be modified or can it use one of these libraries?)
I also have questions regarding the best way of getting the weather station readings into the MySQL DB, e.g. POST/PHP, MQTT, Sockets, MySQLConnect, etc., once a TCP/IP connection has actually been established. But that's a different set of questions for another thread someday.