-->
Page 1 of 2

ESP-01 changes IP after request

PostPosted: Thu Jul 30, 2015 4:21 am
by jather
Hi,

I hope I did not miss the topic if there was already one about my porblem but I could not find any.

my goal is to run a webserver on my ESP-01. The problem is that the ESP keeps changing the IP after every request.

It seems like the ESP disconnects and reconnects after finishing a request. I added
Code: Select allSerial.print("eventCallback: ");
Serial.println(event->event);
to ESP8266WiFiClass::_eventCallback in ESP8266WiFi.cpp and discovered, that after finishing server.send there is output
Code: Select alleventCallback: 1
eventCallback: 0

According to user_interface.h that means the ESP disconnects and reconnects.
I know I could try to use static IPs, but I don't want to set static IPs as they are no suitable solution for me, so please don't suggest it. The reason is, that I plan to use more ESPs in different environments. One (or more) should be used at work, where I can NOT use static IPs.

Has anyone gotten similar problems or maybe a clue what's going on? Or can somebody tell me how to tell the ESP not to disconnect from my AP after finishing a request?

Re: ESP-01 changes IP after request

PostPosted: Thu Jul 30, 2015 9:27 pm
by martinayotte
Your problem is not clearly described...
Is the ESP running in STA or SoftAP mode ?
What kind of firmware are you using ?
Because IP is not suppose to change, even with your router DHCP in STA mode connection where it is suppose to handle reservation based on MAC address, if not, maybe your router is defective.
And in SoftAP mode, it should be always 192.168.4.1, except if you changed the configs.

Re: ESP-01 changes IP after request

PostPosted: Fri Jul 31, 2015 1:42 am
by jather
martinayotte wrote:Is the ESP running in STA or SoftAP mode ?

Both, I'm trying to do something like this
http://www.john-lassen.de/index.php/pro ... -webconfig

martinayotte wrote:What kind of firmware are you using ?

I'm not sure... first I played with AT-Command. After a while I changed to nodeMcu. Then I saw I could programm the ESP with ArduinoIDE, so I flashed back a firmware called "esp_init_data_default.bin" included to nodemcu-firmware-flasher I found on github. As I can upload sketches and see output on Serial I thought everything is fine. So you think firmware could be broken? I thought Arduino IDE flashes "firmware" (together with the sketch) everytime I upload a sketch?

martinayotte wrote:Because IP is not suppose to change, even with your router DHCP in STA mode connection where it is suppose to handle reservation based on MAC address, if not, maybe your router is defective.

Tomorrow I can try with a different router. But all other devices work as intended at my home...
martinayotte wrote:And in SoftAP mode, it should be always 192.168.4.1, except if you changed the configs.

SoftAP works perfect, but I don't want to switch WLAN every time I want to connect to the ESP. I only want to connect once to ESP (with SoftAP) to setup STA-Mode. Actually it works! But I get only one page over STA mode on the IP my router gave the ESP initaly. After the first request ESP changes STA-IP. After second request ESPs IP changes to next IP, and so on...

Re: ESP-01 changes IP after request

PostPosted: Fri Jul 31, 2015 8:44 am
by martinayotte
So, you are using the ArduinoIDE (yes, it take care of flashing everything needed for it firmware).
The WebConfig project is working fine, and I don't see IPAddr changes with it.
If it not the router, I don't see where is the problem. Maybe check the power supply used by your ESP.