{"id":99094,"date":"2020-09-16T10:13:00","date_gmt":"2020-09-16T10:13:00","guid":{"rendered":"https:\/\/randomnerdtutorials.com\/?p=99094"},"modified":"2020-09-16T16:53:26","modified_gmt":"2020-09-16T16:53:26","slug":"esp32-cam-access-point-ap-web-server","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/esp32-cam-access-point-ap-web-server\/","title":{"rendered":"ESP32-CAM: Set Access Point (AP) for Web Server (Arduino IDE)"},"content":{"rendered":"\n<p>This tutorial shows how to set your ESP32-CAM as an Access Point (AP) for your web server projects. This way, you don\u2019t need to be connected to a router to access the web server. We&#8217;ll program the ESP32-CAM using Arduino IDE.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/ESP32-CAM-Access-Point-Tutorial.jpg?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32-CAM Set Access Point AP for Web Server Arduino IDE\" class=\"wp-image-99095\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/ESP32-CAM-Access-Point-Tutorial.jpg?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/ESP32-CAM-Access-Point-Tutorial.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/ESP32-CAM-Access-Point-Tutorial.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/ESP32-CAM-Access-Point-Tutorial.jpg?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Access Point vs Station<\/h2>\n\n\n\n<p>In previous <a href=\"https:\/\/randomnerdtutorials.com\/projects-esp32-cam\/\">ESP32-CAM web server projects<\/a>, we connect the ESP32-CAM to a wireless router. In this configuration, we can access the ESP32-CAM board through the local network.<\/p>\n\n\n\n<p>In this scenario, the router acts as an access point and the ESP32-CAM board is set as a station. So, you need to be connected to your router (local network) to control and access the ESP32-CAM web server.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"1200\" height=\"613\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/ESP32-CAM-Station.png?resize=1200%2C613&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32-CAM Station connects to Router\" class=\"wp-image-99096\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/ESP32-CAM-Station.png?w=1668&amp;quality=100&amp;strip=all&amp;ssl=1 1668w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/ESP32-CAM-Station.png?resize=300%2C153&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/ESP32-CAM-Station.png?resize=1024%2C523&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/ESP32-CAM-Station.png?resize=768%2C392&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/ESP32-CAM-Station.png?resize=1536%2C785&amp;quality=100&amp;strip=all&amp;ssl=1 1536w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n\n<p>In some cases, this might not be the best configuration (when you don\u2019t have a router nearby). But if you set the ESP32-CAM boards as an access point (hotspot), you can be connected using any device with Wi-Fi capabilities without the need to connect to your router.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"1200\" height=\"705\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/ESP32-CAM-Access-Point.png?resize=1200%2C705&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32-CAM set as a Soft Access Point\" class=\"wp-image-99097\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/ESP32-CAM-Access-Point.png?w=1456&amp;quality=100&amp;strip=all&amp;ssl=1 1456w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/ESP32-CAM-Access-Point.png?resize=300%2C176&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/ESP32-CAM-Access-Point.png?resize=1024%2C602&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/ESP32-CAM-Access-Point.png?resize=768%2C452&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n\n<p>Basically, when you set the ESP32-CAM as an access point you create its own Wi-Fi network and nearby Wi-Fi devices (stations) can connect to it (like your smartphone or your computer).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Soft Access Point<\/h2>\n\n\n\n<p>Because the ESP32-CAM doesn\u2019t connect further to a wired network (like your router), it is called soft-AP (soft Access Point).<\/p>\n\n\n\n<p>This means that if you try to load libraries or use firmware from the internet, it will not work (like including JavaScript libraries). It also doesn\u2019t work if you try to make HTTP requests to services on the internet (like sending an email with a photo, for example).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">ESP32-CAM Video Web Server Access Point (AP)<\/h2>\n\n\n\n<p>In this tutorial, we\u2019ll show you how to set the ESP32 as an access point. As an example, we\u2019ll modify the <a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-video-streaming-face-recognition-arduino-ide\/\">CameraWebServer project<\/a> that comes with the Arduino IDE. Then, you should be able to modify any of your projects to set the ESP32-CAM as an access point.<\/p>\n\n\n\n<p>In your Arduino IDE, go to <strong>File <\/strong>&gt; <strong>Examples <\/strong>&gt; <strong>ESP32 <\/strong>&gt; <strong>Camera <\/strong>&gt; <strong>CameraWebServer<\/strong>.<\/p>\n\n\n\n<p>Then, modify the code to act as an access point as we\u2019ll explain.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Customize the SSID and Password<\/h3>\n\n\n\n<p>You need to define an SSID name and a password to access the ESP32-CAM access point. In this example we\u2019re setting the ESP32 SSID name to <strong>ESP32-CAM Access Point<\/strong>. You can modify the name to whatever you want. The password is <strong>123456789<\/strong>, but you can and should also modify it.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>const char* ssid = \"ESP32-CAM Access Point\";\nconst char* password = \"123456789\";<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Setting the ESP32-CAM as an Access Point<\/h3>\n\n\n\n<p>In the <span class=\"rnthl rntliteral\">setup()<\/span>, remove the following lines (set the ESP32 as a station):<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>WiFi.begin(ssid, password);\nwhile (WiFi.status() != WL_CONNECTED) {\n  delay(500);\n  Serial.print(\".\");\n}\nSerial.println(\"\");\nSerial.println(\"WiFi connected\");<\/code><\/pre>\n\n\n\n<p>And add the following to set the ESP32 as an access point using the <span class=\"rnthl rntliteral\">softAP()<\/span> method:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>WiFi.softAP(ssid, password);<\/code><\/pre>\n\n\n\n<p>There are also other optional parameters you can pass to the <span class=\"rnthl rntliteral\">softAP()<\/span> method. Here\u2019s all the parameters:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>softAP(const char* ssid, const char* password, int channel, int ssid_hidden, int max_connection)<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li><span class=\"rnthl rntliteral\">ssid<\/span> (defined earlier): maximum of 63 characters;<\/li><li><span class=\"rnthl rntliteral\">password<\/span> (defined earlier): minimum of 8 characters; set to NULL if you want the access point to be open<\/li><li><span class=\"rnthl rntliteral\">channel<\/span>: Wi-Fi channel number (1-13)<\/li><li><span class=\"rnthl rntliteral\">ssid_hidden<\/span>: (0 = broadcast SSID, 1 = hide SSID)<\/li><li><span class=\"rnthl rntliteral\">max_connection<\/span>: maximum simultaneous connected clients (1-4)<\/li><\/ul>\n\n\n\n<p>This is what you need to include in your web server sketches to set the ESP32-CAM as an access point.<\/p>\n\n\n\n<p>You can <a href=\"https:\/\/github.com\/RuiSantosdotme\/ESP32-CAM-eBook\/blob\/master\/Code\/Extra\/CameraWebServer_Access_Point.zip?raw=true\" target=\"_blank\" rel=\"noreferrer noopener\">download the complete code here<\/a>. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Connecting to the ESP32-CAM Access Point<\/h2>\n\n\n\n<p>After uploading the code, you can connect to the ESP32-CAM access point to access the web server. You don\u2019t need to connect to a router.<\/p>\n\n\n\n<p>In your smartphone open your Wi-Fi settings and tap the <strong>ESP32-CAM Access Point<\/strong> network:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Connect-to-ESP32-CAM-access-point.png?resize=540%2C412&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Connect to ESP32-CAM Access Point Smartphone\" class=\"wp-image-99098\" width=\"540\" height=\"412\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Connect-to-ESP32-CAM-access-point.png?w=1080&amp;quality=100&amp;strip=all&amp;ssl=1 1080w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Connect-to-ESP32-CAM-access-point.png?resize=300%2C229&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Connect-to-ESP32-CAM-access-point.png?resize=1024%2C781&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Connect-to-ESP32-CAM-access-point.png?resize=768%2C586&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 540px) 100vw, 540px\" \/><\/figure><\/div>\n\n\n\n<p>Type the password you\u2019ve defined earlier in the code.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Connect-ESP32-CAM-Access-Point-Insert-Password.png?resize=467%2C481&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Connect to ESP32-CAM Access Point Smartphone Insert Password\" class=\"wp-image-99099\" width=\"467\" height=\"481\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Connect-ESP32-CAM-Access-Point-Insert-Password.png?w=934&amp;quality=100&amp;strip=all&amp;ssl=1 934w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Connect-ESP32-CAM-Access-Point-Insert-Password.png?resize=291%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 291w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Connect-ESP32-CAM-Access-Point-Insert-Password.png?resize=768%2C791&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 467px) 100vw, 467px\" \/><\/figure><\/div>\n\n\n\n<p>Open your web browser and type the IP address <strong>192.168.4.1<\/strong>. The video streaming web server page should load:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Video-Streaming-Web-Server-ESP32-CAM-Access-Point.png?resize=375%2C792&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Video Streaming Web Server ESP32-CAM Access Point\" class=\"wp-image-99100\" width=\"375\" height=\"792\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Video-Streaming-Web-Server-ESP32-CAM-Access-Point.png?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Video-Streaming-Web-Server-ESP32-CAM-Access-Point.png?resize=142%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 142w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Video-Streaming-Web-Server-ESP32-CAM-Access-Point.png?resize=485%2C1024&amp;quality=100&amp;strip=all&amp;ssl=1 485w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Video-Streaming-Web-Server-ESP32-CAM-Access-Point.png?resize=728%2C1536&amp;quality=100&amp;strip=all&amp;ssl=1 728w\" sizes=\"(max-width: 375px) 100vw, 375px\" \/><\/figure><\/div>\n\n\n\n<p>\u2003<br>To connect to the access point on your computer, go to the Network and Internet Settings, select the \u201cESP32-Access-Point\u201c and insert the password.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"360\" height=\"424\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Connect-to-ESP32-CAM-Access-Point-Computer.png?resize=360%2C424&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Connect to ESP32-CAM Access Point Computer\" class=\"wp-image-99101\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Connect-to-ESP32-CAM-Access-Point-Computer.png?w=360&amp;quality=100&amp;strip=all&amp;ssl=1 360w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Connect-to-ESP32-CAM-Access-Point-Computer.png?resize=255%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 255w\" sizes=\"(max-width: 360px) 100vw, 360px\" \/><\/figure><\/div>\n\n\n\n<p>And it\u2019s done! Now, to access the ESP32-CAM web server page, you just need to type the IP address 192.168.4.1 in your browser.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p>In this tutorial you\u2019ve learned how to set the ESP32-CAM as an access point in your web server sketches. When the ESP32 is set as an access point, devices with Wi Fi capabilities like your smartphone can connect directly to the ESP without the need to connect to a router.<\/p>\n\n\n\n<p>If you like the ESP32-CAM, take a look at our resources:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-projects-ebook\/\">Build ESP32-CAM Projects using Arduino IDE eBook<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/projects-esp32-cam\/\">More ESP32-CAM Projects and Tutorials&#8230;<\/a><\/li><\/ul>\n\n\n\n<p>Thanks for reading.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to set your ESP32-CAM as an Access Point (AP) for your web server projects. This way, you don\u2019t need to be connected to a router to &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"ESP32-CAM: Set Access Point (AP) for Web Server (Arduino IDE)\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-access-point-ap-web-server\/#more-99094\" aria-label=\"Read more about ESP32-CAM: Set Access Point (AP) for Web Server (Arduino IDE)\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":5,"featured_media":99095,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[281,319,264],"tags":[],"class_list":["post-99094","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-esp32-project","category-esp32-cam","category-project"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/ESP32-CAM-Access-Point-Tutorial.jpg?fit=1280%2C720&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/99094","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=99094"}],"version-history":[{"count":0,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/99094\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/99095"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=99094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=99094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=99094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}