Notifications
Clear all

[Solved] SD Card Files

Page 1 / 2

ChrisPal323
(@chrispal323)
Eminent Member
Joined: 2 months ago
Posts: 31
Topic starter  

Hello! I wanted to ask about retrieving files from the sd card on the ESP32CAM. Is there a way to query for the files stored on the SD card? So I could check what the name of all the files are on the SD card. I understand I can just save the names but I wanted to ask if there was a more direct way.  Thanks.


Quote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 2755
 

Are you sticking the TF card in a computer and need to know the command to list the files? What OS?

It is considered poor judgement to traverse a chasm in 2 leaps.


ReplyQuote
frogandtoad
(@frogandtoad)
Noble Member
Joined: 3 years ago
Posts: 1324
 

@chrispal323

Posted by: @chrispal323

Hello! I wanted to ask about retrieving files from the sd card on the ESP32CAM. Is there a way to query for the files stored on the SD card? So I could check what the name of all the files are on the SD card. I understand I can just save the names but I wanted to ask if there was a more direct way.  Thanks.

The "SD.h" library makes functions available to do just that, so the answer is yes.  Having said that however, if you're using an ESP32, you don't even need and SD card, as you can store your files directly on the ESP32 SPIFFS file system itself, which is very handy indeed!

If you have some code that you need some help with, feel free to post it here and we can help you to get it working.

Cheers


ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 2755
 
Posted by: @frogandtoad

@chrispal323

Posted by: @chrispal323

Hello! I wanted to ask about retrieving files from the sd card on the ESP32CAM. Is there a way to query for the files stored on the SD card? So I could check what the name of all the files are on the SD card. I understand I can just save the names but I wanted to ask if there was a more direct way.  Thanks.

The "SD.h" library makes functions available to do just that, so the answer is yes.  Having said that however, if you're using an ESP32, you don't even need and SD card, as you can store your files directly on the ESP32 SPIFFS file system itself, which is very handy indeed!

If you have some code that you need some help with, feel free to post it here and we can help you to get it working.

Cheers

I just plugged in an esp32cam and it says it has 1MB of SPIFFS, am I missing something? with a 2MP camera that won't hold many pictures especially compared to a TF card of 32GB or more.

It is considered poor judgement to traverse a chasm in 2 leaps.


ReplyQuote
frogandtoad
(@frogandtoad)
Noble Member
Joined: 3 years ago
Posts: 1324
 

@zander

Posted by: @zander
Posted by: @frogandtoad

@chrispal323

Posted by: @chrispal323

Hello! I wanted to ask about retrieving files from the sd card on the ESP32CAM. Is there a way to query for the files stored on the SD card? So I could check what the name of all the files are on the SD card. I understand I can just save the names but I wanted to ask if there was a more direct way.  Thanks.

The "SD.h" library makes functions available to do just that, so the answer is yes.  Having said that however, if you're using an ESP32, you don't even need and SD card, as you can store your files directly on the ESP32 SPIFFS file system itself, which is very handy indeed!

If you have some code that you need some help with, feel free to post it here and we can help you to get it working.

Cheers

I just plugged in an esp32cam and it says it has 1MB of SPIFFS, am I missing something? with a 2MP camera that won't hold many pictures especially compared to a TF card of 32GB or more.

Oop's, I forgot that images needed to be stored 🙂

In any case, you can increase the partition size from the Tools Menu Board Setting, but I think it might only go to 3MB max - I don't know if there are any other ways to expand it via API etc.

In summary, it's still quite a good on board resource (file system) for text files such as HTML, CSS, .JS etc...

Cheers


ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 2755
 

@frogandtoad YUP, 1MB default, only 3MB if NO OTA and not a huge app which I suspect the old and especially the new esp32-cam web server camera app is.

It is considered poor judgement to traverse a chasm in 2 leaps.


ReplyQuote
frogandtoad
(@frogandtoad)
Noble Member
Joined: 3 years ago
Posts: 1324
 

@zander

Posted by: @zander

@frogandtoad YUP, 1MB default, only 3MB if NO OTA and not a huge app which I suspect the old and especially the new esp32-cam web server camera app is.

Yes, but it is still better than EEPROM, or an SD card for basic text files at least, which can store quite a lot of information, and it's much easier to use.  I'll do some searching to see if the size can be increased further.


ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 2755
 

@frogandtoad The board is 4MB total. The app in question is using SPIFFS for something. In my case, I want to make game cameras so could easily be taking hundreds of pictures between visits. Looking at the compile stats, it looks like it might be possible to get SPIFFS up to 1.5MB but that is nowhere near enough especially if I want video as well as pic captures. Also retrieving a TF card and inserting a new one is much quicker than any board access alternative.

 

 

Screen Shot 2022 06 14 at 07.28.20
Screen Shot 2022 06 14 at 07.24.18

It is considered poor judgement to traverse a chasm in 2 leaps.


ReplyQuote
frogandtoad
(@frogandtoad)
Noble Member
Joined: 3 years ago
Posts: 1324
 

@zander

Posted by: @zander

@frogandtoad The board is 4MB total. The app in question is using SPIFFS for something. In my case, I want to make game cameras so could easily be taking hundreds of pictures between visits. Looking at the compile stats, it looks like it might be possible to get SPIFFS up to 1.5MB but that is nowhere near enough especially if I want video as well as pic captures. Also retrieving a TF card and inserting a new one is much quicker than any board access alternative.

 

 

Screen Shot 2022 06 14 at 07.28.20
Screen Shot 2022 06 14 at 07.24.18

I believe it depends on your board too - It looks like I have different options for partition size:

image

...and my flash size can be as follows:

image

Cheers


ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 2755
 

@frogandtoad The board in question is the somewhat 'standard' AI Thinker ESP32-CAM board. The sketch is able to be configured for a few other boards but I have never seen anything other than the AI Thinker board.

It is considered poor judgement to traverse a chasm in 2 leaps.


ReplyQuote
ChrisPal323
(@chrispal323)
Eminent Member
Joined: 2 months ago
Posts: 31
Topic starter  

@zander @frogandtoad | Sweet, thank you guys for all the information, very helpful! I am using an SD card to store the files, I'm new to browsing documentation, would you happen to know what specific command(s) would be used to find what files are stored on the SD card at a point in time. Thanks!


ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 2755
 

@chrispal323 Is it April 1 somewhere? I just noticed, the answer has already been given.

It is considered poor judgement to traverse a chasm in 2 leaps.


ReplyQuote
frogandtoad
(@frogandtoad)
Noble Member
Joined: 3 years ago
Posts: 1324
 

@chrispal323

Posted by: @chrispal323

@zander @frogandtoad | Sweet, thank you guys for all the information, very helpful! I am using an SD card to store the files, I'm new to browsing documentation, would you happen to know what specific command(s) would be used to find what files are stored on the SD card at a point in time. Thanks!

Check your IDE examples for SD please 😉


Ron liked
ReplyQuote
ChrisPal323
(@chrispal323)
Eminent Member
Joined: 2 months ago
Posts: 31
Topic starter  

@zander I will clarify? I do not see an answer on how to accesses files on an SD card that is mounted to the AI Thinker ESP32CAM. I am not using the SD.h library, but using the SD_MMC.h Im not sure of the differences as I am new to browsing documentation. If you could, direct me on where I should look if I want to list all of the files stored on the SD card that is on the esp32cam.


ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 2755
 

@chrispal323 Sorry, but you need to learn how to do your own research. I have never done what you want either, and I found the answer very quickly from another members post. 

I was assuming you were using the standard esp32-cam webserver example but it sounds like you are using a different example. I can't even find the SD_MMC library.

You keep saying 

I am new to browsing documentation.

That is the number one skill, so maybe that is what you should focus on. Without the ability to read documentation you can not begin to code let alone program.

 

It is considered poor judgement to traverse a chasm in 2 leaps.


ReplyQuote
Page 1 / 2