ESP32 w/SD Card as USB Memory Stick

Ideally, plugging in the ESP Dev board with an SD Card module would look and function just like a USB Memory Stick.

Then every XX minutes, the ESP would read that same SD and preform functions if there have been any changes to the directory.

Many other closed threads here say this is not possible.
But it appears to be done here for a 3D Printer application using the ESP8266.


(note: the card in this case is being read by a 3d printer. but this would not appear to be any different than being written or read by a PC) The ESP would not be writing to the SD. Just reading on a timed basis.
In a perfect world with code to detect whether the CD was being accessed by the PC.

Is this physically impossible, or just difficult due to the danger (that code might solve) of simultaneous access?

The project you link to needs a client on the PC to interface with the WebDAV server to access files and it is not something the operating system can do natively.
Ideally you need an MCU with native USB support as you cannot do this through a USB/UART interface chip as used on most ESP development boards.
I think there is now a variant of the ESP that does have built in USB but I know nothing of what it is capable of on USB.
The Teensy used to have a storage endpoint on it's native USB but I have never used it or know if it works/worked.

I'm tempted to accept defeat. There are no less than a dozen other posts over the last two years asking some variation of this same question. All answered by people far more knowledgeable with an "it's not possible" reply.

But... I know that i can wire the SD card to a USB connector without the ESP32 and create a memory stick.
And I know I can attach the ESP to the SD card and read it and transmit files to and from it over WiFi. That's pretty much what every SD project here is doing in some form.
And it seems to make sense that if I had a switch, I could switch connections between the two so that each could access the SD card at different times. That's the fundamental equivalent of physically pulling it out of one device by hand and putting it into another.
So in my imagination, it seems reasonable to suspect that I could either add some kind of switch chip that the ESP could control to achieve that so both machines aren't trying to access the disk at the same time. Or perhaps not even have to worry about that because it's something the SD card circuitry already deals with on any multi-core computer.
Am I totally off base here? Give me some of that hacker ingenuity and can-do spirit! This seems like a fun puzzle that needs solving. So many projects here would benefit from the ability to load and retrieve files from an SD thru that USB port. :slight_smile:

That sounds unlikely, USB and SPI are totally different. Do you have any references to that?

1 Like

I clearly do not. Pardon my ignorance and thanks.
I now understand that a chip and resistors sit in the middle of that connection as seen here:

Complexity has certainly increased. But I think the basic premise still stands. Both the PC and the ESP32 can read the MicroSD in their own way separately (right?). And switching between them would (again, I assume) be the equivalent of pulling the card out manually and swapping it between machines.
So I'm still searching for a way to enable the ESP to periodically read from the MicroSD while it remains connected to the PC.