Is it possible to replace a W5100 Ethernet Shield with an ESP8266 WiFi UART Serial Module ESP-01 ?
Greetings for the New Year
I have a home based Arduino Mega 2560 and stuggling locally to get the Ethernet Shields, but the ESP8266 modules are easily available.
My current sketch uses both www client and server, as it transmits log data ( temperature readings, etc ) to my web server in the form of a GET url to a php page ( which stores the data online ), and also acts as a server which allows me to connect remotely from a browser and toggle pins, etc.
The examples that I see online for the ESP8266 all seem to be related to using an Arduino to program the ESP8266 module using an Arduino as a programmer, but not really seeing anything that points to replacing the functionality of the Ethernet Shield with the ESP module.
May be I am googling for the wront terms. Pointers please ?
Would the setup connection procedure use AT commands from the Arduino to connect the ESP to my WiFi router ?
Are the WiFi settings / password specified in the AT commands ?
Current code that I am using includes :
#include <Ethernet.h>
#include <utility/w5100.h>
char serverName[] = "http://www.xxxx.co.za";
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 1, 101);
IPAddress gateway(192, 168, 1, 254);
IPAddress subnet(255,255,255,0);
IPAddress myserver(41,203,18,70);
EthernetServer server(82);
EthernetClient client;
EthernetClient WWWclient;
if (client.connect(myserver, 80)) {
client.print("GET http://www.xxxx.co.za/serveit.php?data=");
client.print(Location);
client.print("--");
client.print(LogTxt);
client.println(" HTTP/1.1");
client.println("Host: www.xxxx.co.za");
client.println();
delay(100);
client.stop();
}