0

I have programmed an ESP8266 using the circuit and program below. I tried to open the SerialMonitor once the program is uploaded to the ESP8266. I am getting an error when I am trying to open the SerialMonitor.

Error opening serial port 'COM5'. (Incorrect serial port)

What is the way to get the IP address assigned to the ESP8266?

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
//SSID and Password of your wifi router
const char* ssid = "Moto";
const char* password = "reset1234";
ESP8266WebServer server(80);
void setup() {
 Serial.begin(9600);
 WiFi.begin(ssid, password); //Connect to your WiFi router
 Serial.println("");
 // Wait for connection
 while (WiFi.status() != WL_CONNECTED) {
 delay(500);
 Serial.print(".");
 }
 //If connection successful show IP address in serial monitor
 Serial.println("");
 Serial.print("Connected to ");
 Serial.println(ssid);
 Serial.print("IP address: ");
 Serial.println(WiFi.localIP()); //IP address assigned to your ESP
 server.begin(); //Start server
 Serial.println("HTTP server started");
}
void loop() {
 server.handleClient(); //Handle client requests
}

enter image description here

enter image description here

dda
1,5951 gold badge12 silver badges17 bronze badges
asked May 8, 2017 at 18:10
13
  • 1
    you can't run the wifi off the 3.3v of most ftdi adapters; when it's idle in the "ready to flash" mode, it uses less power and works just fine. power the ESP from an external source and your serial port should work again. Commented May 8, 2017 at 19:19
  • if you have GPIO permanently wired to GND, as your diagram implies, then your "sketch" will never be executed on the ESP Commented May 8, 2017 at 23:35
  • @dandavis do you mean that should I plug VCC and CH_PD of ESP8266 to other power source instead of FTDI ? I have 2XAA cell holder s3-ap-southeast-1.amazonaws.com/a2.datacaciques.com/wm/… and what voltage cell should I use here ? Commented May 9, 2017 at 4:34
  • @JaromandaX Alright, I will remove it so should we only GND to GND other than no wire to GND in any circuit ? Commented May 9, 2017 at 4:35
  • you are supposed to give the 01 3.3v. Two fresh AAs will probably be enough to get it working, but won't last the full battery charge. This is why ESP8266 devboards are popular. i keep a few of these around, but you can use an [email protected] and feed it the raw 5v to save cash... Commented May 9, 2017 at 4:38

2 Answers 2

4

If you give your board a name with

WiFi.hostname("MyESP8266");

(for example) you can then look on your router in the section that lists DHCP assignments (on my Netgear it's Attached Devices). That should then show you the IP address of all the attached devices, including the ESP8266 which you will easily identify by its name.

Another option is to use mDNS. Look at some of the examples that come with the ESP8266 core and libraries to see how.

answered May 8, 2017 at 19:46
1

I used the app "Fing" on my phone. It shows you the devices that are connected to your WiFi. After entering all freacking IP adress aviable, found that the last one was the one of my esp8266 and a beautiful window saying "hello from esp8266!" appeared.

answered Oct 2, 2017 at 1:52
1
  • I like that app :-) Small thing is that it doesn't work when you put your esp in deep sleep like I did ;-) Commented Dec 24, 2018 at 14:41

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.