Arduino as USB stick?


Does anyone know if an Arduino board can act as a USB memory stick? Suppose you connect a SD card to the board, is it possible to use it so you can see/delete/add files on the connected SD card when plugged in the computer? If this is not possible, will it be with the upcoming Leonardo as it has usb host functionality?
I've searched Google but did not find an answer.

Thank you

usb host functionality

Is not what you need. As USB host, you can rather access other USB devices ( like USB sticks or other Arduinos ).

First, you’d need to write / get a different Arduino driver for your PC. The existing one makes it behave like a serial COM port, not an external disk.
Then, you’d have to reprogram the Atmega16U2 as well, I fear, and have dedicated code on your Atmega 328 to address an SD card shield .
With that, you can’t use the Arduino as an Arduino any more.

So the answer is No, IMO.

It were a rather expensive SD card reader.
And the advantage of SD cards is that you can easily get them in and out and move them around.

You can make an Arduino emulate a user input device, but I don’t know whether it can emulate a storage device. Would it not be simpler to use a standard USB/SD card reader? They are far cheaper than an Arduino.

I found it :slight_smile:

Atmel and Arduino will be demonstrating several platforms in the Atmel-sponsored Arduino Pavilion including:
Arduino Leonardo. Based on the Atmel ATmega32u4, it is a low-cost Arduino board which includes a simpler circuit as the Arduino UNO board. The software on the board includes a USB driver that can simulate a mouse, keyboard and serial port. In addition, the bootloader includes a serial port and USB mass storage driver.

from Smart | Connected | Secure | Microchip Technology
The upcoming Leonardo will support it.

Thank you for the responses.

If you have an R3 UNO with the atmega16u2 providing the USB interface then you should be able to use the LUFA library to implement a USB mass storage driver, turning your UNO into a USB storage device.

Yeah, in theory this is easy. In my experience though USB programming is tricky at least. Most probably way out of the reach of the average Arduino tinkerer. The most severe issue is that USB debugging is a non trivial issue. It also is necessary to have quite a reasonable grasp of how USB actually works.

IMHO it would be much simpler to connect the SD card in such a way that it will be directly connected to the computer and that Arduino can claim the connection when the contraption is not connected to the computer. However this is not trivial either because in order to manipulate files on the card from within the Arduino you need at least something like a filesystem driver which is not trivial either.

I know this is an old post, but was wondering if anyone ever got something like this to work?

I was going to try to use an Arduino Micro as a client, plunged into the USB port of a host TV through a USB to TTL adaptor.
I was then aiming to have the Micro connected to a PC via the USB cable and try to provide the TV access to a folder on the PC, as if it was native USB stick content.

I'm not sure if there are any libraries that could help with this now?

Actually, the answer is yes.

  • There is a way to program the Arduino as a USB Mass Storage Device.

I have done it before (about 8 years ago).
I had both Emulated an SD Card,
and used an SD Card as a pass through Mass Storage media for the USB;
both for the USB as a USB Device to the PC.

  • I will need to look around for the code.

I should not need to provide this though - there are a few solutions to this out on the Internet.

  • LUFA for example.