Shop OBEX P1 Docs P2 Docs Learn Events
ESP 8266 Static IP Help — Parallax Forums

ESP 8266 Static IP Help

Need help please setting static IP on a ESP8266 that can be seen on my test router.

I've flashed the ESP8266 (ESP), successfully to run at 115200, and can see the MAC address, etc. So from that perspective I'm successful. When I configure the esp to be in mode 1 (station) and check the internal IP, it is 0.0.0.0
If I enable DHCP and join the network, I can "see" the device on my router with the assigned IP inside the DHCP range (100 -254), so again, it works and is on the network.

If I disable, DHCP on the ESP, and assign an IP, the static IP takes. I know this since I can power down the ESP and repower and query the IP with AT+CIFSR and the desired IP is reported back. BUT in spite of all that the static IP does not appear on my router.

I'm missing some simple step in the configuration.


AT+RESTORE \\Restore, clears to default cofiguration
AT+CWMODE=1 \\Set to Station mode, IP becomes 0.0.0.0
AT+CWDHCP=1,0 \\Disable DHCP
AT+CIPSTA="192.168.1.24","192.168.1.1","255.255.255.0" \\Set static IP, Gateway, Network Mask
AT+CWJAP="hobby","stopsign" \\Join AP SSID and password
AT+CIFSR \\Verify IP

Thanks for the assistance.
Regards,
Steve

Comments

  • What version of code are you using on the ESP8266. According to the v1.5.4_0 doc, "AT_CIPSTA" has been deprecated and you should use:
    AT+CIPSTA_CUR - Set IP address of ESP8266 station (Will not save to flash so don't reboot"
    AT+CIPSTA_DEF - same as above but will save to flash.

    However, the following is used to start a connection as a client:
    AT+CIPSTART =type, addr, port

    The ESP8266 WiKi has more details.
    https://itead.cc/wiki/ESP8266_Serial_WIFI_Module
  • Thank You for the response.

    AT+GMR
    ** system response
    AT version:0.21.0.0
    SDK version:0.9.5

    It is very possible I'm using the "wrong" or old firmware.
    Are there any suggestions on an appropriate AT command BIN file?

    I tried updating the IP using the suggested command AT+CIPSTA, see sequence below.

    AT+CIFSR
    ** system response which is the DHCP IP
    +CIFSR:STAIP,"192.168.1.100"
    +CIFSR:STAMAC,"18:fe:34:99:d5:c6"

    OK

    AT+CWDHCP=1,0 **changing to station and non DHCP mode

    OK
    AT+CIPSTA_CUR="192.168.1.26" **Now try to make a static IP

    ERROR **Get an error message
    AT+CIFSR **Check the IP

    +CIFSR:STAIP,"192.168.1.24" ****this is the static IP in memory
    +CIFSR:STAMAC,"18:fe:34:99:d5:c6"

    OK
    I got the same result with:

    AT+CIPSTA_DEF="192.168.1.26"


    Any direction on a good BIN file for AT commands is appreciated. All I want to eventually do is use the ESP modules to eventually pass sensor data back to a centralized location.

    Thanks
    Steve

  • If I disable, DHCP on the ESP, and assign an IP, the static IP takes. I know this since I can power down the ESP and repower and query the IP with AT+CIFSR and the desired IP is reported back. BUT in spite of all that the static IP does not appear on my router.

    Have you tried to just ping the IP assigned to the ESP module to see if it works ?
  • Good point. At your suggestion I did, and the ping to 192.168.1.24 was successful.

    Thanks
    Steve
Sign In or Register to comment.