The easiest way to turn on & off led via web, with arduino and esp8266 module
ESP8266 AND ARDUINO HTML WEB SERVER.
Its works by sending http request & url to turn on led.
Step 1: Connection With Arduino
220 ohm Resistor
1k ohm Resistor
2.2k ohm Resistor
Connect RX pin of esp8266 to arduino pin 3 | NOTE :- esp8266 RX pin use 3.3v more than that will kill the module, use resistor as shown in diagram.
Connect TX pin of esp8266 to arduino pin 2
esp8266 vcc pin to 3.3v output of arduino
and ground to ground.
Connect led to pin 12 of arduino.
Upload Code To Arduino
Before uploading codes to arduino be sure to check your esp8266 baud rate an set it, mine is (115200).
Then set up your SSID and password, or use it as a Access point mode.
// If you are using Access poin mode
remove the trailing slash from the front of this code, this will activate as access poin mode = > sendData("AT+CWMODE=1\r\n",1000,DEBUG);
And add trailing slash in front of => sendData("AT+CWMODE=1\r\n",1000,DEBUG);
and also in front of => sendData("AT+CWJAP=\"SSID\",\"password\"\r\n", 6000, DEBUG);
Because we don't need this code any more it is for Station mode.\\
After uploading code to arduino wait for the esp8266 to connect to the Router.
Find the IP address of the device and then go to your browser and see the magic.
Some Link For this project
See this project in Tinkercad => https://www.tinkercad.com/things/0oQMS0nq33i
See this project in Github gist=> https://gist.github.com/shahid249/421029a5fc65fbd30ab6c3e71af8efed