In this guide, you’ll learn how to take and upload a picture to Firebase Storage using the ESP32-CAM. You’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’ll do this in a future tutorial). The ESP32-CAM will be programmed using Arduino IDE.
Updated 19 September 2023.
Note: this project is compatible with any ESP32 Camera Board with the OV2640 camera. You just need to make sure you use the right pinout for the board you’re using.
What is Firebase?
Firebase is Google’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 authentication, realtime database, hosting, storage, etc.
Project Overview
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 PIR motion sensor or a pushbutton, for example.
- When the ESP32 first runs, it takes a new picture and saves it in the filesystem (LittleFS);
- The ESP32-CAM connects to Firebase as a user with email and password;
- The ESP32-CAM sends the picture to Firebase Storage;
- After that, you can go to your Firebase console to view the pictures;
- Later, you can build a web app that you can access from anywhere to display the ESP32-CAM pictures (we’ll create this in a future tutorial).
Contents
Here’s a summary of the steps you need to follow to create this project.
- Create a Firebase Project
- Set Authentication Methods
- Create Storage Bucket
- Get Project API Key
- ESP32-CAM Send Pictures to Firebase Storage
1) Create a Firebase Project
1) Go to Firebase and sign in using a Google Account.
2) Click Get Started and then Add project to create a new project.
3) Give a name to your project, for example: ESP Firebase Demo.
4) Disable the option Enable Google Analytics for this project as it is not needed and click Create project.
5) It will take a few seconds to set up your project. Then, click Continue when it’s ready.
6) You’ll be redirected to your Project console page.
2) Set Authentication Methods
To allow authentication with email and password, first, you need to set authentication methods for your app.
“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-CAM). Knowing a user’s identity allows an app to securely save user data in the cloud and provide the same personalized experience across all of the user’s devices.” To learn more about the authentication methods, you can read the documentation.
1) On the left sidebar, click on Authentication and then on Get started.
2) Select the Option Email/Password.
3) Enable that authentication method and click Save.
4) The authentication with email and password should now be enabled.
5) Now, you need to add a user. Still on the Authentication tab, select the Users tab at the top. Then, click on Add User.
6) Add an email address for the authorized user. It can be your google account email or any other email. You can also create an email for this specific project. Add a password that will allow you to sign in to your app and access the storage files. Don’t forget to save the password in a safe place because you’ll need it later. When you’re done, click Add user.
7) A new user was successfully created and added to the Users table.
Notice that Firebase creates a unique UID for each registered user. The user UID allows us to identify the user and keep track of the user to provide or deny access to the project or the database. There’s also a column that registers the date of the last sign-in. At the moment, it is empty because we haven’t signed in with that user yet.
3) Create Storage Bucket
1) On the left sidebar, click on Storage and then on Get started.
2) Select Start in test mode—click Next. We’ll change the storage rules later on.
3) Select your storage location—it should be the closest to your country.
4) Wait a few seconds while it creates the storage bucket.
5) The storage bucket is now set up. Copy the storage bucket ID because you’ll need it later (copy only the section highlighted with a red rectangle as shown below).
Storage Rules
We’ll change the storage rules so that only authenticated users can upload files to the storage bucket. Select the Rules tab.
Change your database rules. Use the following rules:
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth !=null;
}
}
}
When you’re done, click Publish.
4) Get Project API Key
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.
1) On the left sidebar, click on Project Settings.
2) Copy the Web API Key to a safe place because you’ll need it later.
5) ESP32-CAM – Send Pictures to Firebase Storage
Before proceeding with the tutorial, make sure you check the following prerequisites.
Installing the ESP32 add-on
We’ll program the ESP32-CAM board using Arduino IDE. So you need the Arduino IDE installed as well as the ESP32 add-on. Follow the next tutorial to install it, if you haven’t already.
Installing ESP Firebase Client Library
The Firebase-ESP-Client library provides several examples to interface with Firebase services. It provides an example that shows how to send files to Firebase Storage. Our code we’ll be based on that example. So, you need to make sure you have that library installed.
Installation – VS Code + PlatformIO
If you’re using VS Code with the PlatformIO extension, click on the PIO Home icon and select the Libraries tab. Search for “Firebase ESP Client “. Select the Firebase Arduino Client Library for ESP8266 and ESP32.
Then, click Add to Project and select the project you’re working on.
Also, change the monitor speed to 115200 by adding the following line to the platformio.ini file of your project:
monitor_speed = 115200
Installation – Arduino IDE
If you’re using Arduino IDE, follow the next steps to install the library.
- Go to Sketch > Include Library > Manage Libraries
- Search for Firebase ESP Client and install the Firebase Arduino Client Library for ESP8266 and ESP32 by Mobizt.
Now, you’re all set to start programming the ESP32-CAM board to send pictures to Firebase Storage.
ESP32-CAM Send Pictures to Firebase – Code
Copy the following code to your Arduino IDE, or to the main.cpp file if you’re using VS Code. It takes a picture and sends it to Firebase when it first boots.
/*********
Rui Santos
Complete instructions at: https://RandomNerdTutorials.com/esp32-cam-save-picture-firebase-storage/
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Based on the example provided by the ESP Firebase Client Library
*********/
#include "Arduino.h"
#include "WiFi.h"
#include "esp_camera.h"
#include "soc/soc.h" // Disable brownout problems
#include "soc/rtc_cntl_reg.h" // Disable brownout problems
#include "driver/rtc_io.h"
#include <LittleFS.h>
#include <FS.h>
#include <Firebase_ESP_Client.h>
//Provide the token generation process info.
#include <addons/TokenHelper.h>
//Replace with your network credentials
const char* ssid = "REPLACE_WITH_YOUR_SSID";
const char* password = "REPLACE_WITH_YOUR_PASSWORD";
// Insert Firebase project API Key
#define API_KEY "REPLACE_WITH_YOUR_FIREBASE_PROJECT_API_KEY"
// Insert Authorized Email and Corresponding Password
#define USER_EMAIL "REPLACE_WITH_THE_AUTHORIZED_USER_EMAIL"
#define USER_PASSWORD "REPLACE_WITH_THE_AUTHORIZED_USER_PASSWORD"
// Insert Firebase storage bucket ID e.g bucket-name.appspot.com
#define STORAGE_BUCKET_ID "REPLACE_WITH_YOUR_STORAGE_BUCKET_ID"
// For example:
//#define STORAGE_BUCKET_ID "esp-iot-app.appspot.com"
// Photo File Name to save in LittleFS
#define FILE_PHOTO_PATH "/photo.jpg"
#define BUCKET_PHOTO "/data/photo.jpg"
// OV2640 camera module pins (CAMERA_MODEL_AI_THINKER)
#define PWDN_GPIO_NUM 32
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 0
#define SIOD_GPIO_NUM 26
#define SIOC_GPIO_NUM 27
#define Y9_GPIO_NUM 35
#define Y8_GPIO_NUM 34
#define Y7_GPIO_NUM 39
#define Y6_GPIO_NUM 36
#define Y5_GPIO_NUM 21
#define Y4_GPIO_NUM 19
#define Y3_GPIO_NUM 18
#define Y2_GPIO_NUM 5
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22
boolean takeNewPhoto = true;
//Define Firebase Data objects
FirebaseData fbdo;
FirebaseAuth auth;
FirebaseConfig configF;
void fcsUploadCallback(FCS_UploadStatusInfo info);
bool taskCompleted = false;
// Capture Photo and Save it to LittleFS
void capturePhotoSaveLittleFS( void ) {
// Dispose first pictures because of bad quality
camera_fb_t* fb = NULL;
// Skip first 3 frames (increase/decrease number as needed).
for (int i = 0; i < 4; i++) {
fb = esp_camera_fb_get();
esp_camera_fb_return(fb);
fb = NULL;
}
// Take a new photo
fb = NULL;
fb = esp_camera_fb_get();
if(!fb) {
Serial.println("Camera capture failed");
delay(1000);
ESP.restart();
}
// Photo file name
Serial.printf("Picture file name: %s\n", FILE_PHOTO_PATH);
File file = LittleFS.open(FILE_PHOTO_PATH, FILE_WRITE);
// Insert the data in the photo file
if (!file) {
Serial.println("Failed to open file in writing mode");
}
else {
file.write(fb->buf, fb->len); // payload (image), payload length
Serial.print("The picture has been saved in ");
Serial.print(FILE_PHOTO_PATH);
Serial.print(" - Size: ");
Serial.print(fb->len);
Serial.println(" bytes");
}
// Close the file
file.close();
esp_camera_fb_return(fb);
}
void initWiFi(){
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
}
void initLittleFS(){
if (!LittleFS.begin(true)) {
Serial.println("An Error has occurred while mounting LittleFS");
ESP.restart();
}
else {
delay(500);
Serial.println("LittleFS mounted successfully");
}
}
void initCamera(){
// OV2640 camera module
camera_config_t config;
config.ledc_channel = LEDC_CHANNEL_0;
config.ledc_timer = LEDC_TIMER_0;
config.pin_d0 = Y2_GPIO_NUM;
config.pin_d1 = Y3_GPIO_NUM;
config.pin_d2 = Y4_GPIO_NUM;
config.pin_d3 = Y5_GPIO_NUM;
config.pin_d4 = Y6_GPIO_NUM;
config.pin_d5 = Y7_GPIO_NUM;
config.pin_d6 = Y8_GPIO_NUM;
config.pin_d7 = Y9_GPIO_NUM;
config.pin_xclk = XCLK_GPIO_NUM;
config.pin_pclk = PCLK_GPIO_NUM;
config.pin_vsync = VSYNC_GPIO_NUM;
config.pin_href = HREF_GPIO_NUM;
config.pin_sccb_sda = SIOD_GPIO_NUM;
config.pin_sccb_scl = SIOC_GPIO_NUM;
config.pin_pwdn = PWDN_GPIO_NUM;
config.pin_reset = RESET_GPIO_NUM;
config.xclk_freq_hz = 20000000;
config.pixel_format = PIXFORMAT_JPEG;
config.grab_mode = CAMERA_GRAB_LATEST;
if (psramFound()) {
config.frame_size = FRAMESIZE_UXGA;
config.jpeg_quality = 10;
config.fb_count = 1;
} else {
config.frame_size = FRAMESIZE_SVGA;
config.jpeg_quality = 12;
config.fb_count = 1;
}
// Camera init
esp_err_t err = esp_camera_init(&config);
if (err != ESP_OK) {
Serial.printf("Camera init failed with error 0x%x", err);
ESP.restart();
}
}
void setup() {
// Serial port for debugging purposes
Serial.begin(115200);
initWiFi();
initLittleFS();
// Turn-off the 'brownout detector'
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);
initCamera();
//Firebase
// Assign the api key
configF.api_key = API_KEY;
//Assign the user sign in credentials
auth.user.email = USER_EMAIL;
auth.user.password = USER_PASSWORD;
//Assign the callback function for the long running token generation task
configF.token_status_callback = tokenStatusCallback; //see addons/TokenHelper.h
Firebase.begin(&configF, &auth);
Firebase.reconnectWiFi(true);
}
void loop() {
if (takeNewPhoto) {
capturePhotoSaveLittleFS();
takeNewPhoto = false;
}
delay(1);
if (Firebase.ready() && !taskCompleted){
taskCompleted = true;
Serial.print("Uploading picture... ");
//MIME type should be valid to avoid the download problem.
//The file systems for flash and SD/SDMMC can be changed in FirebaseFS.h.
if (Firebase.Storage.upload(&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)){
Serial.printf("\nDownload URL: %s\n", fbdo.downloadURL().c_str());
}
else{
Serial.println(fbdo.errorReason());
}
}
}
// The Firebase Storage upload callback function
void fcsUploadCallback(FCS_UploadStatusInfo info){
if (info.status == firebase_fcs_upload_status_init){
Serial.printf("Uploading file %s (%d) to %s\n", info.localFileName.c_str(), info.fileSize, info.remoteFileName.c_str());
}
else if (info.status == firebase_fcs_upload_status_upload)
{
Serial.printf("Uploaded %d%s, Elapsed time %d ms\n", (int)info.progress, "%", info.elapsedTime);
}
else if (info.status == firebase_fcs_upload_status_complete)
{
Serial.println("Upload completed\n");
FileMetaInfo meta = fbdo.metaData();
Serial.printf("Name: %s\n", meta.name.c_str());
Serial.printf("Bucket: %s\n", meta.bucket.c_str());
Serial.printf("contentType: %s\n", meta.contentType.c_str());
Serial.printf("Size: %d\n", meta.size);
Serial.printf("Generation: %lu\n", meta.generation);
Serial.printf("Metageneration: %lu\n", meta.metageneration);
Serial.printf("ETag: %s\n", meta.etag.c_str());
Serial.printf("CRC32: %s\n", meta.crc32.c_str());
Serial.printf("Tokens: %s\n", meta.downloadTokens.c_str());
Serial.printf("Download URL: %s\n\n", fbdo.downloadURL().c_str());
}
else if (info.status == firebase_fcs_upload_status_error){
Serial.printf("Upload failed, %s\n", info.errorMsg.c_str());
}
}
You need to insert your network credentials, storage bucket ID, and project API key for the project to work.
This sketch was based on a basic example provided by the library. You can find more examples here.
How the Code Works
Continue reading to learn how the code works or skip to the demonstration section.
Libraries
First, include the required libraries.
#include "WiFi.h"
#include "esp_camera.h"
#include "Arduino.h"
#include "soc/soc.h" // Disable brownout problems
#include "soc/rtc_cntl_reg.h" // Disable brownout problems
#include "driver/rtc_io.h"
#include <LittleFS.h>
#include <FS.h>
#include <Firebase_ESP_Client.h>
//Provide the token generation process info.
#include <addons/TokenHelper.h>
Network Credentials
Insert your network credentials in the following variables so that the ESP can connect to the internet and communicate with Firebase.
//Replace with your network credentials
const char* ssid = "REPLACE_WITH_YOUR_SSID";
const char* password = "REPLACE_WITH_YOUR_PASSWORD";
Firebase Project API Key
Insert your Firebase project API key—see this section: 4) Get Project API Key.
// Insert Firebase project API Key
#define API_KEY "REPLACE_WITH_YOUR_FIREBASE_PROJECT_API_KEY."
User Email and Password
Insert the authorized email and the corresponding password—see this section: 2) Set Authentication Methods.
#define USER_EMAIL "REPLACE_WITH_THE_AUTHORIZED_USER_EMAIL"
#define USER_PASSWORD "REPLACE_WITH_THE_AUTHORIZED_USER_PASSWORD"
Firebase Storage Bucket ID
Insert the Firebase storage bucket ID, e.g bucket-name.appspot.com. In my case, it is esp-firebase-demo.appspot.com. (remove any slashes “/” at the end or at the beginning of the bucket ID, otherwise, it will not work).
define STORAGE_BUCKET_ID "REPLACE_WITH_YOUR_STORAGE_BUCKET_ID"
Picture Path
The FILE_PHOTO_PATH variable defines the LittleFS path where the picture will be saved. It will be saved with the name photo.jpg.
#define FILE_PHOTO "/photo.jpg"
We also have a variable to hold the path where the picture will be saved on the Storage Bucket on Firebase.
#define BUCKET_PHOTO "/data/photo.jpg"
ESP32-CAM Pin Definition
The following lines define the ESP32-CAM pins. This is the definition for the ESP32-CAM AI-Thinker module. If you’re using another ESP32-CAM module, you need to modify the pin definition—check this tutorial: ESP32-CAM Camera Boards: Pin and GPIOs Assignment Guide.
// OV2640 camera module pins (CAMERA_MODEL_AI_THINKER)
#define PWDN_GPIO_NUM 32
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 0
#define SIOD_GPIO_NUM 26
#define SIOC_GPIO_NUM 27
#define Y9_GPIO_NUM 35
#define Y8_GPIO_NUM 34
#define Y7_GPIO_NUM 39
#define Y6_GPIO_NUM 36
#define Y5_GPIO_NUM 21
#define Y4_GPIO_NUM 19
#define Y3_GPIO_NUM 18
#define Y2_GPIO_NUM 5
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22
Other Variables
The takeNewPhoto variable checks if it is time to take a new photo. We’ll set it to true, so that it takes a picture when the board first runs.
boolean takeNewPhoto = true;
Then, we define Firebase configuration data objects.
//Define Firebase Data objects
FirebaseData fbdo;
FirebaseAuth auth;
FirebaseConfig configF;
The taskCompleted is a boolean variable that checks if we successfully connected to Firebase.
bool taskCompleted = false;
capturePhotoSaveLittleFS() Function
The capturePhotoSaveLittleFS() function takes a photo and saves it in the ESP32 filesystem.
// Capture Photo and Save it to LittleFS
void capturePhotoSaveLittleFS( void ) {
// Dispose first pictures because of bad quality
camera_fb_t* fb = NULL;
// Skip first 3 frames (increase/decrease number as needed).
for (int i = 0; i < 4; i++) {
fb = esp_camera_fb_get();
esp_camera_fb_return(fb);
fb = NULL;
}
// Take a new photo
fb = NULL;
fb = esp_camera_fb_get();
if(!fb) {
Serial.println("Camera capture failed");
delay(1000);
ESP.restart();
}
// Photo file name
Serial.printf("Picture file name: %s\n", FILE_PHOTO_PATH);
File file = LittleFS.open(FILE_PHOTO_PATH, FILE_WRITE);
// Insert the data in the photo file
if (!file) {
Serial.println("Failed to open file in writing mode");
}
else {
file.write(fb->buf, fb->len); // payload (image), payload length
Serial.print("The picture has been saved in ");
Serial.print(FILE_PHOTO_PATH);
Serial.print(" - Size: ");
Serial.print(fb->len);
Serial.println(" bytes");
}
// Close the file
file.close();
esp_camera_fb_return(fb);
}
initWiFi() Function
The initWiFi() function initializes Wi-Fi.
void initWiFi(){
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
}
initLittleFS() Function
The initLittleFS() function initializes the LittleFS filesystem.
void initLittleFS(){
if (!LittleFS.begin(true)) {
Serial.println("An Error has occurred while mounting LittleFS");
ESP.restart();
}
else {
delay(500);
Serial.println("LittleFS mounted successfully");
}
}
initCamera() Function
The initCamera() function initializes the ESP32-CAM.
void initCamera(){
// OV2640 camera module
camera_config_t config;
config.ledc_channel = LEDC_CHANNEL_0;
config.ledc_timer = LEDC_TIMER_0;
config.pin_d0 = Y2_GPIO_NUM;
config.pin_d1 = Y3_GPIO_NUM;
config.pin_d2 = Y4_GPIO_NUM;
config.pin_d3 = Y5_GPIO_NUM;
config.pin_d4 = Y6_GPIO_NUM;
config.pin_d5 = Y7_GPIO_NUM;
config.pin_d6 = Y8_GPIO_NUM;
config.pin_d7 = Y9_GPIO_NUM;
config.pin_xclk = XCLK_GPIO_NUM;
config.pin_pclk = PCLK_GPIO_NUM;
config.pin_vsync = VSYNC_GPIO_NUM;
config.pin_href = HREF_GPIO_NUM;
config.pin_sscb_sda = SIOD_GPIO_NUM;
config.pin_sscb_scl = SIOC_GPIO_NUM;
config.pin_pwdn = PWDN_GPIO_NUM;
config.pin_reset = RESET_GPIO_NUM;
config.xclk_freq_hz = 20000000;
config.pixel_format = PIXFORMAT_JPEG;
if (psramFound()) {
config.frame_size = FRAMESIZE_UXGA;
config.jpeg_quality = 10;
config.fb_count = 2;
} else {
config.frame_size = FRAMESIZE_SVGA;
config.jpeg_quality = 12;
config.fb_count = 1;
}
// Camera init
esp_err_t err = esp_camera_init(&config);
if (err != ESP_OK) {
Serial.printf("Camera init failed with error 0x%x", err);
ESP.restart();
}
}
setup()
In the setup(), initialize the Serial Monitor, Wi-Fi, LittleFS, and the camera.
// Serial port for debugging purposes
Serial.begin(115200);
initWiFi();
initLittleFS();
// Turn-off the 'brownout detector'
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);
initCamera();
Then, assign the following settings to the Firebase configuration objects.
// Assign the api key
configF.api_key = API_KEY;
//Assign the user sign in credentials
auth.user.email = USER_EMAIL;
auth.user.password = USER_PASSWORD;
//Assign the callback function for the long running token generation task
configF.token_status_callback = tokenStatusCallback; //see addons/TokenHelper.h
Finally, initialize Firebase.
Firebase.begin(&configF, &auth);
Firebase.reconnectWiFi(true);
loop()
In the loop(), take a new picture and save it to the filesystem.
if (takeNewPhoto) {
capturePhotoSaveLittleFS();
takeNewPhoto = false;
}
Finally, send the picture to Firebase.
if (Firebase.ready() && !taskCompleted){
taskCompleted = true;
Serial.print("Uploading picture... ");
//MIME type should be valid to avoid the download problem.
//The file systems for flash and SD/SDMMC can be changed in FirebaseFS.h.
if (Firebase.Storage.upload(&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)){
Serial.printf("\nDownload URL: %s\n", fbdo.downloadURL().c_str());
}
else{
Serial.println(fbdo.errorReason());
}
}
The command that actually sends the picture is Firebase.Storage.upload():
Firebase.Storage.upload(&fbdo, STORAGE_BUCKET_ID, FILE_PHOTO, mem_storage_type_flash, FILE_PHOTO, "image/jpeg", fcsUploadCallback)
This function returns a boolean variable indicating the success of the operation.
It accepts as the second argument, the storage bucket ID. Then, the path where the file is saved; the storage type (it can be LittleFS or SD Card); the path where the file will be saved in the Firebase storage; the mime type, and a callback function (fcsUploadCallback) (this callback function simply inform us of the uploading process state).
// The Firebase Storage upload callback function
void fcsUploadCallback(FCS_UploadStatusInfo info){
if (info.status == firebase_fcs_upload_status_init){
Serial.printf("Uploading file %s (%d) to %s\n", info.localFileName.c_str(), info.fileSize, info.remoteFileName.c_str());
}
else if (info.status == firebase_fcs_upload_status_upload)
{
Serial.printf("Uploaded %d%s, Elapsed time %d ms\n", (int)info.progress, "%", info.elapsedTime);
}
else if (info.status == firebase_fcs_upload_status_complete)
{
Serial.println("Upload completed\n");
FileMetaInfo meta = fbdo.metaData();
Serial.printf("Name: %s\n", meta.name.c_str());
Serial.printf("Bucket: %s\n", meta.bucket.c_str());
Serial.printf("contentType: %s\n", meta.contentType.c_str());
Serial.printf("Size: %d\n", meta.size);
Serial.printf("Generation: %lu\n", meta.generation);
Serial.printf("Metageneration: %lu\n", meta.metageneration);
Serial.printf("ETag: %s\n", meta.etag.c_str());
Serial.printf("CRC32: %s\n", meta.crc32.c_str());
Serial.printf("Tokens: %s\n", meta.downloadTokens.c_str());
Serial.printf("Download URL: %s\n\n", fbdo.downloadURL().c_str());
}
else if (info.status == firebase_fcs_upload_status_error){
Serial.printf("Upload failed, %s\n", info.errorMsg.c_str());
}
}
Demonstration
After inserting the required credentials, upload the code to your ESP32-CAM. If you don’t know how to upload code to the ESP32-CAM, you can follow the next tutorial(s):
- How to Program / Upload Code to ESP32-CAM AI-Thinker (Arduino IDE)
- Upload Code to ESP32-CAM AI-Thinker using ESP32-CAM-MB USB Programmer
After uploading the code, open the Serial Monitor at a baud rate of 115200. Press the ESP32-CAM on-board RST button.
It will log in to Firebase, take a picture, and save it to LittleFS. Afterwards, it will upload the picture to Firebase Storage.
Now, go to your Firebase console, and select the Storage tab. There should be a folder called data that contains your picture.
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.
Wrapping Up
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: ESP32-CAM: Display Pictures in Firebase Web App).
We’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—like taking a picture and uploading it to Firebase storage when motion is detected, when a door opens, or when you press a button.
We have other Firebase tutorials that you may like:
- ESP32: Getting Started with Firebase (Realtime Database)
- ESP32 with Firebase – Creating a Web App
- ESP32/ESP8266: Firebase Authentication (Email and Password)
- ESP32/ESP8266 Firebase: Send BME280 Sensor Readings to the Realtime Database
Learn more about the ESP32-CAM with our resources:
Learn how to create a Firebase Web App to control outputs and monitor sensors from anywhere:
We hope you found this tutorial useful.
Thanks for reading.
Hi Sara
Excellent project, and thanks for sharing.
I did all the steps, and on the Serial Monitor I get the following message:
”
SPIFFS mounted successfully
Token info: type = id token, status = on request
Token info: type = id token, status = ready
Taking a photo…
Picture file name: /data/photo.jpg
The picture has been saved in /data/photo.jpg – Size: 164736 bytes
Uploading picture… Invalid HTTP method/URL pair.
”
Does not create a data library, and of course there is no image.
Where I was wrong? there is a solution?
Thanks in advance.
Can you check that you copied the bucket URL correctly as shown in the picture?
thank you for the answer,
Yes, I checked and that’s fine.
Do I need to create a data library, inside the firebase?
Hi.
No, that’s the ESP32 code that does that…
So, is there a solution?
Why am I receiving this message?
”
Uploading picture… Invalid HTTP method/URL pair.
”
Why ” Invalid HTTP method/URL pair “?
And no data directories appear in Firebase?
Can you share the line of code where you insert your bucket URL?
Just to check it out.
I’ll delete it right after.
Do you mean this line?
// Insert Firebase storage bucket ID e.g bucket-name.appspot.com
#define STORAGE_BUCKET_ID “gs://XXXXXXXXX.com”
It’s not correct.
You should not copy the gs:// part as explained in the tutorial.
Let me know that if it works after removing the gs://
Regards
Sara
I thought I solved the problem, by deleting the beginning of gs://
But now, get a message that I do not have permission.
”
Taking a photo…
Picture file name: /data/photo.jpg
The picture has been saved in /data/photo.jpg – Size: 0 bytes
Taking a photo…
Picture file name: /data/photo.jpg
The picture has been saved in /data/photo.jpg – Size: 109440 bytes
Uploading picture… Permission denied.
”
Where did I go wrong now?
Did you solve your issue? I’m also same error with Permission denied.
Hi.
What are your database rules?
same error:- Permission Denied
The picture has been saved in /data/photo.jpg – Size: 127104 bytes
Uploading picture… Permission denied.
Check if your storage rules are the same as shown in the picture: https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2021/11/firebase-storage-security-rules.png
Regards,
Sara
Hi.
There was an update, and the default database rules no longer work with this project.
Make sure you update your storage rules to the following:
rules_version = ‘2’;
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth !=null;
}
}
}
I already updated the tutorial.
Regards,
Sara
i am getting the same issue.. invalid HTTP method/URL method.. what is the solution kindly guide me please.. what i use now?
Hi.
I see you already solved the issue.
What was exactly the problem?
Regards,
Sara
my code is working now.. kindly tell me how to send multiple pictures in firebase. the code only send one picture and then overlap other picture on it.
Hi.
You just need to change the name of the pictures so that they don’t overlap.
You can add a counter to each picture name, or add data and time to the picture name.
Regards,
Sara
please tell me the code so i can take lots of photos
i’m getting error of file not found.
WiFi connected
SPIFFS mounted successfully
Token info: type = id token (GITKit token), status = on request
Token info: type = id token (GITKit token), status = ready
Taking a photo…
Picture file name: /data/photo.jpg
The picture has been saved in /data/photo.jpg – Size: 53248 bytes
Uploading picture… File not found.
Pls help
Hi.
Downgrade the ESP Firebase Client Library to version 4.0.3. I found that version 4.3.0 works fine while most recent versions give that error.
Revert to version 4.3.0 and it should work fine. I just tested it and it works.
Regards,
Sara
#include <StringArray.h>
ESP32-CAM-firebase:17:25: fatal error: StringArray.h: No such file or directory
Hi.
Where do you get that error?
Regards,
Sara
I get the error on Arduino IDE when I try to compile the code. Please help.
“StringArray.h: No such file or directory”
Hi.
I never got that error and I can’t find anything related to that on the internet.
What is the arduino IDE version you’re using? And ESP32 boards version?
Regards,
Sara
Arduino IDE ver.1.8.13 and ESP32 ver. 1.0.6
Hi Svein could you solve the problem with the “StringArray.h” library.
For me there is a compilation error:
Arduino\libraries\ESPAsyncWebServer-master\src\AsyncEventSource.h:25:22: fatal error: AsyncTCP.h: No such file or directory
Why? Whats wrong?
Hi.
Are you sure you’re uploading the right code?
This code doesn’t use that library.
Regards,
Sara
I got the error in Arduino 1.8.19
From an older PC I found StringArray.h and AsyncTCP.h and copied thoes two libreries ower to the new PC and it compiled.
Taking a photo…
Picture file name: /data/photo.jpg
The picture has been saved in /data/photo.jpg – Size: 77696 bytes
Uploading picture… Permission denied.
Now I need to find out how to fix this.
Make sure you’ve added a user in the authentication step and that it is the same user you added in the code.
Regards.
Sara
I have the same problem,
In which line of code should the user’s ID be inserted?
You don’t need to insert the user’s ID in the code.
You only need to add the authorized user email and password.
So why am I getting the message that I do not have permission?
”
Taking a photo…
Picture file name: /data/photo.jpg
The picture has been saved in /data/photo.jpg – Size: 109440 bytes
Uploading picture… “—-Permission denied—–“.
”
Where I was wrong?
Did you create a user email and password on the authentication step?
Did you use those same credentials in the ESP32 code?
Regards,
Sara
Check the line:
allow read, write: if request.auth != null;
at the Storage Rules
you may check the line:
allow read, write: if request.auth != null;
in the Storage Rules
Right, that solved the problem, thanks
Hi Svein,
I see you solved the problem with the message,
“Permission denied”
I would be very grateful if you would share, how you solved the problem.
Thanks in advance.
Taking a photo…
Picture file name: /data/photo.jpg
The picture has been saved in /data/photo.jpg – Size: 132736 bytes
Uploading picture…
Download URL: https://firebasestorage.googleapis.com/v0/b/esp-firebase-demo-da1c8.appspot.com/o/dataP102photo.jpg?alt=media&token=f43e2465-780c-43d1-a3e5-f9bd82773760
rules_version = ‘2’;
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth != null;
}
}
}
It was this line I had to change
allow read, write: if request.auth != null;
@Sara: this was the fix I showed up to Moshe yesterday. So why did you delete my response??
Hi.
I didn’t delete any comments.
It’s probably that it hadn’t been approved at the time.
Regards,
Sara
Hi.
What changes did you make?
I have those rules and I worked.
Regards,
Sara
Well, the initial setting there is:
allow read, write: if false;
if I remember correctly.
Thanks.
My rules were different by default.
Mine were just like the ones you’ve shared previously (the ones that worked).
Maybe I have changed something that I can’t remember. I’ll check that out.
Thanks.
Regards.
Sara
Hi All,
issue statement: web page doesn’t show picture nor time and date
Regarding the rule: I see the method of Authorization in tutorial is “anonymous” but I kept it as email/pass
Now, after 2^8 times I changed rules to different suggestions when T/S I ended up at:
rules_version = ‘2’;
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if true;
}
}
}
maybe not the strongest, but hey, I am uploading picture of my 3D print
then,
Re: problem uploading picture: reset your sign in password in Firebase project, refresh page, maybe grab a cup of tea and come back, Of course in Arduino IDE sketch change password as well. it worked for me.
Then, I noticed I am getting the date and time near refresh button, but no picture.
after sniffing around java consol (ctrl+shift+I) in OPERA I noticed the app does not see app.js file NADA, NULL, ZERO
what I found was that line for app.js was between and section
then, I had a look at index.html file from different project and I noticed that is in section, so I “monkey see, monkey do” thingy and I created folder under public file , scripts file, then I moved the app.js in to that new folder. After that I ended up with this:
ESP32-CAM Web App
<p><img id="img" width="500px"></p>
<p>Last picture taken: <span id="date-time"></span></p>
<button onclick="window.location.reload();">Refresh</button>
<!--INCLUDE JS FILES-->
http://scripts/app.js
firebase deploy went off and when I reloaded the web app page, BOOM! the picture is there, what a freeing good feeling, I am having glass of refreshing beverage to celebrate success.
full project files here boyos https://github.com/MrEstefano/esp32-camera-app
Best
Stef
Super.
Now it is working and I can see the picture in the monitor, but it is only the last picture. Now I would like to have new name, so I can store several pictures maybe to use date and time as name? Any suggestions?
Hi.
You just need to modify the name for each new picture.
For example, you can have a variable that you increment and your pictures will be called photo1, photo2, photo3,…
Or you can get epoch time and name the pictures with the epoch time they were taken…
Maybe I’ll create a tutorial with multiple pictures…
Regards,
Sara
This tutorial is so nice! and I would love to try a tutorial for multiple pictures 🙂
I just got a new problem:
Taking a photo…
Picture file name: /data/photo.jpg
The picture has been saved in /data/photo.jpg – Size: 156928 bytes
Uploading picture… not found
What can that be?
Hi Svein,
I am having the same error. How did you correct the File not found?
saves the new file with date and time
I would also like to have the code please.
[email protected]
Thanks in advance.
I found my error.
I am having the same error. How did you correct the File not found?
Taking a photo…
Picture file name: /data/photo.jpg
The picture has been saved in /data/photo.jpg – Size: 120064 bytes
Uploading picture… Sun16-01-2214:52:29.jpg
Download URL: https://firebasestorage.googleapis.com/v0/b/esp-firebase-demo-da1c8.appspot.com/o/Sun16-01-2214Q9752Q9729.jpg?alt=media&token=519fd7a5-7c15-484c-b897-b93d60fdca42
Now it saves the new file with date and time.
How do I get the date and time in the filename?
I cand send you the code if you give me an email address to send it to.
Hi Sevin,
I would also be very happy to receive the code.
My email is: [email protected]
Huge thanks in advance.
Ha Svein,
My email is: LRO at xs4all.nl
I will appreciate it.
I would also like the code please.
henry at scheun.co.za
Thanks in advance.
I would also like to have the code please.
henryscheun at gmail.com
Thanks in advance.
Hi Svein,
Will appreciate it.
[email protected]
Thanks!
Hi Sevin,
I would also be very happy to receive the code.
My email is: tonet2010 at gmail.com
Huge thanks in advance.
Hi Svein,
I would greatly appreciate if you could email me your code.
Thank you.
lee.th2 at gmail.com
T Lee
Hi Sevin,
I would also be very happy to receive the code.
My email is: krill200123 at gmail.com
Huge thanks in advance.
Sevin, I hope you dont mind my request to send the info as well to me. [email protected] Thanks for helping others!
I would also be very happy to receive the code.
wruwan.iot @ gmail.com
Hi.. Svein
I would also be very happy to receive the code.
My email is: wkbrapfernando at hotmail.com
Hi Sevin,
I would also be very happy to receive the code.
My email is: ladislaoaguilar29gmail.com
Thanks in advance.
Hi Sevin,
I would also be very happy to receive the code.
My email is: [email protected]
Huge thanks in advance.
Hi.
You can take a look at this tutorial: https://randomnerdtutorials.com/esp32-cam-photo-microsd-card-timestamp/
Regards,
Sara
Hi Svien, I manage to generate the date and time but couldn’t quite figure out how to update the name of the file. Could you send me a your code to my email so I can know how you update the filename? My email is hezekiahjiawei11 AT gmail.com. Thanks
Hi Svein,
I had make a request for your code but no reply. May be my email address is not correct. Please email me again. Thank you.
My email is [email protected]
regards,
T Lee
HI..Svein
please send me code
Hi Svein,
I am having the same error. How did you correct the File not found?
saves the new file with date and time
I would also like to have the code please.
[email protected]
Thanks in advance.
Svein,
Thank you very very much,
I was able to figure out where to add the line, and everything works great.
Thanks again.
Hi Moshe, could you tell me at what line does the code go please. I asked Svein to send me the code but if you don’t mind you can send it to me please Email: [email protected]
Hi Henry,
You can see below Sarah’s reaction.
”
Hi.
Yes. That’s right. I was testing that right now.
You can remove the library. I already updated the code on the blog post.
Regards,
Sara
“
Hi i get a compile error:
ESP_CAM_Firebase_Demo:17:25: fatal error: StringArray.h: No such file or directory
Where doI get the “StringArray.h” library.
I see the same question was asked on the 13 January 2022 but no help was offered.
The code:
#include <StringArray.h>
does not compile because arduino IDE can not find the file or directory.
Error message: “StringArray.h: No such file or directory”
I get a compile error when I compile the code.
It is looking for <StringArray.h> library. Please help.
What’s the ESP32 core version you’re using?
Firebase Arduino Client Library for ESP8266 and ESP32 ver.2.3.7 if this is what you mean by ESP32 core.
I commented out the line in the code(#include <StringArray.h>) that include that library and now it compile and the ESP32 cam does its job. Seem that that library is not even used in the code.
Hi.
Yes. That’s right. I was testing that right now.
You can remove the library. I already updated the code on the blog post.
Regards,
Sara
thankyou.. for simple tutorial.. good job,, its work..
btw, the rule must be like this..
rules_version = ‘2’;
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth != null;
}
}
}
if we found error “access denied” while uploading image..
Phew! This is a mighty long thread. I have a problem that hasn’t been explicitly discussed yet:
In the monitor:
Taking a photo
Picture file name: /data/photo.jpg
The picture has been saved in /data/photo.jpg – Size 82304 bytes
Uploading picture… unknown error
This isn’t very useful! I’ve checked all the ‘network credentials’ and the ‘defines’ – all are as set up correctly.
One clue: In Firebase>storage no data folder is created. I understand that this should be created by the sketch. I see
define FILE_PHOTO “/data/photo.jpg” and this is being used in the capturePhotoSave Spiffs function. Any clues would be very much appreciated.
Hi Ben.
What are the Storage rules you have on your project?
On the Firebase console, go to Storage and then select the Rules tab.
Did you copy the bucket URL correctly? WITHOUT the gs:// ??
Regards,
Sara
Hi Sara
I have completed the project as detailed. When I go to Firebase-Storage-Files, the file there is named dataP102photo.jpg
I was expecting to see a folder ‘data’ with the file ‘photo.jpg’
There is no folder name data created.
Jim
Hi.
Did you change anything on the code? It seems your path might be wrong.
It is supposed to create the data folder.
Regardsm
Sara
I have made changes to the code, but as you can see the pic file name is ‘/data/photo.jpg’ while the file name in the download url is ‘dataP102photo.jpg’.
Jim
Sorry I forgot to include the monitor info.
16:20:23.124 > +++++++++++++++++++ Setup +++++++++++++++++++++++++++++++++
16:20:23.124 > ESP32-CAM-Send Pics to Firebase, {main.cpp}
16:20:23.124 > Jan 15 2022 @ 16:18:05
16:20:23.124 > Ver 22.1.15.001, 4:00 pm
16:20:23.124 > *** Debug= 0
16:20:23.124 >
16:20:24.238 > Connecting to WiFi…
16:20:25.243 > Connecting to WiFi…
16:20:26.247 > Connecting to WiFi…
16:20:26.830 > SPIFFS mounted successfully
16:20:26.830 > … listAllFiles(spiffs) …
16:20:26.973 > FILE: /data/photo.jpg
16:20:26.973 > … end listAllFiles(spiffs) …
16:20:26.973 >
16:20:27.578 > Camera init completed
16:20:27.578 > Token info: type = id token, status = on request
16:20:30.301 > Token info: type = id token, status = ready
16:20:30.301 > Taking a photo…
16:20:30.413 > Picture file name: /data/photo.jpg
16:20:31.958 > The picture has been saved in /data/photo.jpg – Size: 0 bytes
16:20:32.015 > Taking a photo…
16:20:32.015 > Picture file name: /data/photo.jpg
16:20:32.969 > The picture has been saved in /data/photo.jpg – Size: 0 bytes
16:20:32.969 > Taking a photo…
16:20:33.065 > Picture file name: /data/photo.jpg
16:20:33.989 > The picture has been saved in /data/photo.jpg – Size: 0 bytes
16:20:34.004 > Taking a photo…
16:20:34.100 > Picture file name: /data/photo.jpg
16:20:35.519 > The picture has been saved in /data/photo.jpg – Size: 127872 bytes
16:20:35.758 > Uploading picture…
16:20:41.639 > Download URL: https://firebasestorage.googleapis.com/v0/b/esp-firebase-demo-97046.appspot.com/o/dataP102photo.jpg?alt=media&token=0b7a…..
Hi.
I’m sorry, but I don’t know why it is working like that.
In my case, it creates the data folder and the picture is called photo.jpg as you can see from the printscreens.
I don’t know what might be wrong…
Regards,
Sara
Sara,
F.Y.I.
I was using plarformIO previously.
Using the same code with arduino ide (1.8.13), the results are the same as yours.
07:57:03.078 -> Picture file name: /data/photo.jpg
07:57:04.660 -> The picture has been saved in /data/photo.jpg – Size: 133248 bytes
07:57:04.753 -> Uploading picture…
07:57:09.908 -> https://firebasestorage.googleapis.com/v0/b/esp-firebase-demo-97046.appspot.com/o/data%2Fphoto.jpg?alt=media&token=da634…….
FYI
I updated the library for ‘mobizt/Firebase Arduino Client Library for ESP8266 and ESP32@^2.8.3’ in platformIO and now get the proper image storage i.e. data/photo.jpg.
Jimbo
Great!
Dear Sara,
I have a question about this project. Is it possible to send a photo to firebase with esp32 cam instead of using wifi through gsm with a gprs module like sim800l?
Hi.
Yes, it should be possible, but I don’t have any example about that.
Regards,
sara
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13964
load:0x40080400,len:3600
entry 0x400805f0
Connecting to WiFi…
Connecting to WiFi…
Connecting to WiFi…
SPIFFS mounted successfully
Token info: type = id token (GITKit token), status = on request
Token info: type = id token (GITKit token), status = ready
Taking a photo…
Camera capture failed
Uploading picture… file not found.
why is my camera not capturing
Hi, thanks so much for the tutorial!
Unfortunately I get this output error:
…
Taking a photo…
Picture file name: /data/photo.jpg
The picture has been saved in /data/photo.jpg – Size: 91136 bytes
Uploading picture… response payload read timed out due to network issue or too large data size
Actually the network connection is fine, and also the image size should be fine.
Do you have an idea?
Thank you!!
Best wishes,
Dan
Hi.
Check that you have inserted the right credentials in your code: project API key and bucket URL.
Regards,
Sara
Same error, yea the credentials are correct but the byte size is way larger than yours.
I’m using the AI thinker ESP32 Cam module. i get around 90-100k bytes where your image size was around 13k bytes
Hi.
Try using a lower-quality image.
For example, replace the following:
if (psramFound()) {
config.frame_size = FRAMESIZE_UXGA;
config.jpeg_quality = 10;
config.fb_count = 2;
with
if (psramFound()) {
config.frame_size = FRAMESIZE_VGA;
config.jpeg_quality = 20;
config.fb_count = 2;
Let me know if this helps.
REgards,
Sara
Hi thanks for your help.
Unfortunately still same error, now image size is 7424 bytes.
Credentials are also correct.
I also tried adding
configF.fcs.upload_buffer_size = 512;
without success.
Did you sole the problem @ Abhiraj Raghunath?
I tried to upload a small .txt file to firebase, and I get the same error, also when using my esp32 controller it doesn’t work.
Hi Dan,
“response payload read timed out” only this part of the error message is helpful, the rest is just there to confuse you. It makes you think that the problem is far more complicated than it really is!
Try the following, it will solve the issue:
In the above code, where you have to define the Storage_Bucket_ID,
Do NOT use: gs://your-firebase-project-name.appspot.com
Do NOT use: gs://your-firebase-project-name.appspot.com/
Correct format is: your-firebase-project-name.appspot.com
So, it should look like:
// Enter Firebase storage bucket ID
#define STORAGE_BUCKET_ID “your-firebase-project-name.appspot.com”
The input parameter for the functions in the library do not require you to include the gs://
Hope that helps, best of luck.
Tanjid
Hi Tanjid
I have the same problem as Dan, unfortunately after I have checked my credentials, it still does not work. Do you have any tips on what I can test next?
Hi Max,
Run the same code with a deliberate mistake in your storage bucket id. Something like “xyz0987s.appsot.com”
So your code should look:
// Enter Firebase storage bucket ID
#define STORAGE_BUCKET_ID “xyz0987s.appsot.com”
If you still get the same error, then you know it is highly likely that there is a issue in the storage bucket ID format. If you get a different error, please do share.
Hello, thanks for sharing this informative tutorial!
I’m currently trying to upload several pictures to firebase storage with system reset instead of manual and i’d love that if you will be able to help me with writing that.
also: is there a way to diplay jpg files from firebase as a video?
thanks in advance, Iddo
Hi,
You may want to take a look at this amazing simple video recording and save the avi to SD Card
https://github.com/red-car-nz/Video_Camera
Also struggling with the error “Upload failed, response payload read timed out due to network issue or too large data size”
Anyone able to solve this issue, please? The image size seems to be small enough ad Wi-Fi connected okay…
Hi.
Can you share the exact error you’re getting?
Regards,
Sara
After a few tests, a review of the library src code and some conversations with the lib maintainer, I found that changing the esp32 core SDK version works. Here are the findings:
esp32 core SDK version
v1.0.6 – working
v2.0.0 – working
v2.0.1 – working
v2.0.2 – not working
v2.0.3 – now working
Not sure if esp32 core SDK is going to change or the Firebase ESP client is going to change in the future such that the latest versions of both sides can work together…
Sara Santos, can you confirm that you are using one of the “working” versions?
Hi.
Yes.
At the time, I think I was using version 1.0.6.
Regards.
Sara
Thanks for providing this info.
Regards,
Sara
Hi Sara, is there a way for the file to be renamed each time the camera being reset, so that it doesnt replace the old photo.jpg file.
Right know only one file can insert at the firebase storage right?
Hi.
Yes. With this example, the photo will be replaced. This is the simplest example.
You can number the photo names with numbers or with a timestamo, so that all names are different. This way, all pictures will be saved.
Regards,
Sara
Hello,
First of all, thank you very much for this tutorial!
I’m building a solar powered remote camera that will (hopefully) take a photo everyday and upload it to Firebase. I’m also saving a copy of the photo on a local SD card.
I modified the script so the photo is saved on the SD card instead of SPIFFS but I can’t upload it to Firebase. I get this error: “[E][sd_diskio.cpp:775] sdcard_mount(): f_mount failed: (3) The physical drive cannot work. SD Storage is not ready.”
I tried modifying FirebaseFS.h as recommended (//The file systems for flash and SD/SDMMC can be changed in FirebaseFS.h) – by uncommenting the part about SDMMC. But then it won’t compile (throws a lot of errors).
Hi Manuel.
I also tried using SD card instead of SPIFFS and I also was not able to make it work.
I’m not sure what might be wrong. But I haven’t investigated further.
Regards,
Sara
Hi Sara,
Upon some further investigation I found out it was a problem with the Firebase library. After updating it to the last version (4.0) the problem was fixed!
Thanks!
Great!
I need to try it out!
Regards,
Sara
Hi Sara,
Yes, you can use the SD Card instead SPIFFS to store and upload to Firebase Storage using latest version of the library and able to make it work, take a look at this Discussions https://github.com/mobizt/Firebase-ESP-Client/discussions/352
Regard
That’s great!
Thanks for sharing this.ds,
Sara
Hello,
I’m having a problem..
I get the message “ADMIN_ONLY_OPERATION” and i don’t know where is the problem.
Any suggestions on how to fix it?
Hi.
Did you create a user in your Firebase console?
Check the Users tab and see if it is logging in successfully. In the Users tab, it shows the time of the last login.
Then, check the storage rules. What are the bucket storage rules that you have?
Regards,
Sara
Hello Gooday.
So the whole process is working but I am having issues changing the spiffs filename as i want multiple images on the cloud storage(for my final year project)
Please I am not really strong with c, any help is appreciated!!
Hi,
Simply add a counter at the end of the filename.
So that you have photo1, photo2, etc..
Regards,
Sara
Could you please be a little specific please
response payload read timed out due to network issue or too large data size
In my case, sometimes the ESP32 is able to send images to firebase, but sometimes it gives response payload read timed out due to network issue or too large data size.
Hello,
I wanted to make some change in your application as follows.
I made a physical connection between ESP32-CAM GPIO16 (seems empty) and the BBC-Microbit P0 pin. I wanted to read the 0-3v value from the P0 pin as analog.
My goal is to change the filename based on the received analog value.
However, somehow the GPIO16 pin value always shows 0.
I made a GND common connection. But result is same.
Apart from these, I also tried GPIO 13, GPIO12, GPIO 14 and GPIO 15. But the result is always the same.
I could never understand the reason. Please help.
Hi Sara
This is Excellent project, and thanks for sharing to us.
Is the a way to record a video and upload it to Firebase Storage?
Record timelapse to avi and store it to SPIFFS (for who need more GPIO to use) or SD Card and then upload it to Firebase every 5/10 second.
Thanks you
Hello, thanks for your project.
Now i have a problem: Failed to open file in writing mode
How to fix it? Please, thanks.
Taking a photo…
Picture file name: /data/photo.jpg
Failed to open file in writing mode
Uploading picture…
Hello, I have this error, and don´t know how can solve it, can you help me?
addons/TokenHelper.h: No such file or directory
Hi.
Did you install the Firebase library?
Regards,
Sara
Hello, my code works, and my image uploads successfully, but it’s too dark
https://firebasestorage.googleapis.com/v0/b/pollyhatv3.appspot.com/o/data%2Fphoto.jpg?alt=media&token=8c5e5aaa-06ed-4d5e-ba97-2aaf9dc2d838
That’s a pencil, and I had to put a lamp to illuminate the pencil
Please help me! 🙁
Hi.
You can try to play with the ESP32-CAM settings and see if you can get a better picture: https://randomnerdtutorials.com/esp32-cam-ov2640-camera-settings/
Regards,
Sara
Hey Sara, I put the code from the link that you gave me, but I still have the same problem:
May can you help me by Discord or something, I will thank you a lot
This is the code:
#include “WiFi.h”
#include “esp_camera.h”
#include “Arduino.h”
#include “soc/soc.h” // Disable brownout problems
#include “soc/rtc_cntl_reg.h” // Disable brownout problems
#include “driver/rtc_io.h”
#include <SPIFFS.h>
#include <FS.h>
#include <Firebase_ESP_Client.h>
//Provide the token generation process info.
#include <addons/TokenHelper.h>
.-…………………………………
…………………………………..
/* mime type */)){
Serial.printf(“\nDownload URL: %s\n”, fbdo.downloadURL().c_str());
}
else{
Serial.println(fbdo.errorReason());
}
}
}
This issue is very black and purple for me
you may try to increase the DIV CLK by setting the camera using:
sensor_t *s = esp_camera_sensor_get();
s->set_reg(s, 273, 63, amount);
set amount to 5 should be enough, you can set this parameter between 0-63
note: don’t set this setting to high it may crash your camera
ah yes you may set this setting after you call
// Camera init
esp_err_t err = esp_camera_init(&config);
if (err != ESP_OK) {
Serial.printf(“[Initializing] Camera init failed with error 0x%x\n”, err);
ESP.restart();
}
sensor_t *s = esp_camera_sensor_get();
s->set_reg(s, 273, 63, amount);
otherwise it will crash
You may try to increase DIV CLK by setting the camera using:
// Camera init
esp_err_t err = esp_camera_init(&config);
if (err != ESP_OK) {
Serial.printf(“[Initializing] Camera init failed with error 0x%x\n”, err);
ESP.restart();
}
//You should put this setting after init the camera otherwise the camera will crash
sensor_t *s = esp_camera_sensor_get();
s->set_reg(s, 273, 63, amount);
set the amount to 5 should be enough, you can play with this setting between 0-63 in case you facing low light condition
note: it may crash the camera if you set the amount to high, and changing the camera resolution or other setting will reset the DIV CLK back to 0 (if you make some sort of webserver to change the camera setting)
Hey! Thanks for such a great tutorial. Can you please show how can we share multiple photo files?
Hello, as always you guys are great! I read through all the comments and don’t think anyone has posted this error. It appears that it is saying my credentials. As it is stating a DNS error, I thought it would be related to this… but I confirmed it matches correctly. Any thoughts or suggestions on how to fix this would be greatly appreciated. ¡Gracias!
#define STORAGE_BUCKET_ID “esp-birdhouse.appspot.com”
Token info: type = id token (GITKit token), status = on request
[ 8894][E][WiFiGeneric.cpp:1360] hostByName(): DNS Failed for http://www.googleapis.com
[ 8894][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -1
Token info: type = id token (GITKit token), status = error
Token error: code: -4, message: connection lost
Hi.
I’m not sure what might be the issue.
Are you sure all your credentials and bucket id are correct?
Regards,
Sara
hello Sara, i have the same issue, and i have checked my credentials and bucket, thay are correct. but i still get error, detail:
12:19:39.745 -> Token info: type = id token (GITKit token), status = on request
12:19:39.745 -> Token info: type = id token (GITKit token), status = error
So, can you help me to solve this issue ?
Regards,
Minh Duc Le
hello Sara, i have the same issue, and i have checked my credentials and bucket, thay are correct. but i still get error, detail:
12:19:39.745 -> Token info: type = id token (GITKit token), status = on request
12:19:39.745 -> Token info: type = id token (GITKit token), status = error
So, can you help me to solve this issue ?
Regards,
Minh Duc Le
Hi Sara, greetings from Indonesia. 1 quick question, can ESP32-CAM send the photos straight to the Google Firebase without saving it before to the SD Card?
Hi.
It should be possible but using a different method.
The library function we’re using here expected a path to a file. So, that file must be saved somewhere on our board or on a microSD card connected to the board.
Regards,
Sara
Worked first time. Excellent tutorial!
Can anyone help me to save the photo as date and time
Hello from south of France,
How can I store video streaming sent from (ESP32 Cam AI Thinker) into a local database ?
Any idea ?
I am getting this error output and no photos are posting:
Opening port
Port open
11:06:28:088 -> Connecting to WiFi…
11:06:29:080 -> Connecting to WiFi…
11:06:30:067 -> Connecting to WiFi…
11:06:31:094 -> Connecting to WiFi…
E (6157) SPIFFS: mount failed, -10025
11:06:47:684 -> SPIFFS mounted successfully
11:06:48:307 -> Token info: type = id token (GITKit token), status = on request
11:06:48:339 -> Token info: type = id token (GITKit token), status = error
Token error: code: -4, message: connection lost
Taking a photo…
11:06:48:465 -> Picture file name: /data/photo.jpg
11:06:49:357 -> The picture has been saved in /data/photo.jpg – Size: 94336 bytes
11:06:50:307 -> Token info: type = id token (GITKit token), status = on request
Token info: type = id token (GITKit token), status = error
Token error: code: -4, message: connection lost
11:06:52:329 -> Token info: type = id token (GITKit token), status = on request
Token info: type = id token (GITKit token), status = error
Token error: code: -4, message: connection lost
11:06:54:341 -> Token info: type = id token (GITKit token), status = on request
Token info: type = id token (GITKit token), status = error
Token error: code: -4, message: connection lost
Do you know what is causing this?
Thanks.
I fixed this, my WIFI login was incorrect. It works now, Thanks anyway.
A pleasure to greet you, I have not been able to manage to save the image in firebase, I tried with mem_storage_type_sd and mem_storage_type_flash and it gives me the following errors:
Picture file name: /data/photo.jpg
The picture has been saved in /data/photo.jpg – Size: 36864 bytes
Uploading picture… SD Storage is not ready.
and when i use flash:
Picture file name: /data/photo.jpg
The picture has been saved in /data/photo.jpg – Size: 36864 bytes
Uploading picture… File not found.
I already checked the rules and remove gs://
rules_version = ‘2’;
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth !=null;
}
}
}
I don’t know what else to try, please I need your help.
Thank you
Hi.
Can you use the same code, but replace “SPIFFS” with “LittleFS”?
Let me know if that will solve the problem.
Regards,
Sara
Greetings Sara, thanks for your answer, I have tried with “LittleFS” but I still can’t get it to work, I get the following error:
Connecting to WiFi…
LittleFS mounted successfully
Token info: type = id token (GITKit token), status = on request
Token info: type = id token (GITKit token), status = ready
Taking a photo…
Picture file name: /data/photo.jpg
Failed to open file in writing mode
Taking a photo…
Picture file name: /data/photo.jpg
Failed to open file in writing mode
Taking a photo…
Hi.
I’m not sure what might be wrong.
Try changing the picture filename to data/photo.jpg instead of /data/photo.jpg.
Not sure exactly what is the issue…
Regards,
Sara
Hello Sara,
I am having the same problem here is what my serial monitor shows.
cam_hal: EV-EOF-OVF
The picture has been saved in /data/photo.jpg – Size: 135168 bytes
cam_hal: EV-EOF-OVF
Uploading picture… File not found.
Any help would be great!
Thanks
Hi.
I think there’s some sort of incompatibility with the most recent version of the ESP Firebase Client library.
I found that version 4.3.0 works fine while most recent versions give that error.
Revert to version 4.3.0 and it should work fine. I just tested it and it works.
Regards,
Sara
Hello Sara, thanks for a great and very useful tutorial. Firebase side is all good I think, but I get an error when the ESP32 tries to upload the picture. Any ideas? I get this error with Platformio and Arduino IDE…I’m using a Freenove-ESP32-WROVER-DEV module and had to change the pin config to suit but it seems to take the photo ok.
Connecting to WiFi…
Connecting to WiFi…
SPIFFS mounted successfully
Token info: type = id token (GITKit token), status = on request
Token info: type = id token (GITKit token), status = ready
Taking a photo…
Picture file name: /data/photo.jpg
The picture has been saved in /data/photo.jpg – Size: 57344 bytes
Uploading picture… File not found.
Hi.
Can you try replacing SPIFFS in your code with LittleFS?
Let me know if that solves the problem.
Regards,
Sara
Hello Sara,
I have the same problem.
22:33:41.198 -> Connecting to WiFi…
22:33:41.759 -> SPIFFS mounted successfully
22:33:42.368 -> Token info: type = id token (GITKit token), status = on request
22:33:44.989 -> Token info: type = id token (GITKit token), status = ready
22:33:44.989 -> Taking a photo…
22:33:45.129 -> Picture file name: /data/photo.jpg
22:33:48.500 -> The picture has been saved in /data/photo.jpg – Size: 289408 bytes
22:33:48.546 -> Uploading picture… File not found.
How do I replace in my code SPIFSS with LittleFS?
Hi.
You just need to replace the word SPIFFS with LittleFS.
The rest remains the same.
Let me know if that solves the problem so that I can update the tutorial.
Regards,
Sara
Thank you Sara.
Still not working, now with another error
I use the Arduino IDE 1.8.19. I had to download and install the LittleFS library from the URL https://github.com/lorol/LITTLEFS because otherwise it gave compile errors
I have replaced #include <SPIFFS.h> with #include <LITTLEFS.h> and references to SPIFFS with LITTLEFS except for those that appeared as part of the function name that I have kept.
Here is the serial output:
13:29:46.539 -> Connecting to WiFi…
13:29:47.007 -> LITTLEFS mounted successfully
13:29:47.662 -> Token info: type = id token (GITKit token), status = on request
13:29:51.453 -> Token info: type = id token (GITKit token), status = ready
13:29:51.453 -> Taking a photo…
13:29:51.547 -> Picture file name: /data/photo.jpg
13:29:51.547 -> Failed to open file in writing mode
Any ideas?
Thanks again
Hi.
You don’t need to install that library.
It is included by default as long as you have your ESP32 boards updated.
Go to Tools > Board > Boards Manager > search for ESP32 and check your version.
Regards,
Sara
Hello Sara,
My ESP32 version on Arduino IDE is 1.0.6
Thanks
Hi agian.
You need to update it.
Go to File > Preferences, and add this new URL to the Additional Boards Maaner URLs field instead of the previous one:https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
Then, you should be able to update to version 2.0.X.
Regards,
Sara
Hi Sara,
After doing what you tell me, I have updated the version of the ESP32 to 2.0.7 and I have removed the LittleFS library that I had installed.
When compiling it gives me the same error for which I added the library “LITTLEFS.h: No such file or directory”
BR
Hi.
I’m sorry for the misunderstanding.
Use the code as it is, with SPIFFS, and downgrade the library version.
Regards,
Sara
Hi Sara,
Changing all the SPIFFS to LittleFS does not solve the problem: (see results below) Also tried #define SPIFFS LittleFS but same result.
Sticking with SPIFFS, I simplified the problem by downloading a very simple text.txt file to the /data folder using PlatformIO and tried to upload it to Firebase but still get ‘File not found’ I can open the text file and read and print its contents as in one of your other tutorials, before and after trying the Firebase upload. I tried changing the path/filename to every conceivable option text.txt, /text.txt, data/text.txt, /data/text.txt. /spiffs/data/text.txt etc. etc. but always get ‘File not found’ Same result on PlatfomIO and Arduino IDE 2.0.3………. looks like it’s the Firebase.Upload command where the problem lies. I can use the Firebase.Upload with a binary array using the other Firebase.Upload overload and that works fine and ends up in my firebase Storage……. so a bit stuck right now but still trying.
Results from changing all SPIFFS to LittleFS is:
Connecting to WiFi…
./components/esp_littlefs/src/littlefs/lfs.c:1229:error: Corrupted dir pair at {0x0, 0x1}
E (4622) esp_littlefs: mount failed, (-84)
E (4623) esp_littlefs: Failed to initialize LittleFS
SPIFFS mounted successfully
Token info: type = id token (GITKit token), status = on request
Token info: type = id token (GITKit token), status = ready
Taking a photo…
Picture file name: /data/photo.jpg
[ 11855][E][vfs_api.cpp:332] VFSFileImpl(): fopen(/littlefs/data/photo.jpg) failed
Failed to open file in writing mode
[ 11870][E][vfs_api.cpp:105] open(): /littlefs/data/photo.jpg does not exist, no permits for creation
Hi.
I think it’s an issue with the most recent versions of the library-
I found that version 4.3.0 works fine while most recent versions give that error.
Revert to version 4.3.0 and it should work fine. I just tested it and it works.
Regards,
Sara
Hi.
I just tested the code.
I think it’s an issue with the most recent versions of the library.
I found that version 4.3.0 works fine while most recent versions give that error.
Revert to version 4.3.0 and it should work fine. I just tested it.
Regards,
Sara
Hi Sara,
I just tried that version of the Firebase Arduino Client Library, 4.3.0 instead of 4.3.7 and it works. Hurrah for that!!!
I had tried the version you were using at the time of the tutorial, 2.3.7 but that has compatibility issues now and doesn’t compile.
Thanks very much for taking the time to solve this. Your efforts are very much appreciated. You put a lot of effort into answering these comments.
Incidentally, I have been having problems trying to use LittleFS instead of SPIFFS and still have not got to the bottom of that, so if you are looking for a tutorial idea, something with LittleFS perhaps?
Hi Sara,
With https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json card package, ESP32 card version 2.0.7, Firebase library version 4.3.0 and SPIFFS works
Thanks
I just got a new problem:
Taking a photo…
Picture file name: /data/photo.jpg
The picture has been saved in /data/photo.jpg – Size: 156928 bytes
Uploading picture… File not found
What can that be?
Hi everybody
I just got a new problem:
Taking a photo…
Picture file name: /data/photo.jpg
The picture has been saved in /data/photo.jpg – Size: 156928 bytes
Uploading picture… File not found
What can that be?
Hi.
I think it’s an issue with most recent versions of the library-
I found that version 4.3.0 works fine while most recent versions give that error.
Revert to version 4.3.0 and it should work fine. I just tested it.
Regards,
Sara
hy! i upload the code to my esp32-cam and every thing compile correct but for the last 2 days this is the message that it’s apeare in serial monitor “Taking a photo…
Picture file name: /data/photo.jpg
The picture has been saved in /data/photo.jpg – Size: 91008 bytes
Uploading picture… File not found.”‘
until last 2 days ago every thing work correctly but now no and i made another project in firebase and the same problem. do you know why this hapen ? thx!
Hi.
I think it’s an issue with most recent versions of the library-
I found that version 4.3.0 works fine while most recent versions give that error.
Revert to version 4.3.0 and it should work fine. I just tested it.
Regards,
Sara
thanks, it worked. do you think you could make an example in which the name of the picture changes at each iteration in the loop?
We’ll create something similar soon.
So, stay tuned.
Regards,
Sara
Im getting the error “board or architecture is not supported” any idea how to fix this? thanks!
Hi.
What board are you using?
What board are you selecting in Tools > Board?
Regards,
Sara
536 / 5,000
Resultados de traducción
Traducción
Hello dear, when compiling the following error appears
Archiving built core (caching) in: /tmp/arduino_cache_176618/core/core_esp32_esp32_esp32cam_CPUFreq_240,FlashMode_qio,FlashFreq_80_b9cf92f8f962fca57217cf582a443251.a
exec: “python”: executable file not found in $PATH
Error compiling for AI Thinker ESP32-CAM card.
Sorry if you don’t understand, I’m writing from Chile, I’m not fluent in English, I use Google translator, and if the query was made but I didn’t find something similar, I appreciate your help, and congratulations for the work.
Hi.
Take a look at this discussion: https://stackoverflow.com/questions/60762378/exec-python-executable-file-not-found-in-path
It’s the same issue as yours.
I hope it helps.
Regards,
Sara
Taking a photo…
Picture file name: Ĭ⸮?
[E][vfs_api.cpp:265] VFSFileImpl(): fopen(/spiffs/data/212.jpg) failed
The picture has been saved in /data/212.jpg – Size: 0 bytes
Hi.
What’s theversion of the Firebase library you’re using?
Regards,
Sara
Hi Sarah 4.3.0
Update to the most recent version.
Do the he same for the ESP32 boards installation.
Regards,
Sara
error on this
Token info: type = id token (GITKit token), status = ready Uploading picture… File not found.esp32 cam project
why i am getting this ??
The picture has been saved in /data/phot.jpg – Size: 0 bytes
Uploading picture…
response payload read timed out due to network issue or too large data size
the size of picture is also not large.. tell me solutions please?
Hi.
Check the comments of KM on May 2022.
Regards,
Sara
tôi muốn có một dòng code để khi bắt đầu cứ 10 giây là máy ảnh của tôi lại chụp một ảnh và tự động gửi lên firebase . mong mọi người giúp đỡ tôi , tôi xin cảm ơn
Here’s how i fixed the problem of uploading to firebase storage by the sd card (SD_MMC).
https://github.com/mobizt/Firebase-ESP-Client/discussions/352
i added this…
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
#if defined(DEFAULT_SD_FS) && defined(CARD_TYPE_SD_MMC)
Serial.print("\nMounting SD_MMC Card... ");
if (!Firebase.sdMMCBegin("/sdcard", false, true))
{
Serial.println("failed\n");
return false;
}
else
{
Serial.println("success\n");
return true;
}
#endif
/////////////////////////////////////////////////////////////////////////////////////////
to the end of the file “SDHelper.h”. I hope this helps..
Sorry i meant FirebaseFS.h file. check that file as you will be able to change it from SD to SD_MMC.
Thanks
Thanks for sharing.
Hi sara! Can you help me?
Hi.
What’s the issue?
Regards,
Sara
i got this error help me please:
E (533) esp_core_dump_fg⸮f⸮: No core dump partition found!
E (533) esp_core_dump_flash: No core dump partition found!
Connecting to WiFi…
E (1587) SPIFFS: spiffs partition could not be found
An Error has occurred while mounting SPIFFS
ets Jun 8 2016 00:22:57
Hi.
What settings do you have selected in the Tools menu for your board?
What partition scheme do you have select?
Regards,
Sara
Hy. in my serial monitor i recive the next text and i don’t find where is the problem in my code :Taking a photo…
Picture file name: /data/photo.jpg
Failed to open file in writing mode
Thanks so much! I had had issues with Firebase in the past, but your crisp and clear instructions in this tutorial made it all very step-by-step and tested out in under an hour on the first try!
That’s great!
I’m glad our tutorials are useful.
Regards,
Sara
Hy. in my serial monitor i recive the next text and i don’t find where is the problem in my code :Taking a photo…
Picture file name: /data/photo.jpg
Failed to open file in writing mode
As far as I can see this problem is related to the SPIFFS.h library but I can’t find any workaround to fix it. do you think you could give me a recommendation?
hi my image result are like this:
https://firebasestorage.googleapis.com/v0/b/apps-2ee38.appspot.com/o/doc%2Fphoto.jpg?alt=media&token=56135d80-5a70-49d6-88f7-e3513e6f7388
the color is not correct. it all green & black
anything wrong from it?
Hello! I still get the serial monitor Photo file name: “/data/photo.jpg
Failed to open file in write mode
Uploading image…
Download URL:”
And I don’t understand why I keep getting “Failed to open file in write mode” until now or it was working without problems. I tried to change the version of the ESP_Firebase_client library to 4.3.0 but still the same thing.
Hi.
What is the version of the ESP32 boards that you have installed?
Go to Tools > Boards > Boards Manager, search for ESP32 and check the version.
Regards,
Sara
Please help me this error anyone!
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13924
ho 0 tail 12 room 4
load:0x40080400,len:3600
entry 0x400805f0
Connecting to WiFi…
SPIFFS mounted successfully
Token info: type = undefined, status = error
Token error: code: -127, message: missing required credentials e.g., database URL, host and tokens.
Taking a photo…
Picture file name: /data/photo.jpg
cam_hal: EV-EOF-OVF
Failed to open file in writing mode
I don’t know why the first pictures is going right but the next one is not
Taking a photo…
Picture file name: /data/photo.jpg
Failed to open file in writing mode
Uploading picture…
Download URL: ………
Hi Sara
Iam facing this issue “Failed to open file in writing mode”.
i have downgrade the library vesion to 4.3.0 but stiil having problem
Also i have checked the board version it iss 2.0.8
how to increment on file ?
Hello and sorry to bother you. I’m using your project as a basis for developing an application and everything is working great. I connected a ST7735 TFT display to the ESP32-CAM. I would like, when capturing an image, to have one with the resolution of the TFT and immediately after take another one with a higher resolution.
Is it possible to sample the resolution of the ESP32 several times during the execution of the sketch? How can I do?
Thank you for your kind cooperation
Hello Sara,
this question is a little different, I implemented this code in an ESPCAM and worked perfectly, then, based on that, I copy / paste this code and implemented in the normal ESP32 board, modiffied and adapted for WAV file recording (audio instead of picture), I was able to save the wav file in SPIFFS and name it as I wanted, average size 641 Kb. I get connection with firebase, token, status ready, but never able to upload the file:
File name Size
recording.wav 655404 bytes
Token info: type = id token (GITKit token), status = on request
Token info: type = id token (GITKit token), status = ready
Uploading audio…
Of course I´ve changed the mime type, and tried with different names, also I have tried using the same name as picture and same mime type but no success, I wonder if you have worked with audio uploads from esp32 in firebase, I would appreciate if you send me a link with info or documentation in order to solve my problem.
thanks in Advance,
Juan
Hi.
Unfortunately, I haven’t experimented with sending audios via Firebase…
Regards,
Sara
hrst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13964
load:0x40080400,len:3600
entry 0x400805f0
Connecting to WiFi…
Connecting to WiFi…
Connecting to WiFi…
SPIFFS mounted successfully
Token info: type = id token (GITKit token), status = on request
Token info: type = id token (GITKit token), status = ready
Taking a photo…
Camera capture failed
Uploading picture… file not found.
Thnx a bunch, it helped alot. I will be more grateful if u told me how can I save multiple photos in the database.
Can I save the photo file into local network drive?
anyone have code for multiple images uploading.? if it’s, please can get that?
Is it possible to store images in SD card and send it Firebase one by one?
Can you explain how to do this with the code you provided?
I change code to send multiple images to firebase. Currently it’s working. if someone needs the code, just drop a mail. [email protected]
hi sara
i have this problem cant seem to fix can you help
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a68
entry 0x403c98d4
Connecting to WiFi…
LittleFS mounted successfully
Guru Meditation Error: Core 1 panic’ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
Hi Sara,
I found a problem with the Firebase _ESP-Client library
I know it has been replaced but it is working by a customer and I should solve the problem I try to explain:
Token info: type = token id (GITKit token), status = error
I found that the Firebase call token, from this Library, lasts 60 minutes. At the end of this time you must request a new token or restart the system.
Have you ever encountered this problem?
Do you have a solution then?
Thanks for the kind cooperation.
Best regards.
Hello Sara, I got an error below, PS I am using M5Stack esp32 cam
Connecting to WiFi.
WiFi connected.
LittleFS mounted successfully
E (1236) cam_hal: cam_dma_config(301): frame buffer malloc failed
E (1237) cam_hal: cam_config(389): cam_dma_config failed
E (1237) camera: Camera config failed with error 0xffffffff
Camera init failed with error 0xffffffff
E (6796) wifi:NAN WiFi stop
ets Jun 8 2016 00:22:57
Do you get any other information on the serial Monitor?
Which board are you selecting in Tools > Board?
Regards,
Sara