Interfacing Microcontroller with a USB stick to read/delete files

Thread Starter

M3D0

Joined Oct 8, 2020
54
Hello !
So I am starting scratch the surface of the Embedded systems world. I have always wondered how to interface a microcontroller like the AVR for example with a USB stick to read the file names for example or the space left or even format/delete files from the USB stick without using any PC(computers). Is that possible by connecting a USB port to the AVR and by some programming can do such application and how?? or what does it need to do such application with a microcontroller??
Thanks in Advance!
 

Irving

Joined Jan 30, 2016
3,127
Everything is doable but the issue with a USB stick is that the USB gets in the way. There are examples of USB host code for some MCUs and conceptually all you need is a socket and host controller though to be fully USB compliant you need to source 500mA @ 5v to power the USB device which could be problematic on some installations.

Here is a USB Host 'shield' 1662380178962.png
and libraries here.


A much simpler solution, and one I use a lot, is to write to a micro-SD card and then use an USB SD-card adapter...

1662379836706.png
 

Ian0

Joined Aug 7, 2020
6,286
SD cards are a lot easier. You can read them through the SPI port, and the FAT32 filing system isn’t difficult to deal with.
Many microcontrollers that have USB ports can only be slaves, but you need it to be master to read a USB memory stick.
 
Top