{"id":113120,"date":"2023-02-13T17:02:50","date_gmt":"2023-02-13T11:32:50","guid":{"rendered":"https:\/\/www.electronicsforu.com\/?p=113120"},"modified":"2024-07-26T17:22:06","modified_gmt":"2024-07-26T11:52:06","slug":"esp32-as-camera-webserver","status":"publish","type":"post","link":"https:\/\/www.electronicsforu.com\/electronics-projects\/hardware-diy\/esp32-as-camera-webserver","title":{"rendered":"ESP32 As Camera Webserver"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-thumbnail wp-image-101636\" src=\"https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2022\/08\/efy-tested-2-150x150.jpg\" alt=\"\" width=\"150\" height=\"150\" \/>This small-size programmable camera can start taking pictures when motion is detected and transmit real-time videos. It can be hidden easily for espionage work due to its tiny size.<\/p>\n<p>The webserver camera can be designed in two versions. The first version described here can send real-time video over Wi-Fi. The author\u2019s prototype is shown in Fig. 1.<\/p>\n<figure id=\"attachment_113132\" aria-describedby=\"caption-attachment-113132\" style=\"width: 375px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-113132 size-medium\" src=\"https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2023\/01\/Fig.-1-Authors-prototype-1-375x500.jpg\" alt=\"Fig. 1: Author\u2019s prototype\" width=\"375\" height=\"500\" srcset=\"https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2023\/01\/Fig.-1-Authors-prototype-1-375x500.jpg 375w, https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2023\/01\/Fig.-1-Authors-prototype-1-768x1024.jpg 768w, https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2023\/01\/Fig.-1-Authors-prototype-1-300x400.jpg 300w, https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2023\/01\/Fig.-1-Authors-prototype-1-696x928.jpg 696w, https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2023\/01\/Fig.-1-Authors-prototype-1-38x50.jpg 38w, https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2023\/01\/Fig.-1-Authors-prototype-1-75x100.jpg 75w, https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2023\/01\/Fig.-1-Authors-prototype-1.jpg 945w\" sizes=\"auto, (max-width: 375px) 100vw, 375px\" \/><figcaption id=\"caption-attachment-113132\" class=\"wp-caption-text\">Fig. 1: Author\u2019s prototype<\/figcaption><\/figure>\n<p><center><iframe loading=\"lazy\" title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/X0kuYN3KkKg\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/center>The software code required for this webcam server is made in Arduino IDE. So, we first need to install the ESP32 to Arduino IDE by opening Preferences and pasting the following <a href=\"https:\/\/raw.githubusercontent.com\/espressif\/arduino-esp32\/gh-pages\/package_esp32_index.json\" target=\"_blank\" rel=\"noopener\">link<\/a> here.<\/p>\n<p>Next, open Board Manager, search ESP32 and install the board to Arduino IDE. After installing the latest Arduino IDE and selecting board for ESP32, if you go to \u201cfile\u2192example\u2192 esp32\u2192camera\u2192webserver\u201d you will see the ESP32 webcam project, which is already available there.<\/p>\n<p>Upload the code to ESP32 cam and search the address of ESP32 cam in the web browser. You can see the live video from ESP32 cam.<\/p>\n<h2>Adding OLED display<\/h2>\n<p>In the original code of ESP cam there was no multiplicity of Wi-Fi network choices and there was no way to know the IP address of the webcam, unless it was connected to a PC to see the serial terminal output. So, you can modify the code and add the code for the ESP32 to automatically connect to the best available Wi-Fi among all the networks in range.<\/p>\n<p>To modify, you need to replace the Wi-Fi SSID network names in the list and their passwords with your own Wi-Fi network\u2019s name and password. Then add the OLED display library in that. Next, get the IP address in the setup function and add the code line to display the IP address on the OLED display. The source code snippet is shown in Fig. 2.<\/p>\n<figure id=\"attachment_113133\" aria-describedby=\"caption-attachment-113133\" style=\"width: 800px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-113133 size-full\" src=\"https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2023\/01\/Fig.-2-Code-snippet-for-setting-Wi-Fi-SSIDs-list-and-passwords.jpg\" alt=\"Fig. 2: Code snippet for setting Wi-Fi SSIDs list and passwords\" width=\"800\" height=\"619\" srcset=\"https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2023\/01\/Fig.-2-Code-snippet-for-setting-Wi-Fi-SSIDs-list-and-passwords.jpg 800w, https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2023\/01\/Fig.-2-Code-snippet-for-setting-Wi-Fi-SSIDs-list-and-passwords-500x387.jpg 500w, https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2023\/01\/Fig.-2-Code-snippet-for-setting-Wi-Fi-SSIDs-list-and-passwords-696x539.jpg 696w, https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2023\/01\/Fig.-2-Code-snippet-for-setting-Wi-Fi-SSIDs-list-and-passwords-50x39.jpg 50w, https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2023\/01\/Fig.-2-Code-snippet-for-setting-Wi-Fi-SSIDs-list-and-passwords-100x77.jpg 100w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><figcaption id=\"caption-attachment-113133\" class=\"wp-caption-text\">Fig. 2: Code snippet for setting Wi-Fi SSIDs list and passwords<\/figcaption><\/figure>\n<table dir=\"ltr\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<colgroup>\n<col width=\"192\" \/>\n<col width=\"167\" \/>\n<col width=\"152\" \/><\/colgroup>\n<tbody>\n<tr>\n<td style=\"text-align: center;\" colspan=\"3\" rowspan=\"1\" data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Bill of Material&quot;}\"><strong>Bill of Material<\/strong><\/td>\n<\/tr>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Components&quot;}\"><strong>Components<\/strong><\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Quantity&quot;}\"><strong>Quantity<\/strong><\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Description&quot;}\"><strong>Description<\/strong><\/td>\n<\/tr>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;ESP32 with camera&quot;}\">ESP32 with camera<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:3,&quot;3&quot;:1}\">1<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;ESP32 cam&quot;}\">ESP32 cam<\/td>\n<\/tr>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;OLED display (24.4mm)&quot;}\">OLED display (24.4mm)<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:3,&quot;3&quot;:1}\">1<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;SSD1306&quot;}\">SSD1306<\/td>\n<\/tr>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;USB-to-Serial FTDI chip&quot;}\">USB-to-Serial FTDI chip<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:3,&quot;3&quot;:1}\">1<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;USB programmer&quot;}\">USB programmer<\/td>\n<\/tr>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Battery\/5V DC adaptor&quot;}\">Battery\/5V DC adaptor<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:3,&quot;3&quot;:1}\">1<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Power supply&quot;}\">Power supply<\/td>\n<\/tr>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;LM11173.3&quot;}\">LM11173.3<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:3,&quot;3&quot;:1}\">1<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Voltage regulator&quot;}\">Voltage regulator<\/td>\n<\/tr>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Diode&quot;}\">Diode<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:3,&quot;3&quot;:1}\">1<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;1N4007&quot;}\">1N4007<\/td>\n<\/tr>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Capacitor C1&quot;}\">Capacitor C1<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:3,&quot;3&quot;:1}\">1<\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;100\u00b5F, 10V&quot;}\">100\u00b5F, 10V<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Circuit and working<\/h2>\n<div class=\"mepr_error\"><div class=\"locked-content\">\n<b>EFY++ CONTENT: ACCESS TO THIS CONTENT IS FREE! BUT YOU NEED TO BE A REGISTERED USER.<\/b><\/p>\n<p>Oops! This is an EFY++ article, which means it's our Premium Content. You need to be a Registered User of our website to read its complete content.<\/p>\n<p><b>Good News: <\/b>You can register to our website for FREE! <a href=\"https:\/\/www.electronicsforu.com\/plans\/subscription-plans\" target=\"_blank\" rel=\"noopener\">CLICK HERE<\/a> to register now.<\/p>\n<p><b>Already a registered member? <\/b>If YES, then simply login to you account below. (TIP: Use 'forgot password' feature and reset and save your new password in your browser, if you forgot the last one!)\n<\/div>\n<\/div><div>\n<div class=\"mp_wrapper mp_login_form\">\n                  <!-- mp-login-form-start -->     <form name=\"mepr_loginform\" id=\"mepr_loginform\" class=\"mepr-form\" action=\"https:\/\/www.electronicsforu.com\/login\" method=\"post\">\n            <div class=\"mp-form-row mepr_username\">\n        <div class=\"mp-form-label\">\n                              <label for=\"user_login\">Username<\/label>\n        <\/div>\n        <input type=\"text\" name=\"log\" id=\"user_login\" value=\"\" \/>\n      <\/div>\n      <div class=\"mp-form-row mepr_password\">\n        <div class=\"mp-form-label\">\n          <label for=\"user_pass\">Password<\/label>\n          <div class=\"mp-hide-pw\">\n            <input type=\"password\" name=\"pwd\" id=\"user_pass\" value=\"\" \/>\n            <button type=\"button\" class=\"button mp-hide-pw hide-if-no-js\" data-toggle=\"0\" aria-label=\"Show password\">\n              <span class=\"dashicons dashicons-visibility\" aria-hidden=\"true\"><\/span>\n            <\/button>\n          <\/div>\n        <\/div>\n      <\/div>\n            <div>\n        <label><input name=\"rememberme\" type=\"checkbox\" id=\"rememberme\" value=\"forever\" \/> Remember Me<\/label>\n      <\/div>\n      <div class=\"mp-spacer\">&nbsp;<\/div>\n      <div class=\"submit\">\n        <input type=\"submit\" name=\"wp-submit\" id=\"wp-submit\" class=\"button-primary mepr-share-button \" value=\"Log In\" \/>\n        <input type=\"hidden\" name=\"redirect_to\" value=\"\/wp-json\/wp\/v2\/posts\/113120\" \/>\n        <input type=\"hidden\" name=\"mepr_process_login_form\" value=\"true\" \/>\n        <input type=\"hidden\" name=\"mepr_is_login_page\" value=\"false\" \/>\n      <\/div>\n    <\/form>\n    <div class=\"mp-spacer\">&nbsp;<\/div>\n    <div class=\"mepr-login-actions\">\n      <a href=\"https:\/\/www.electronicsforu.com\/login?action=forgot_password\">Forgot Password<\/a>\n    <\/div>\n\n      \n    <!-- mp-login-form-end --> \n  <\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This small-size programmable camera can start taking pictures when motion is detected and transmit real-time videos. It can be hidden easily for espionage work due to its tiny size. The webserver camera can be designed in two versions. The first version described here can send real-time video over Wi-Fi. The author\u2019s prototype is shown in [&hellip;]<\/p>\n","protected":false},"author":116810,"featured_media":113136,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,6070,3713,22,6189],"tags":[1985,1911,110,1921,83,10276],"class_list":{"0":"post-113120","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-hardware-diy","8":"category-advanced-projects","9":"category-premium","10":"category-electronics-projects","11":"category-esp32-projects","12":"tag-diy-projects","13":"tag-do-it-yourself","14":"tag-electronics-projects","15":"tag-esp32","16":"tag-featured","17":"tag-feb-2023"},"_links":{"self":[{"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/posts\/113120","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/users\/116810"}],"replies":[{"embeddable":true,"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/comments?post=113120"}],"version-history":[{"count":1,"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/posts\/113120\/revisions"}],"predecessor-version":[{"id":144924,"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/posts\/113120\/revisions\/144924"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/media\/113136"}],"wp:attachment":[{"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/media?parent=113120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/categories?post=113120"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/tags?post=113120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}