{"id":107690,"date":"2023-09-19T18:19:34","date_gmt":"2023-09-19T18:19:34","guid":{"rendered":"https:\/\/randomnerdtutorials.com\/?p=107690"},"modified":"2025-06-17T17:41:32","modified_gmt":"2025-06-17T17:41:32","slug":"esp32-cam-save-picture-firebase-storage","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/esp32-cam-save-picture-firebase-storage\/","title":{"rendered":"ESP32-CAM Save Picture in Firebase Storage"},"content":{"rendered":"\n<p>In this guide, you&#8217;ll learn how to take and upload a picture to Firebase Storage using the ESP32-CAM. You&#8217;ll create a Firebase project with Storage that allows you to store your files. Then, you can access your Firebase console to visualize the pictures or create a web app to display them (we&#8217;ll do this in a future tutorial). The ESP32-CAM will be programmed using Arduino IDE.<\/p>\n\n\n<div class=\"wp-block-image\">\n<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\/2021\/11\/ESP32-CAM-Firebase-Storage.jpg?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32-CAM Save Picture in Firebase Storage Tutorial Guide\" class=\"wp-image-107712\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/11\/ESP32-CAM-Firebase-Storage.jpg?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/11\/ESP32-CAM-Firebase-Storage.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/11\/ESP32-CAM-Firebase-Storage.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/11\/ESP32-CAM-Firebase-Storage.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<p class=\"rntbox rntclgray\"><em>Updated 19 September 2023.<\/em><\/p>\n\n\n\n<p><strong>Note:&nbsp;<\/strong>this project is compatible with any <a href=\"https:\/\/makeradvisor.com\/esp32-camera-cam-boards-review-comparison\/\" target=\"_blank\" rel=\"noreferrer noopener\">ESP32 Camera Board with the OV2640 camera<\/a>. You just need to make sure you use the right&nbsp;<a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-ai-thinker-pinout\/\">pinout for the board<\/a>&nbsp;you&#8217;re using.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is Firebase?<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"750\" height=\"196\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/09\/Firebase-Logo.png?resize=750%2C196&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Firebase Logo\" class=\"wp-image-169096\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/09\/Firebase-Logo.png?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/09\/Firebase-Logo.png?resize=300%2C78&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>Firebase is Google&#8217;s mobile application development platform that helps you build, improve, and grow your app. It has many services used to manage data from any Android, IOS, or web application like <a href=\"https:\/\/randomnerdtutorials.com\/esp32-esp8266-firebase-authentication\/\">authentication<\/a>,&nbsp;<a href=\"https:\/\/randomnerdtutorials.com\/esp32-firebase-realtime-database\/\">realtime database<\/a>,&nbsp;<a href=\"https:\/\/randomnerdtutorials.com\/esp32-firebase-web-app\/\">hosting<\/a>, storage, etc.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Project Overview<\/h2>\n\n\n\n<p>This simple tutorial exemplifies how to take and send photos taken with the ESP32-CAM to Firebase Storage. The ESP32-CAM takes a picture and sends it to Firebase every time it resets (press the RST button). The idea is that you add some sort of trigger that might be useful for your projects, like a <a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-pir-motion-detector-photo-capture\/\">PIR motion sensor<\/a> or a pushbutton, for example.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"755\" height=\"228\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/ESP32-CAM-Firebase-Storage-Project-Overview-update.png?resize=755%2C228&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-136613\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/ESP32-CAM-Firebase-Storage-Project-Overview-update.png?w=755&amp;quality=100&amp;strip=all&amp;ssl=1 755w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/ESP32-CAM-Firebase-Storage-Project-Overview-update.png?resize=300%2C91&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 755px) 100vw, 755px\" \/><\/figure><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>When the ESP32 first runs, it takes a new picture and saves it in the filesystem (LittleFS);<\/li>\n\n\n\n<li>The ESP32-CAM connects to Firebase as a user with email and password;<\/li>\n\n\n\n<li>The ESP32-CAM sends the picture to Firebase Storage;<\/li>\n\n\n\n<li>After that, you can go to your Firebase console to view the pictures;<\/li>\n\n\n\n<li>Later, you can build a web app that you can access from anywhere to display the ESP32-CAM pictures (we&#8217;ll create this in a future tutorial).<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Contents<\/h2>\n\n\n\n<p>Here&#8217;s a summary of the steps you need to follow to create this project.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><a href=\"#create-firebase-project\">Create a Firebase Project<\/a><\/li>\n\n\n\n<li><a href=\"#set-authentication-methods\">Set Authentication Methods<\/a><\/li>\n\n\n\n<li><a href=\"#create-storage-bucket\">Create Storage Bucket<\/a><\/li>\n\n\n\n<li><a href=\"#get-API-Key\">Get Project API Key<\/a><\/li>\n\n\n\n<li><span style=\"font-size: inherit;\"><a href=\"#esp32-cam-send-pictures-firebase\">ESP32-CAM Send Pictures to Firebase Storage<\/a><\/span><\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"create-firebase-project\">1) Create a Firebase Project<\/h2>\n\n\n\n<p>Follow the next instructions to create a new project on Firebase.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to <a href=\"https:\/\/firebase.google.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Firebase <\/a>and sign in using a Google Account.<\/li>\n\n\n\n<li>Go to the <a href=\"https:\/\/console.firebase.google.com\/\" target=\"_blank\" rel=\"noopener\" title=\"\">Firebase Console<\/a> and create a new project.<\/li>\n\n\n\n<li>Give a name to your project, for example: <em>ESP-Project,<\/em> and click <strong>Continue<\/strong>.<br><figure><img data-recalc-dims=\"1\" decoding=\"async\" class=\"wp-image-105729\" style=\"width: 750px;\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2025\/04\/1-create-firebase-project.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Set Up Firebase Project for ESP32 and ESP8266 Step 1\"><\/figure><\/li>\n\n\n\n<li>Next, enable or disable AI assistance for your project. This is optional.<br><figure><img data-recalc-dims=\"1\" decoding=\"async\" class=\"wp-image-105729\" style=\"width: 739px;\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2025\/04\/2-create-firebase-project-ai-assistance.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Set Up Firebase Project for ESP32 and ESP8266 - Enable AI assistant\"><\/figure><\/li>\n\n\n\n<li>Disable the option <em>Enable Google Analytics<\/em> for this project, as it is not needed. Then, click <strong>Create project<\/strong>.<br><figure><img data-recalc-dims=\"1\" decoding=\"async\" class=\"wp-image-105730\" style=\"width: 750px;\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2025\/04\/3-create-firebase-project.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Disable Google Analytics for firebase project\"><\/figure><\/li>\n\n\n\n<li>It will take a few seconds to set up your project. Click <strong>Continue <\/strong>when it&#8217;s ready.<br><figure><img data-recalc-dims=\"1\" decoding=\"async\" class=\"wp-image-105731\" style=\"width: 750px;\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2025\/04\/5-Firebase-project-ready.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Firebase Project for ESP32 Ready\"><\/figure><br><\/li>\n\n\n\n<li>You&#8217;ll be redirected to your Project console page.<br><figure><img data-recalc-dims=\"1\" decoding=\"async\" class=\"wp-image-105732\" style=\"width: 750px;\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2025\/04\/6-Firebase-console-ESP-project.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Firebase console project\"><\/figure><\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"set-authentication-methods\">2) Set Authentication Methods<\/h2>\n\n\n\n<p>You need to set authentication methods for your app. <\/p>\n\n\n\n<p>&#8220;Most apps need to know the identity of a user. In other words, it takes care of logging in and identifying the users (in this case, the ESP32). Knowing a user&#8217;s identity allows an app to securely save user data in the cloud &#8230;&#8221; To learn more about the authentication methods, you can <a href=\"https:\/\/firebase.google.com\/docs\/auth\" target=\"_blank\" rel=\"noreferrer noopener\">read the documentation<\/a>.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>On the left sidebar, click on <strong>Build <\/strong>&gt; <strong>Authentication <\/strong>and then on <strong>Get started<\/strong>. <br><figure><img data-recalc-dims=\"1\" decoding=\"async\" class=\"wp-image-105735\" style=\"width: 750px;\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2025\/04\/7-set-authentication.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Firebase project set authentication\"><\/figure><\/li>\n\n\n\n<li>There are several authentication methods like email and password, Google Account, Facebook account, and others.<figure><img data-recalc-dims=\"1\" decoding=\"async\" class=\"wp-image-105740\" style=\"width: 750px;\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2025\/04\/8-Firebase-authentication-methods.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"SFirebase authentication methods\"><\/figure><\/li>\n\n\n\n<li>Select <strong>Email\/Password<\/strong> and <strong>enable <\/strong>that authentication method. Then, click <strong>Save<\/strong>.<figure><img data-recalc-dims=\"1\" decoding=\"async\" class=\"wp-image-105741\" style=\"width: 750px;\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2025\/04\/9-enable-email-password-firebase.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Enable Email Password Sign in Firebase\"><\/figure><\/li>\n\n\n\n<li>Then, at the top, click on the <strong>Users <\/strong>tab. Then, click on <strong>Add user<\/strong>. <figure><img data-recalc-dims=\"1\" decoding=\"async\" class=\"wp-image-105741\" style=\"width: 750px;\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2025\/04\/10-add-user-email-password-firebase.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Firebase Create a new user\"><\/figure><\/li>\n\n\n\n<li>Create a new user with an email and password. The email can be your personal email. Create a password for that user (you need to remember the password later). Finally, click on <strong>Add user<\/strong>.<figure><img data-recalc-dims=\"1\" decoding=\"async\" class=\"wp-image-105741\" style=\"width: 750px;\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2025\/04\/11-add-user-email-pass.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Firebase add user email and password\"><\/figure><\/li>\n\n\n\n<li>The User will show up on the list of users. You can see information about the user, like when it was created, the last time it signed in, and its user UID.<figure><img data-recalc-dims=\"1\" decoding=\"async\" class=\"wp-image-105741\" style=\"width: 750px;\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2025\/04\/12-user-created-firebase.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Firebase User Created\"><\/figure><\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"create-storage-bucket\">3) Creating a Storage Bucket<\/h2>\n\n\n\n<p><strong>1)<\/strong> On the left sidebar, click on <strong>Build <\/strong>> <strong>Storage <\/strong>and then on <strong>Get started<\/strong>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"746\" height=\"597\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/Firebase-Project-Build-Storage.png?resize=746%2C597&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Firebase Console Create a Storage Bucket\" class=\"wp-image-171488\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/Firebase-Project-Build-Storage.png?w=746&amp;quality=100&amp;strip=all&amp;ssl=1 746w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/Firebase-Project-Build-Storage.png?resize=300%2C240&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 746px) 100vw, 746px\" \/><\/figure><\/div>\n\n\n<p>To use Firebase Storage, you need to upgrade your project to a paid plan. But don\u2019t worry \u2014 they offer 5GB of free storage, which is more than enough to run this and many other projects for a long time without paying anything. Additionally, you can set a maximum spending limit.<\/p>\n\n\n\n<p><strong>2)<\/strong> Create a billing account to link to your project.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"528\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/Firebase-Storage-Create-Billing-Acoount.png?resize=750%2C528&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Firebase Storage - Create a billing acount\" class=\"wp-image-171489\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/Firebase-Storage-Create-Billing-Acoount.png?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/Firebase-Storage-Create-Billing-Acoount.png?resize=300%2C211&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>Set the <em>Pay as you go<\/em> Blaze Plan.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"740\" height=\"755\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/Firabase-Storage-Pay-as-you-go-blaze-plan.jpg?resize=740%2C755&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Firebase Pay as You Go Blaze Plan\" class=\"wp-image-171490\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/Firabase-Storage-Pay-as-you-go-blaze-plan.jpg?w=740&amp;quality=100&amp;strip=all&amp;ssl=1 740w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/Firabase-Storage-Pay-as-you-go-blaze-plan.jpg?resize=294%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 294w\" sizes=\"(max-width: 740px) 100vw, 740px\" \/><\/figure><\/div>\n\n\n<p><strong>3)<\/strong> After creating and setting up your billing account and linking it to your project, return to your project console to create a <strong>Storage Bucket<\/strong>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"810\" height=\"376\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/Firebase-Storage-Get-Started.png?resize=810%2C376&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Firebase Storage Get Started\" class=\"wp-image-171491\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/Firebase-Storage-Get-Started.png?w=810&amp;quality=100&amp;strip=all&amp;ssl=1 810w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/Firebase-Storage-Get-Started.png?resize=300%2C139&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/Firebase-Storage-Get-Started.png?resize=768%2C357&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 810px) 100vw, 810px\" \/><\/figure><\/div>\n\n\n<p><strong>4)<\/strong> Select the database location.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"727\" height=\"551\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/Firabase-Set-Up-Default-Bucket.png?resize=727%2C551&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Firebase Set Up Default Storage Bucket\" class=\"wp-image-171492\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/Firabase-Set-Up-Default-Bucket.png?w=727&amp;quality=100&amp;strip=all&amp;ssl=1 727w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/Firabase-Set-Up-Default-Bucket.png?resize=300%2C227&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 727px) 100vw, 727px\" \/><\/figure><\/div>\n\n\n<p><strong>5)<\/strong> Select <em>Start in <strong>test mode<\/strong><\/em>\u2014click <strong>Next<\/strong>. We&#8217;ll change the storage rules later on.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/5-set-up-default-bucket.png?quality=100&#038;strip=all&#038;ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"744\" height=\"590\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/5-set-up-default-bucket.png?resize=744%2C590&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Firabase Storage Bucket Start in Test Mode\" class=\"wp-image-171494\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/5-set-up-default-bucket.png?w=744&amp;quality=100&amp;strip=all&amp;ssl=1 744w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/5-set-up-default-bucket.png?resize=300%2C238&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 744px) 100vw, 744px\" \/><\/a><\/figure><\/div>\n\n\n<p><strong>6)<\/strong> The storage bucket is now set up. Copy the storage bucket ID\u2014 you&#8217;ll need it later. <u>Don&#8217;t<\/u> copy the <span class=\"rnthl rntliteral\">gs:\/\/<\/span> section.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"738\" height=\"444\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/Firebase-Bucket-Storage-Created-Bucket-ID.png?resize=738%2C444&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Firebase Storage Bucket Created\" class=\"wp-image-171500\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/Firebase-Bucket-Storage-Created-Bucket-ID.png?w=738&amp;quality=100&amp;strip=all&amp;ssl=1 738w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/Firebase-Bucket-Storage-Created-Bucket-ID.png?resize=300%2C180&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 738px) 100vw, 738px\" \/><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\">Storage Rules<\/h3>\n\n\n\n<p>We&#8217;ll change the storage rules so that only authenticated users can upload files to the storage bucket. Select the <strong>Rules<\/strong> tab.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"502\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/Firebase-Storage-Bucket-Change-Rules.png?resize=750%2C502&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Firebase Storage Bucket - Change Rules\" class=\"wp-image-171498\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/Firebase-Storage-Bucket-Change-Rules.png?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/Firebase-Storage-Bucket-Change-Rules.png?resize=300%2C201&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>Change your database rules. Use the following rules:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rules_version = '2';\nservice firebase.storage {\n  match \/b\/{bucket}\/o {\n    match \/{allPaths=**} {\n      allow read, write: if request.auth !=null;\n    }\n  }\n}<\/code><\/pre>\n\n\n\n<p>When you&#8217;re done, click <strong>Publish<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"get-API-Key\">4) Get Project API Key<\/h2>\n\n\n\n<p>To interface with your Firebase project using the ESP32-CAM, you need to get your project API key. Follow the next steps to get your project API key.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>To get your project&#8217;s API key, on the left sidebar click on <strong>Project Settings<\/strong>.<br><figure><img data-recalc-dims=\"1\" decoding=\"async\" class=\"wp-image-105748\" style=\"width: 750px;\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2025\/04\/17-project-settings-firebase.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Firebase Realtime Database Project Settings\"><\/figure><\/li>\n\n\n\n<li>Copy the API Key to a safe place because you&#8217;ll need it later.<br><figure><img data-recalc-dims=\"1\" decoding=\"async\" class=\"wp-image-105749\" style=\"width: 750px;\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2025\/04\/18-project-api-key-firebase.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Firebase Project API Key\"><\/figure><\/li>\n<\/ol>\n\n\n\n<p>Now, you have everything ready to interface the ESP32 with the database.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"esp32-cam-send-pictures-firebase\">5) ESP32-CAM &#8211; Send Pictures to Firebase Storage<\/h2>\n\n\n\n<p>Before proceeding with the tutorial, make sure you check the following prerequisites.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Installing the ESP32 Boards in Arduino IDE<\/h3>\n\n\n\n<p>We&#8217;ll program the ESP32-CAM board using Arduino IDE. So you need the Arduino IDE installed as well as the ESP32 core. Follow the next tutorial to install it, if you haven&#8217;t already.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/installing-esp32-arduino-ide-2-0\/\" title=\"\">Installing ESP32 Board in Arduino IDE 2 (Windows, Mac OS X, Linux)<\/a><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Installing ESP Firebase Client Library<\/h3>\n\n\n\n<p>For this tutorial, you need to install the <a href=\"https:\/\/github.com\/mobizt\/FirebaseClient\" title=\"\">FirebaseClient Library<\/a>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Installation &#8211; Arduino IDE<\/h4>\n\n\n\n<p>Follow this section if you&#8217;re using Arduino IDE. <\/p>\n\n\n\n<p>Go to <strong>Sketch <\/strong>&gt; <strong>Include Library<\/strong> &gt; <strong>Manage Libraries<\/strong>, search for the library name, and install it.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"790\" height=\"586\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/09\/install-Firebase-client-arduino-ide.png?resize=790%2C586&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Install Firebase Client Library Arduino IDE\" class=\"wp-image-169118\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/09\/install-Firebase-client-arduino-ide.png?w=790&amp;quality=100&amp;strip=all&amp;ssl=1 790w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/09\/install-Firebase-client-arduino-ide.png?resize=300%2C223&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/09\/install-Firebase-client-arduino-ide.png?resize=768%2C570&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 790px) 100vw, 790px\" \/><\/figure><\/div>\n\n\n<p>Now, you&#8217;re all set to start programming the ESP32 and ESP8266 boards to interact with the database.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Installing Libraries &#8211; VS Code<\/h4>\n\n\n\n<p>Follow the next instructions if you&#8217;re using VS Code with the PlatformIO or pioarduino extension.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>Install the FirebaseClient Library<\/strong><\/h5>\n\n\n\n<p>Click on the <strong>PIO Home<\/strong> icon and select the <strong>Libraries tab<\/strong>. Search for &#8220;<strong>FirebaseClient<\/strong>&#8220;. Select the <strong>FirebaseClient Library<\/strong> by Mobitz.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"646\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/09\/Install-FirebsaeClient-Library-VS-Code.jpg?resize=750%2C646&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Install FirebaseClient Library VS Code\" class=\"wp-image-169174\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/09\/Install-FirebsaeClient-Library-VS-Code.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/09\/Install-FirebsaeClient-Library-VS-Code.jpg?resize=300%2C258&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>Then, click <strong>Add to Project<\/strong> and select the project you&#8217;re working on.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"341\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/09\/Add-FirebaseClient-library-to-project-VS-Code.jpg?resize=750%2C341&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Add FirebaseClient Library ro project in VS Code\" class=\"wp-image-169175\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/09\/Add-FirebaseClient-library-to-project-VS-Code.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/09\/Add-FirebaseClient-library-to-project-VS-Code.jpg?resize=300%2C136&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>Then, click <strong>Add to Project<\/strong> and select the project you&#8217;re working on.<\/p>\n\n\n\n<p>Also, change the monitor speed to 115200 by adding the following line to the <span class=\"rnthl rntliteral\">platformio.ini<\/span> file of your project:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>monitor_speed = 115200<\/code><\/pre>\n\n\n\n<p>Now, you&#8217;re all set to start programming the ESP32-CAM board to send pictures to Firebase Storage.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">ESP32-CAM Send Pictures to Firebase &#8211; Code<\/h3>\n\n\n\n<p>Copy the following code to the Arduino IDE, or to the <span class=\"rnthl rntliteral\">main.cpp<\/span> file if you&#8217;re using VS Code. It takes a picture and sends it to Firebase when it first boots.<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-c\">\/*********\r\n  Rui Santos\r\n  Complete instructions at: https:\/\/RandomNerdTutorials.com\/esp32-cam-save-picture-firebase-storage\/\r\n  \r\n  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files.\r\n  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\r\n\r\n  Based on the example provided by the ESP Firebase Client Library\r\n*********\/\r\n\r\n#include &quot;Arduino.h&quot;\r\n#include &quot;WiFi.h&quot;\r\n#include &quot;esp_camera.h&quot;\r\n#include &quot;soc\/soc.h&quot;           \/\/ Disable brownout problems\r\n#include &quot;soc\/rtc_cntl_reg.h&quot;  \/\/ Disable brownout problems\r\n#include &quot;driver\/rtc_io.h&quot;\r\n#include &lt;LittleFS.h&gt;\r\n#include &lt;FS.h&gt;\r\n#include &lt;Firebase_ESP_Client.h&gt;\r\n\/\/Provide the token generation process info.\r\n#include &lt;addons\/TokenHelper.h&gt;\r\n\r\n\/\/Replace with your network credentials\r\nconst char* ssid = &quot;REPLACE_WITH_YOUR_SSID&quot;;\r\nconst char* password = &quot;REPLACE_WITH_YOUR_PASSWORD&quot;;\r\n\r\n\/\/ Insert Firebase project API Key\r\n#define API_KEY &quot;REPLACE_WITH_YOUR_FIREBASE_PROJECT_API_KEY&quot;\r\n\r\n\/\/ Insert Authorized Email and Corresponding Password\r\n#define USER_EMAIL &quot;REPLACE_WITH_THE_AUTHORIZED_USER_EMAIL&quot;\r\n#define USER_PASSWORD &quot;REPLACE_WITH_THE_AUTHORIZED_USER_PASSWORD&quot;\r\n\r\n\/\/ Insert Firebase storage bucket ID e.g bucket-name.appspot.com\r\n#define STORAGE_BUCKET_ID &quot;REPLACE_WITH_YOUR_STORAGE_BUCKET_ID&quot;\r\n\/\/ For example:\r\n\/\/#define STORAGE_BUCKET_ID &quot;esp-iot-app.appspot.com&quot;\r\n\r\n\/\/ Photo File Name to save in LittleFS\r\n#define FILE_PHOTO_PATH &quot;\/photo.jpg&quot;\r\n#define BUCKET_PHOTO &quot;\/data\/photo.jpg&quot;\r\n\r\n\/\/ OV2640 camera module pins (CAMERA_MODEL_AI_THINKER)\r\n#define PWDN_GPIO_NUM     32\r\n#define RESET_GPIO_NUM    -1\r\n#define XCLK_GPIO_NUM      0\r\n#define SIOD_GPIO_NUM     26\r\n#define SIOC_GPIO_NUM     27\r\n#define Y9_GPIO_NUM       35\r\n#define Y8_GPIO_NUM       34\r\n#define Y7_GPIO_NUM       39\r\n#define Y6_GPIO_NUM       36\r\n#define Y5_GPIO_NUM       21\r\n#define Y4_GPIO_NUM       19\r\n#define Y3_GPIO_NUM       18\r\n#define Y2_GPIO_NUM        5\r\n#define VSYNC_GPIO_NUM    25\r\n#define HREF_GPIO_NUM     23\r\n#define PCLK_GPIO_NUM     22\r\n\r\nboolean takeNewPhoto = true;\r\n\r\n\/\/Define Firebase Data objects\r\nFirebaseData fbdo;\r\nFirebaseAuth auth;\r\nFirebaseConfig configF;\r\n\r\nvoid fcsUploadCallback(FCS_UploadStatusInfo info);\r\n\r\nbool taskCompleted = false;\r\n\r\n\/\/ Capture Photo and Save it to LittleFS\r\nvoid capturePhotoSaveLittleFS( void ) {\r\n  \/\/ Dispose first pictures because of bad quality\r\n  camera_fb_t* fb = NULL;\r\n  \/\/ Skip first 3 frames (increase\/decrease number as needed).\r\n  for (int i = 0; i &lt; 4; i++) {\r\n    fb = esp_camera_fb_get();\r\n    esp_camera_fb_return(fb);\r\n    fb = NULL;\r\n  }\r\n    \r\n  \/\/ Take a new photo\r\n  fb = NULL;  \r\n  fb = esp_camera_fb_get();  \r\n  if(!fb) {\r\n    Serial.println(&quot;Camera capture failed&quot;);\r\n    delay(1000);\r\n    ESP.restart();\r\n  }  \r\n\r\n  \/\/ Photo file name\r\n  Serial.printf(&quot;Picture file name: %s\\n&quot;, FILE_PHOTO_PATH);\r\n  File file = LittleFS.open(FILE_PHOTO_PATH, FILE_WRITE);\r\n\r\n  \/\/ Insert the data in the photo file\r\n  if (!file) {\r\n    Serial.println(&quot;Failed to open file in writing mode&quot;);\r\n  }\r\n  else {\r\n    file.write(fb-&gt;buf, fb-&gt;len); \/\/ payload (image), payload length\r\n    Serial.print(&quot;The picture has been saved in &quot;);\r\n    Serial.print(FILE_PHOTO_PATH);\r\n    Serial.print(&quot; - Size: &quot;);\r\n    Serial.print(fb-&gt;len);\r\n    Serial.println(&quot; bytes&quot;);\r\n  }\r\n  \/\/ Close the file\r\n  file.close();\r\n  esp_camera_fb_return(fb);\r\n}\r\n\r\nvoid initWiFi(){\r\n  WiFi.begin(ssid, password);\r\n  while (WiFi.status() != WL_CONNECTED) {\r\n    delay(1000);\r\n    Serial.println(&quot;Connecting to WiFi...&quot;);\r\n  }\r\n}\r\n\r\nvoid initLittleFS(){\r\n  if (!LittleFS.begin(true)) {\r\n    Serial.println(&quot;An Error has occurred while mounting LittleFS&quot;);\r\n    ESP.restart();\r\n  }\r\n  else {\r\n    delay(500);\r\n    Serial.println(&quot;LittleFS mounted successfully&quot;);\r\n  }\r\n}\r\n\r\nvoid initCamera(){\r\n \/\/ OV2640 camera module\r\n  camera_config_t config;\r\n  config.ledc_channel = LEDC_CHANNEL_0;\r\n  config.ledc_timer = LEDC_TIMER_0;\r\n  config.pin_d0 = Y2_GPIO_NUM;\r\n  config.pin_d1 = Y3_GPIO_NUM;\r\n  config.pin_d2 = Y4_GPIO_NUM;\r\n  config.pin_d3 = Y5_GPIO_NUM;\r\n  config.pin_d4 = Y6_GPIO_NUM;\r\n  config.pin_d5 = Y7_GPIO_NUM;\r\n  config.pin_d6 = Y8_GPIO_NUM;\r\n  config.pin_d7 = Y9_GPIO_NUM;\r\n  config.pin_xclk = XCLK_GPIO_NUM;\r\n  config.pin_pclk = PCLK_GPIO_NUM;\r\n  config.pin_vsync = VSYNC_GPIO_NUM;\r\n  config.pin_href = HREF_GPIO_NUM;\r\n  config.pin_sccb_sda = SIOD_GPIO_NUM;\r\n  config.pin_sccb_scl = SIOC_GPIO_NUM;\r\n  config.pin_pwdn = PWDN_GPIO_NUM;\r\n  config.pin_reset = RESET_GPIO_NUM;\r\n  config.xclk_freq_hz = 20000000;\r\n  config.pixel_format = PIXFORMAT_JPEG;\r\n  config.grab_mode = CAMERA_GRAB_LATEST;\r\n\r\n  if (psramFound()) {\r\n    config.frame_size = FRAMESIZE_UXGA;\r\n    config.jpeg_quality = 10;\r\n    config.fb_count = 1;\r\n  } else {\r\n    config.frame_size = FRAMESIZE_SVGA;\r\n    config.jpeg_quality = 12;\r\n    config.fb_count = 1;\r\n  }\r\n  \/\/ Camera init\r\n  esp_err_t err = esp_camera_init(&amp;config);\r\n  if (err != ESP_OK) {\r\n    Serial.printf(&quot;Camera init failed with error 0x%x&quot;, err);\r\n    ESP.restart();\r\n  } \r\n}\r\n\r\nvoid setup() {\r\n  \/\/ Serial port for debugging purposes\r\n  Serial.begin(115200);\r\n  initWiFi();\r\n  initLittleFS();\r\n  \/\/ Turn-off the 'brownout detector'\r\n  WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);\r\n  initCamera();\r\n\r\n  \/\/Firebase\r\n  \/\/ Assign the api key\r\n  configF.api_key = API_KEY;\r\n  \/\/Assign the user sign in credentials\r\n  auth.user.email = USER_EMAIL;\r\n  auth.user.password = USER_PASSWORD;\r\n  \/\/Assign the callback function for the long running token generation task\r\n  configF.token_status_callback = tokenStatusCallback; \/\/see addons\/TokenHelper.h\r\n\r\n  Firebase.begin(&amp;configF, &amp;auth);\r\n  Firebase.reconnectWiFi(true);\r\n}\r\n\r\nvoid loop() {\r\n  if (takeNewPhoto) {\r\n    capturePhotoSaveLittleFS();\r\n    takeNewPhoto = false;\r\n  }\r\n  delay(1);\r\n  if (Firebase.ready() &amp;&amp; !taskCompleted){\r\n    taskCompleted = true;\r\n    Serial.print(&quot;Uploading picture... &quot;);\r\n\r\n    \/\/MIME type should be valid to avoid the download problem.\r\n    \/\/The file systems for flash and SD\/SDMMC can be changed in FirebaseFS.h.\r\n    if (Firebase.Storage.upload(&amp;fbdo, STORAGE_BUCKET_ID \/* Firebase Storage bucket id *\/, FILE_PHOTO_PATH \/* path to local file *\/, mem_storage_type_flash \/* memory storage type, mem_storage_type_flash and mem_storage_type_sd *\/, BUCKET_PHOTO \/* path of remote file stored in the bucket *\/, &quot;image\/jpeg&quot; \/* mime type *\/,fcsUploadCallback)){\r\n      Serial.printf(&quot;\\nDownload URL: %s\\n&quot;, fbdo.downloadURL().c_str());\r\n    }\r\n    else{\r\n      Serial.println(fbdo.errorReason());\r\n    }\r\n  }\r\n}\r\n\r\n\/\/ The Firebase Storage upload callback function\r\nvoid fcsUploadCallback(FCS_UploadStatusInfo info){\r\n    if (info.status == firebase_fcs_upload_status_init){\r\n        Serial.printf(&quot;Uploading file %s (%d) to %s\\n&quot;, info.localFileName.c_str(), info.fileSize, info.remoteFileName.c_str());\r\n    }\r\n    else if (info.status == firebase_fcs_upload_status_upload)\r\n    {\r\n        Serial.printf(&quot;Uploaded %d%s, Elapsed time %d ms\\n&quot;, (int)info.progress, &quot;%&quot;, info.elapsedTime);\r\n    }\r\n    else if (info.status == firebase_fcs_upload_status_complete)\r\n    {\r\n        Serial.println(&quot;Upload completed\\n&quot;);\r\n        FileMetaInfo meta = fbdo.metaData();\r\n        Serial.printf(&quot;Name: %s\\n&quot;, meta.name.c_str());\r\n        Serial.printf(&quot;Bucket: %s\\n&quot;, meta.bucket.c_str());\r\n        Serial.printf(&quot;contentType: %s\\n&quot;, meta.contentType.c_str());\r\n        Serial.printf(&quot;Size: %d\\n&quot;, meta.size);\r\n        Serial.printf(&quot;Generation: %lu\\n&quot;, meta.generation);\r\n        Serial.printf(&quot;Metageneration: %lu\\n&quot;, meta.metageneration);\r\n        Serial.printf(&quot;ETag: %s\\n&quot;, meta.etag.c_str());\r\n        Serial.printf(&quot;CRC32: %s\\n&quot;, meta.crc32.c_str());\r\n        Serial.printf(&quot;Tokens: %s\\n&quot;, meta.downloadTokens.c_str());\r\n        Serial.printf(&quot;Download URL: %s\\n\\n&quot;, fbdo.downloadURL().c_str());\r\n    }\r\n    else if (info.status == firebase_fcs_upload_status_error){\r\n        Serial.printf(&quot;Upload failed, %s\\n&quot;, info.errorMsg.c_str());\r\n    }\r\n}\r\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Firebase-ESP\/raw\/main\/ESP32-CAM-Save-Picture-Firebase-Storage\/ESP32-CAM-Save-Picture-Firebase-Storage.ino\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<p>You need to insert your network credentials, Firebase user and password, storage bucket URL, and project API key for the project to work.<\/p>\n\n\n\n<p>This sketch was based on a <a href=\"https:\/\/github.com\/mobizt\/FirebaseClient\/blob\/main\/examples\/Storage\/Upload\/Upload.ino\" target=\"_blank\" rel=\"noopener\" title=\"\">basic example\u00a0provided by the library<\/a>. You can find more <a href=\"https:\/\/github.com\/mobizt\/FirebaseClient\/tree\/main\/examples\" target=\"_blank\" rel=\"noopener\" title=\"\">examples\u00a0here<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How the Code Works<\/h3>\n\n\n\n<p>Continue reading to learn how the code works or skip to the <a href=\"#demonstration\">demonstration section<\/a>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Libraries<\/h4>\n\n\n\n<p>First, include the required libraries.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>#include &lt;Arduino.h>\n#include &lt;FirebaseClient.h>\n#include &lt;FS.h>\n#include &lt;LittleFS.h>\n#include &lt;WiFiClientSecure.h>\n#include \"esp_camera.h\"<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Network Credentials<\/h4>\n\n\n\n<p>Insert your network credentials in the following variables so that the ESP can connect to the internet and communicate with Firebase.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/Replace with your network credentials\n#define WIFI_SSID \"REPLACE_WITH_YOUR_SSID\"\n#define WIFI_PASSWORD \"REPLACE_WITH_YOUR_PASSWORD\"<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Firebase Project API Key<\/h4>\n\n\n\n<p>Insert your Firebase project API key\u2014see this section: <a href=\"#get-API-Key\">4) Get Project API Key<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>#define API_KEY \"REPLACE_WITH_YOUR_FIREBASE_PROJECT_API_KEY\"<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">User Email and Password<\/h4>\n\n\n\n<p>Insert the authorized email and the corresponding password\u2014see this section: <a href=\"#set-authentication-methods\">2) Set Authentication Methods<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>#define USER_EMAIL \"REPLACE_WITH_FIREBASE_PROJECT_EMAIL_USER\"\n#define USER_PASS \"REPLACE_WITH_FIREBASE_PROJECT_USER_PASS\"<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Firebase Storage Bucket ID<\/h4>\n\n\n\n<p>Insert the Firebase storage bucket ID, e.g <em>bucket-name.appspot.com<\/em>. In my case, it is <span class=\"rnthl rntliteral\">esp-project-598f5.firebasestorage.app<\/span>. (remove any slashes &#8220;\/&#8221; at the end or at the beginning of the bucket ID, otherwise, it will not work).<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>#define STORAGE_BUCKET_ID \"REPLACE_WITH_YOUR_STORAGE_BUCKET_ID\"<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Picture Path<\/h4>\n\n\n\n<p>The <span class=\"rnthl rntliteral\">FILE_PHOTO_PATH<\/span> variable defines the LittleFS path where the picture will be saved. It will be saved with the name <span class=\"rnthl rntliteral\">photo.jpg<\/span>.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>#define FILE_PHOTO \"\/photo.jpg\"<\/code><\/pre>\n\n\n\n<p>We also have a variable to hold the path where the picture will be saved on the Storage Bucket on Firebase.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>#define BUCKET_PHOTO \"\/data\/photo.jpg\"<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">ESP32-CAM Pin Definition<\/h4>\n\n\n\n<p>The following lines define the ESP32-CAM pins. This is the definition for the ESP32-CAM AI-Thinker module. If you&#8217;re using another ESP32-CAM module, you need to modify the pin definition\u2014check this tutorial: <a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-camera-pin-gpios\/\">ESP32-CAM Camera Boards: Pin and GPIOs Assignment Guide<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ OV2640 camera module pins (CAMERA_MODEL_AI_THINKER)\n#define PWDN_GPIO_NUM     32\n#define RESET_GPIO_NUM    -1\n#define XCLK_GPIO_NUM      0\n#define SIOD_GPIO_NUM     26\n#define SIOC_GPIO_NUM     27\n#define Y9_GPIO_NUM       35\n#define Y8_GPIO_NUM       34\n#define Y7_GPIO_NUM       39\n#define Y6_GPIO_NUM       36\n#define Y5_GPIO_NUM       21\n#define Y4_GPIO_NUM       19\n#define Y3_GPIO_NUM       18\n#define Y2_GPIO_NUM        5\n#define VSYNC_GPIO_NUM    25\n#define HREF_GPIO_NUM     23\n#define PCLK_GPIO_NUM     22<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Other Variables<\/h4>\n\n\n\n<p>The <span class=\"rnthl rntliteral\">takeNewPhoto<\/span> variable checks if it is time to take a new photo. We&#8217;ll set it to <span class=\"rnthl rntliteral\">true<\/span>, so that it takes a picture when the board first runs.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>boolean takeNewPhoto = true;<\/code><\/pre>\n\n\n\n<p>Then, we define Firebase configuration data objects.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/Define Firebase Data objects\nFirebaseData fbdo;\nFirebaseAuth auth;\nFirebaseConfig configF;<\/code><\/pre>\n\n\n\n<p>The <span class=\"rnthl rntliteral\">taskCompleted<\/span> is a boolean variable that checks if we successfully connected to Firebase.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>bool taskCompleted = false;<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">capturePhotoSaveLittleFS() Function<\/h4>\n\n\n\n<p>The <span class=\"rnthl rntliteral\">capturePhotoSaveLittleFS()<\/span> function takes a photo and saves it in the ESP32 filesystem.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ Capture Photo and Save it to LittleFS\nvoid capturePhotoSaveLittleFS( void ) {\n  \/\/ Dispose first pictures because of bad quality\n  camera_fb_t* fb = NULL;\n  \/\/ Skip first 3 frames (increase\/decrease number as needed).\n  for (int i = 0; i &lt; 4; i++) {\n    fb = esp_camera_fb_get();\n    esp_camera_fb_return(fb);\n    fb = NULL;\n  }\n    \n  \/\/ Take a new photo\n  fb = NULL;  \n  fb = esp_camera_fb_get();  \n  if(!fb) {\n    Serial.println(\"Camera capture failed\");\n    delay(1000);\n    ESP.restart();\n  }  \n\n  \/\/ Photo file name\n  Serial.printf(\"Picture file name: %s\\n\", FILE_PHOTO_PATH);\n  File file = LittleFS.open(FILE_PHOTO_PATH, FILE_WRITE);\n\n  \/\/ Insert the data in the photo file\n  if (!file) {\n    Serial.println(\"Failed to open file in writing mode\");\n  }\n  else {\n    file.write(fb-&gt;buf, fb-&gt;len); \/\/ payload (image), payload length\n    Serial.print(\"The picture has been saved in \");\n    Serial.print(FILE_PHOTO_PATH);\n    Serial.print(\" - Size: \");\n    Serial.print(fb-&gt;len);\n    Serial.println(\" bytes\");\n  }\n  \/\/ Close the file\n  file.close();\n  esp_camera_fb_return(fb);\n}<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">initWiFi() Function<\/h4>\n\n\n\n<p>The <span class=\"rnthl rntliteral\">initWiFi()<\/span> function initializes Wi-Fi.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>void initWiFi(){\n  WiFi.begin(ssid, password);\n  while (WiFi.status() != WL_CONNECTED) {\n    delay(1000);\n    Serial.println(\"Connecting to WiFi...\");\n  }\n}<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">initLittleFS() Function<\/h4>\n\n\n\n<p>The <span class=\"rnthl rntliteral\">initLittleFS()<\/span> function initializes the LittleFS filesystem.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>void initLittleFS(){\n  if (!LittleFS.begin(true)) {\n    Serial.println(\"An Error has occurred while mounting LittleFS\");\n    ESP.restart();\n  }\n  else {\n    delay(500);\n    Serial.println(\"LittleFS mounted successfully\");\n  }\n}<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">initCamera() Function<\/h4>\n\n\n\n<p>The <span class=\"rnthl rntliteral\">initCamera()<\/span> function initializes the ESP32-CAM.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>void initCamera(){\n \/\/ OV2640 camera module\n  camera_config_t config;\n  config.ledc_channel = LEDC_CHANNEL_0;\n  config.ledc_timer = LEDC_TIMER_0;\n  config.pin_d0 = Y2_GPIO_NUM;\n  config.pin_d1 = Y3_GPIO_NUM;\n  config.pin_d2 = Y4_GPIO_NUM;\n  config.pin_d3 = Y5_GPIO_NUM;\n  config.pin_d4 = Y6_GPIO_NUM;\n  config.pin_d5 = Y7_GPIO_NUM;\n  config.pin_d6 = Y8_GPIO_NUM;\n  config.pin_d7 = Y9_GPIO_NUM;\n  config.pin_xclk = XCLK_GPIO_NUM;\n  config.pin_pclk = PCLK_GPIO_NUM;\n  config.pin_vsync = VSYNC_GPIO_NUM;\n  config.pin_href = HREF_GPIO_NUM;\n  config.pin_sscb_sda = SIOD_GPIO_NUM;\n  config.pin_sscb_scl = SIOC_GPIO_NUM;\n  config.pin_pwdn = PWDN_GPIO_NUM;\n  config.pin_reset = RESET_GPIO_NUM;\n  config.xclk_freq_hz = 20000000;\n  config.pixel_format = PIXFORMAT_JPEG;\n\n  if (psramFound()) {\n    config.frame_size = FRAMESIZE_UXGA;\n    config.jpeg_quality = 10;\n    config.fb_count = 2;\n  } else {\n    config.frame_size = FRAMESIZE_SVGA;\n    config.jpeg_quality = 12;\n    config.fb_count = 1;\n  }\n  \/\/ Camera init\n  esp_err_t err = esp_camera_init(&amp;config);\n  if (err != ESP_OK) {\n    Serial.printf(\"Camera init failed with error 0x%x\", err);\n    ESP.restart();\n  } \n}<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">setup()<\/h4>\n\n\n\n<p>In the <span class=\"rnthl rntliteral\">setup()<\/span>, initialize the Serial Monitor, Wi-Fi, LittleFS, and the camera.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ Serial port for debugging purposes\nSerial.begin(115200);\ninitWiFi();\ninitLittleFS();\n\/\/ Turn-off the 'brownout detector'\nWRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);\ninitCamera();<\/code><\/pre>\n\n\n\n<p>Then, assign the following settings to the Firebase configuration objects.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ Assign the api key\nconfigF.api_key = API_KEY;\n\/\/Assign the user sign in credentials\nauth.user.email = USER_EMAIL;\nauth.user.password = USER_PASSWORD;\n\/\/Assign the callback function for the long running token generation task\nconfigF.token_status_callback = tokenStatusCallback; \/\/see addons\/TokenHelper.h<\/code><\/pre>\n\n\n\n<p>Finally, initialize Firebase.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>Firebase.begin(&amp;configF, &amp;auth);\nFirebase.reconnectWiFi(true);<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">loop()<\/h4>\n\n\n\n<p>In the <span class=\"rnthl rntliteral\">loop()<\/span>, take a new picture and save it to the filesystem.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>if (takeNewPhoto) {\n  capturePhotoSaveLittleFS();\n  takeNewPhoto = false;\n}<\/code><\/pre>\n\n\n\n<p>Finally, send the picture to Firebase.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>if (Firebase.ready() &amp;&amp; !taskCompleted){\n    taskCompleted = true;\n    Serial.print(\"Uploading picture... \");\n\n    \/\/MIME type should be valid to avoid the download problem.\n    \/\/The file systems for flash and SD\/SDMMC can be changed in FirebaseFS.h.\n    if (Firebase.Storage.upload(&amp;fbdo, STORAGE_BUCKET_ID \/* Firebase Storage bucket id *\/, FILE_PHOTO_PATH \/* path to local file *\/, mem_storage_type_flash \/* memory storage type, mem_storage_type_flash and mem_storage_type_sd *\/, BUCKET_PHOTO \/* path of remote file stored in the bucket *\/, \"image\/jpeg\" \/* mime type *\/,fcsUploadCallback)){\n      Serial.printf(\"\\nDownload URL: %s\\n\", fbdo.downloadURL().c_str());\n    }\n    else{\n      Serial.println(fbdo.errorReason());\n    }\n  }<\/code><\/pre>\n\n\n\n<p>The command that actually sends the picture is <span class=\"rnthl rntliteral\">Firebase.Storage.upload()<\/span>:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>Firebase.Storage.upload(&amp;fbdo, STORAGE_BUCKET_ID, FILE_PHOTO, mem_storage_type_flash, FILE_PHOTO, \"image\/jpeg\", fcsUploadCallback)<\/code><\/pre>\n\n\n\n<p>This function returns a boolean variable indicating the success of the operation.<\/p>\n\n\n\n<p>It accepts as the second argument, the <span style=\"text-decoration: underline;\">storage bucket ID<\/span>. Then, the <span style=\"text-decoration: underline;\">path where the file is saved<\/span>; the <span style=\"text-decoration: underline;\">storage type<\/span> (it can be LittleFS or SD Card); the <span style=\"text-decoration: underline;\">path where the file will be saved in the Firebase storage<\/span>; the <span style=\"text-decoration: underline;\">mime type<\/span>, and a callback function (<span class=\"rnthl rntliteral\">fcsUploadCallback<\/span>) (this callback function simply inform us of the uploading process state).<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ The Firebase Storage upload callback function\nvoid fcsUploadCallback(FCS_UploadStatusInfo info){\n    if (info.status == firebase_fcs_upload_status_init){\n        Serial.printf(\"Uploading file %s (%d) to %s\\n\", info.localFileName.c_str(), info.fileSize, info.remoteFileName.c_str());\n    }\n    else if (info.status == firebase_fcs_upload_status_upload)\n    {\n        Serial.printf(\"Uploaded %d%s, Elapsed time %d ms\\n\", (int)info.progress, \"%\", info.elapsedTime);\n    }\n    else if (info.status == firebase_fcs_upload_status_complete)\n    {\n        Serial.println(\"Upload completed\\n\");\n        FileMetaInfo meta = fbdo.metaData();\n        Serial.printf(\"Name: %s\\n\", meta.name.c_str());\n        Serial.printf(\"Bucket: %s\\n\", meta.bucket.c_str());\n        Serial.printf(\"contentType: %s\\n\", meta.contentType.c_str());\n        Serial.printf(\"Size: %d\\n\", meta.size);\n        Serial.printf(\"Generation: %lu\\n\", meta.generation);\n        Serial.printf(\"Metageneration: %lu\\n\", meta.metageneration);\n        Serial.printf(\"ETag: %s\\n\", meta.etag.c_str());\n        Serial.printf(\"CRC32: %s\\n\", meta.crc32.c_str());\n        Serial.printf(\"Tokens: %s\\n\", meta.downloadTokens.c_str());\n        Serial.printf(\"Download URL: %s\\n\\n\", fbdo.downloadURL().c_str());\n    }\n    else if (info.status == firebase_fcs_upload_status_error){\n        Serial.printf(\"Upload failed, %s\\n\", info.errorMsg.c_str());\n    }\n}<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"demonstration\">Demonstration<\/h1>\n\n\n\n<p>After inserting the required credentials, upload the code to your ESP32-CAM. If you don&#8217;t know how to upload code to the ESP32-CAM, you can follow the next tutorial(s):<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/program-upload-code-esp32-cam\/\">How to Program \/ Upload Code to ESP32-CAM AI-Thinker (Arduino IDE)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/upload-code-esp32-cam-mb-usb\/\">Upload Code to ESP32-CAM AI-Thinker using ESP32-CAM-MB USB Programmer<\/a><\/li>\n<\/ul>\n\n\n\n<p>After uploading the code, open the Serial Monitor at a baud rate of 115200. Press the ESP32-CAM on-board RST button.<\/p>\n\n\n\n<p>It will log in to Firebase, take a picture, and save it to LittleFS. Afterwards, it will upload the picture to Firebase Storage.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"729\" height=\"758\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/ESP32-CAM-Upload-Picture-Firebase.png?resize=729%2C758&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32-CAM Upload Picture to Firebase Serial Monitor\" class=\"wp-image-136611\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/ESP32-CAM-Upload-Picture-Firebase.png?w=729&amp;quality=100&amp;strip=all&amp;ssl=1 729w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/ESP32-CAM-Upload-Picture-Firebase.png?resize=289%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 289w\" sizes=\"(max-width: 729px) 100vw, 729px\" \/><\/figure><\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"729\" height=\"758\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/ESP32-CAM-Upload-Picture-Firebase-2.png?resize=729%2C758&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32-CAM Upload Picture to Firebase Storage\" class=\"wp-image-136612\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/ESP32-CAM-Upload-Picture-Firebase-2.png?w=729&amp;quality=100&amp;strip=all&amp;ssl=1 729w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/09\/ESP32-CAM-Upload-Picture-Firebase-2.png?resize=289%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 289w\" sizes=\"(max-width: 729px) 100vw, 729px\" \/><\/figure><\/div>\n\n\n<p>Now, go to your Firebase console, and select the <strong>Storage <\/strong>tab. There should be a folder called <span class=\"rnthl rntliteral\"><em>data<\/em><\/span> that contains your picture.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"389\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/11\/Firebase-photos-folder-storage.png?resize=750%2C389&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Folder Created in Firebase Storage\" class=\"wp-image-107700\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/11\/Firebase-photos-folder-storage.png?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/11\/Firebase-photos-folder-storage.png?resize=300%2C156&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>You can check some metadata about the picture and view it in full size. You can also access the image by accessing the Download URL printed on the Serial Monitor.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"520\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/11\/Picture-uploaded-to-firebase-storage-metada.png?resize=750%2C520&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Picture Uploaded to Firebase Storage Metada\" class=\"wp-image-107710\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/11\/Picture-uploaded-to-firebase-storage-metada.png?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/11\/Picture-uploaded-to-firebase-storage-metada.png?resize=300%2C208&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p>In this tutorial, you learned how to create a Firebase project with Storage. Firebase Storage allows you to store files in the cloud. Then, you can access those files by going to the Firebase console, or you can build a web app to display those files (check this tutorial: <a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-display-pictures-firebase-web-app\/\">ESP32-CAM: Display Pictures in Firebase Web App<\/a>).<\/p>\n\n\n\n<p>We&#8217;ve shown a simple example of sending a picture taken with the ESP32-CAM to the Firebase Storage. The example is as simple as possible so that you can understand the basics. The idea is to modify the project to make something useful\u2014like taking a picture and uploading it to Firebase storage when motion is detected, when a door opens, or when you press a button.<\/p>\n\n\n\n<p>We have other <strong>Firebase tutorials<\/strong> that you may like:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-firebase-realtime-database\/\">ESP32: Getting Started with Firebase (Realtime Database)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-firebase-web-app\/\">ESP32 with Firebase \u2013 Creating a Web App<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-esp8266-firebase-authentication\/\">ESP32\/ESP8266: Firebase Authentication (Email and Password)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-esp8266-firebase-bme280-rtdb\/\">ESP32\/ESP8266 Firebase: Send BME280 Sensor Readings to the Realtime Database<\/a><\/li>\n<\/ul>\n\n\n\n<p>Learn more about the ESP32-CAM with our resources:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-projects-ebook\/\"><strong>Build ESP32-CAM Projects (eBook)<\/strong><\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/projects-esp32-cam\/\"><strong>Read all our ESP32-CAM Projects, Tutorials and Guides<\/strong><\/a><\/li>\n<\/ul>\n\n\n\n<p>Learn how to create a Firebase Web App to control outputs and monitor sensors from anywhere:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/firebase-esp32-esp8266-ebook\/\"><strong>Firebase Web App with the ESP32 and ESP8266 eBook<\/strong><\/a><\/li>\n<\/ul>\n\n\n\n<p>We hope you found this tutorial useful.<\/p>\n\n\n\n<p>Thanks for reading.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide, you&#8217;ll learn how to take and upload a picture to Firebase Storage using the ESP32-CAM. You&#8217;ll create a Firebase project with Storage that allows you to store &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"ESP32-CAM Save Picture in Firebase Storage\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-save-picture-firebase-storage\/#more-107690\" aria-label=\"Read more about ESP32-CAM Save Picture in Firebase Storage\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":5,"featured_media":107712,"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":[276,281,319,264],"tags":[],"class_list":["post-107690","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-esp32","category-esp32-project","category-esp32-cam","category-project"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2021\/11\/ESP32-CAM-Firebase-Storage.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\/107690","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=107690"}],"version-history":[{"count":24,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/107690\/revisions"}],"predecessor-version":[{"id":171509,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/107690\/revisions\/171509"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/107712"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=107690"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=107690"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=107690"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}