Saturday, February 4, 2017

Duck DNS ESP8266 mini WiFi client

This is a Duck DNS ESP8266 mini WiFi client.

Duck DNS ( is a free Dynamic DNS (DDNS) service.
It as a few client available for many operating system and a few routers.
A friend of mine runs a router that does not support any of the Duck DNS update mode. Instead of loading his operating system with the Duck DNS updater, or installing an openwrt router, I've implemented an ESP8266 client.

It is powered by USB, it can also be powered by the router USB port.
It's built on a pretty old ESP-01 board.
It has two led, one is the ESP-01 WiFi connection status embedded one, the other is connected to the GPIO2 port, and it's used for the DNS update status.

We need just a 3.3 voltage regulator to run this board using any 5V USB power output capable of 200mA.
The code is written using the Arduino IDE + ESP8266 core, to me that's the fastest and simple way to work with ESP8266.

The WiFiManager library ( is used to facilitate the WiFi connection of this module.

Also it runs a web server that allow any user to setup the DuckDNS connection parameters.
User can set the DDNS domain name and token, and also the update interval and the module hostname, that way one can just forget the module IP and open the web configuration page by board name. The default board name is espduckdns001, so the web page address is http://espduckdns001


  • read risk disclaimer
  • excuse my bad english


  1. Dear Good evening I find very interesting the project but faces a small problem with the code when I go to compile my displays any errors with arduino I'm already 1.8.1.

    (Arduino: 1.8.1 (Windows 10), board: "Generic ESP8266 Module, Serial, 80 MHz, 40MHz, DIO, 115200, 1M (512K SPIFFS), ck")

    ESPDuckDNS: 426: error: 'HTTP_CODE_OK' was not declared in this scope

         (If (httpCode == HTTP_CODE_OK) {)


    '' Exit status 1
    'HTTP_CODE_OK' was not declared in this purpose

    If you can please help.

    Sorry for the miserable englise



    1. Hello, thank you. I think your issue is that you do not have the ESp8266HttpClient library installed. I've checked right now, on Arduino 1.8.1, it compiles.

  2. Using Arduino 1.8.0, under ubuntu, everything work flawlessy.
    Spectacular ideea and professionally done work, thank you for sharing this enormous amount of knowledge, Davide Gironi.

    1. Thank you! I really appreciate it.

    2. Dear friend thank you for an immediate answer to the problem solved I did uninstall and Resettlement Programmes thank you very much for your time

      Yours sincerely


    3. Salem
      i have the same problem how do you solve it

  3. Thank you very much for your design and code. Works great!!

  4. hello, i cant tray do work, the esp-01 ever freez, the led blue is on and no respose serial comunication.
    please could you help me.

    1. Hello, you have to debug it using uart as example. Or you can also double check your wiring, or trying other hardware if you have another esp8266.

  5. This comment has been removed by the author.

  6. Nice work, thanks!

    For those who don't want to mess with flashing an ESP-001, this should work on any ESP8266-based board such as NodeMCU, Weimos D1 mini, Adafruit Huzzah, etc.

    Works great for me on NodeMCU 1.0 with Arduino IDE 1.8.5 and ESP8266 board library 2.3.0. 2.6.3 had some compile errors that I was too lazy to fix.

  7. this will work with CH340 or CP2102 NodeMcu V3¿

    i wanna buy one of them from here:,searchweb201602_,searchweb201603_

    1. Hello shay, yes, it will work on any ESP8266. But i suggest you the CP2102 version, because the driver works with many OS.

    2. i got my order, from where i can start¿

    3. Dear shay, You just have to compile and upload the image to the ESP8266. You can find online many tutorial about this task.

    4. before i can start complie and upload, i need a few sketch libraries and board manager's, can you please name thus libraries¿

    5. Hello shay, if I remeber well It was Just WiFiManager, anyway you can find the list in the .ino project file.

    6. this is working PERFECT,

      BIG THANKS for you,

      now i can let go the crappy free no-ip service that annoying me every month to "renew" my free subscription

    7. That's great! Thank you for sharing your experience here.

    8. Thanks you again for you making this awsome project,

      If you think about the costs, for me its only 10nis (new israeli shekel) and i have a tiny server that will run forever

  8. This comment has been removed by a blog administrator.

  9. In function 'int ddnsUpdate()':
    sketch_oct26a:416:15: error: call to 'HTTPClient::begin' declared with attribute error: obsolete API, use ::begin(WiFiClient, url)
    416 | http.begin(getrequest);
    | ~~~~~~~~~~^~~~~~~~~~~~
    exit status 1
    call to 'HTTPClient::begin' declared with attribute error: obsolete API, use ::begin(WiFiClient, url)
    Can't figure out what's the problem. I'm not used to arduino, found this project useful in internet. So, if anyone know how to make this work please help me guys.

    1. This comment has been removed by the author.

    2. //send the request, retry on error
      int updateretries = 0;
      do {
      HTTPClient http;
      int httpCode = http.GET();
      if(httpCode == HTTP_CODE_OK) {
      String payload = http.getString();
      if(payload == "OK")
      updated = 1;

    3. Hello, you should check that you have installed all the library needed.

    4. ESP8266WiFi
      ESP8266HTTPClient --> I don't know why this particular include statement is not highlighted for me in orange color in code while all other libraries are highlighted.
      All these libraries are present in sketch>include library>contributed libraries, even ESP8266HTTPClient is also present.

    5. You are using newer libraries, 'HTTPClient::begin' is obsolete, you should change a litte the code in order to compile it correctly.

    6. what should i change? can you help me?
      or can i change the libraries to an older version?

    7. Unluckly I've not much time to code this. Take a look here: Let me know if it works.

    8. As I said I am a beginner to Arduino, I tried but I can't figure it out. But I'm creating a micro version of your project according to my use case. So it would be helpful for me if you could tell how did you manage to find the public ip address in your code. I followed [variable "getrequest" in ddnsUpdate() function] but can't find. HELP ME IF YOU COULD SPARE SOME TIME.