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

  • 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. – dandavis May 8 '17 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 – Jaromanda X May 8 '17 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 ? – N Sharma May 9 '17 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 ? – N Sharma May 9 '17 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 AMS1117@3.3v and feed it the raw 5v to save cash... – dandavis May 9 '17 at 4:38
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.

| improve this answer | |
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.

| improve this answer | |
  • I like that app :-) Small thing is that it doesn't work when you put your esp in deep sleep like I did ;-) – Amfasis Dec 24 '18 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.