{"id":67,"date":"2026-02-23T14:16:21","date_gmt":"2026-02-23T13:16:21","guid":{"rendered":"https:\/\/elrebo.de\/?p=67"},"modified":"2026-02-26T12:43:18","modified_gmt":"2026-02-26T11:43:18","slug":"wifi_manager","status":"publish","type":"post","link":"https:\/\/www.elrebo.de\/index.php\/2026\/02\/23\/wifi_manager\/","title":{"rendered":"wifi_manager"},"content":{"rendered":"\n<p>An ESP-IDF component for <a href=\"https:\/\/elrebo.de\/index.php\/2026\/02\/20\/physical-computing\/\" data-type=\"post\" data-id=\"59\">Physical Computing<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Purpose<\/h2>\n\n\n\n<p>Establish a Wifi connection on an ESP32 system.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How it is done<\/h2>\n\n\n\n<p>Wifi credentials are not given in the program code, they are stored in NVS flash storage.<\/p>\n\n\n\n<p>On Wifi startup if there are no credentials stored in NVS flash yet, the Wifi configuration is started. <\/p>\n\n\n\n<p>Otherwise the credentials from NVS flash are used. If a Wifi connection can be established everything is fine. If after 20 seconds no connection is established, the Wifi configuration is started.<\/p>\n\n\n\n<p>In Wifi configuration mode a Wifi access point is established at IP address <code>192.168.4.1<\/code>. You will find the Wifi network with name <code>ESP32-xxxx<\/code> in the list of available Wifi networks. The SSID prefix (&#8220;ESP32&#8221;) can be changed in the constructor of class Wifi.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"354\" height=\"70\" src=\"https:\/\/elrebo.de\/wp-content\/uploads\/2026\/02\/Bildschirmfoto-2026-02-24-um-12.01.17.png\" alt=\"\" class=\"wp-image-98\" srcset=\"https:\/\/www.elrebo.de\/wp-content\/uploads\/2026\/02\/Bildschirmfoto-2026-02-24-um-12.01.17.png 354w, https:\/\/www.elrebo.de\/wp-content\/uploads\/2026\/02\/Bildschirmfoto-2026-02-24-um-12.01.17-300x59.png 300w\" sizes=\"auto, (max-width: 354px) 100vw, 354px\" \/><\/figure>\n\n\n\n<p>If you connect to this network a captive portal is started where you can find a list of all available Wifi SSIDs. The initial presentation language can be set in the constructor of class Wifi. Here you choose your SSID and enter the password.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"661\" src=\"https:\/\/elrebo.de\/wp-content\/uploads\/2026\/02\/Bildschirmfoto-2026-02-24-um-12.02.12-1024x661.png\" alt=\"\" class=\"wp-image-96\" srcset=\"https:\/\/www.elrebo.de\/wp-content\/uploads\/2026\/02\/Bildschirmfoto-2026-02-24-um-12.02.12-1024x661.png 1024w, https:\/\/www.elrebo.de\/wp-content\/uploads\/2026\/02\/Bildschirmfoto-2026-02-24-um-12.02.12-300x194.png 300w, https:\/\/www.elrebo.de\/wp-content\/uploads\/2026\/02\/Bildschirmfoto-2026-02-24-um-12.02.12-768x496.png 768w, https:\/\/www.elrebo.de\/wp-content\/uploads\/2026\/02\/Bildschirmfoto-2026-02-24-um-12.02.12-1536x991.png 1536w, https:\/\/www.elrebo.de\/wp-content\/uploads\/2026\/02\/Bildschirmfoto-2026-02-24-um-12.02.12.png 1810w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The credentials (SSID and password) are stored in NVS flash storage and the Wifi is connected.<\/p>\n\n\n\n<p>This component depends on <a href=\"https:\/\/components.espressif.com\/components\/78\/esp-wifi-connect\/versions\/3.1.1\/readme\">78\/esp-wifi-connect<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Where to find it<\/h2>\n\n\n\n<p><code>wifi_manager<\/code> is published on the ESP Registry at <a href=\"https:\/\/components.espressif.com\/components\/elrebo-de\/wifi_manager\">https:\/\/components.espressif.com\/components\/elrebo-de\/wifi_manager<\/a>.<\/p>\n\n\n\n<p>The source code can be found at <a href=\"https:\/\/github.com\/elrebo-de\/wifi_manager\">https:\/\/github.com\/elrebo-de\/wifi_manager<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to use it<\/h2>\n\n\n\n<p>As an ESP-IDF component wifi_manager must be included into idf_component.yml as a dependency. As usual this can be done by executing this command:<\/p>\n\n\n\n<p><code>idf.py add-dependency \"elrebo-de\/wifi_manager^1.4.1\"<\/code><\/p>\n\n\n\n<p>In CMakeLists.txt <code>\"elrebo-de__wifi_manager\"<\/code> has to be added as a requirement.<\/p>\n\n\n\n<p>Now you can include <code>wifi_manager.hpp<\/code> and use the Wifi class in your program:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"992\" height=\"1024\" src=\"https:\/\/elrebo.de\/wp-content\/uploads\/2026\/02\/Bildschirmfoto-2026-02-23-um-14.10.13-992x1024.png\" alt=\"\" class=\"wp-image-86\" srcset=\"https:\/\/www.elrebo.de\/wp-content\/uploads\/2026\/02\/Bildschirmfoto-2026-02-23-um-14.10.13-992x1024.png 992w, https:\/\/www.elrebo.de\/wp-content\/uploads\/2026\/02\/Bildschirmfoto-2026-02-23-um-14.10.13-291x300.png 291w, https:\/\/www.elrebo.de\/wp-content\/uploads\/2026\/02\/Bildschirmfoto-2026-02-23-um-14.10.13-768x793.png 768w, https:\/\/www.elrebo.de\/wp-content\/uploads\/2026\/02\/Bildschirmfoto-2026-02-23-um-14.10.13.png 1368w\" sizes=\"auto, (max-width: 992px) 100vw, 992px\" \/><\/figure>\n\n\n\n<p>There are three parameters in the constructor of class Wifi:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>tag &#8211; the tag used for logging from this instance of Wifi class<\/li>\n\n\n\n<li>ssid_prefix &#8211; the prefix used for the SSID in configuration mode<\/li>\n\n\n\n<li>language &#8211; the language used in the captive portal of the configuration mode<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>An ESP-IDF component for Physical Computing Purpose Establish a Wifi connection on an ESP32 system. How it is done Wifi credentials are not given in the program code, they are stored in NVS flash storage. On Wifi startup if there are no credentials stored in NVS flash yet, the Wifi configuration is started. Otherwise the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":96,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-67","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oss"],"_links":{"self":[{"href":"https:\/\/www.elrebo.de\/index.php\/wp-json\/wp\/v2\/posts\/67","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.elrebo.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.elrebo.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.elrebo.de\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.elrebo.de\/index.php\/wp-json\/wp\/v2\/comments?post=67"}],"version-history":[{"count":6,"href":"https:\/\/www.elrebo.de\/index.php\/wp-json\/wp\/v2\/posts\/67\/revisions"}],"predecessor-version":[{"id":129,"href":"https:\/\/www.elrebo.de\/index.php\/wp-json\/wp\/v2\/posts\/67\/revisions\/129"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.elrebo.de\/index.php\/wp-json\/wp\/v2\/media\/96"}],"wp:attachment":[{"href":"https:\/\/www.elrebo.de\/index.php\/wp-json\/wp\/v2\/media?parent=67"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.elrebo.de\/index.php\/wp-json\/wp\/v2\/categories?post=67"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.elrebo.de\/index.php\/wp-json\/wp\/v2\/tags?post=67"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}