Code for obtaining IP Address from Esp-01

Documentation

Build an ESP 8266-01 Local Host Server(Wifi Module) – Code and Schematics .

This tutorial is a step-by-step guide that shows how to build a standalone ESP 8266-01 Local Host Server that gives IP address of your ESP-01 (Wifi Module). This ESP 8266-01 Server is mobile responsive and it can be accessed with any device with a browser in your local network.

CREATE A Local Host SERVER USING ARDUINO IDE.

Prepare the Arduino ide.

Step 1. Download and install the Arduino IDE on your operating system (some older versions won’t work).

Step2. Then, you need to install the ESP8266 add-on for the Arduino IDE. For that, go to File > Preferences.

Step3. Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into the “Additional Board Manager URLs” field as shown in the figure below. Then, click the “OK” button.

Step 4. Go to Tools > Board > Boards Manager…

Step 5. Select the “ESP8266 by esp8266 by ESP8266 Community”, as shown in the figure below.

Step 6. Uplaod blank code to your Arduino which is connected to your port.Make sure your Board(arduino-uno) and Port(check your connected port)are selected.

Step 7:Download ESP-01 firmware

Link for firmware download:https://drive.google.com/open?id=1It2dWFbM6CyQeSdwr5qjJ3vy0RY6EXVY

Pin Diagram: All the connection are shown here

Step 8.After downloading ESP-01 firmware from the above link you have to Unzip that file on desktop.Once you have done with that make the proper connection shown in the pin diagram and connect arduino to your laptop.

Step 9:Open that folder which you have downloaded and click on 4th option which is esp8266_flasher.

Do not forget to connect GND pin of arduino to RESET pin of arduino which will disconnect the arduino micro-controller and activate your ESP 8266-01 Wifi module to upload the code to ESP memory.

Step 10: esp8266_flasher ->BIN ->al.v0.9.5.0 AT Firmare.bin ->Enter your port which you can see in arduino.ide. After all this step click on donwload.

You will see this type of uplaoding once you click on download

Copy paste the below code on your arduino.ide :-

#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
ESP8266WebServer server (80);
const char* ssid = “IOT”; //Enter Wi-Fi SSID
const char* password = “koenigsegg”; //Enter Wi-Fi Password.
void setup()
{
Serial.begin(115200); //Begin Serial at 115200 Baud
WiFi.begin(ssid, password); //Connect to the WiFi network
while (WiFi.status () != WL_CONNECTED) { //Wait for connection
delay (500);
Serial.println(“Waiting to connect…”);
Serial.print(“IP address: “);

Serial.println(WiFi.localIP ());
}
//Print the local IP
server.on(“/”, handle_index); //Handle Index page
server.begin(); //Start the server
Serial.print (“Server listening”);
}
void loop ()
{
server.handleClient ();//Handling of incoming client requests
}
void handle_index()
{
//print Hellonat opening homepage
server.send(200,”text/plain”,”Hello! This is an index page.”);
}

Step 11:Now go to tools. In that select board and then click on board manger. Select type ALL and search esp and then select esp by esp community and installed the latest version .

Step 12:After that go in code and change SSID and Password of your Wifi on which you are connected.

Step 13:Now select com port and board which is Generic ESP8266 Module and after that compile and upload your code.

If you had followed the above steps properly you will see the output as Hard reseting via RTS pin ……

Step 14:Now you have to disconnect your arduino and remove GPIO(0) pin from your Esp8266-01 Wifi Module and after doing this you have to connect your arduino once again.

OUTPUT:After you have connected your arduino go to Serial Moniter and you will see the IP address of your module as a output.

You Can Refer to our vedio for the same as a guide, for more proper understanding.

Published by Gnd_To_Vcc

Here to spread my knowledge . Knowledge should always be spread not stored.

3 thoughts on “Code for obtaining IP Address from Esp-01

    1. You sometimes get this error when you copy and paste the code from a website, while it only happens sometimes on some systems, if you get such error :
      Solution:- for this code just replace all the double inverted commas with your keyboard the same input(“) double inverted commas.
      This will surely solve your problem.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create your website with WordPress.com
Get started
%d bloggers like this: