Writing from Arduino to a USB Pen Drive..

Is it possible to write from arduino to a usb pendrive? how does it work?

Could you be more specific? Yes it's possible with other hardware and it works well ::slight_smile: The actual way it works is too complicated for here but I'm sure you can find articles on this with a Google search.

If you meant, save data to a USB flash memory device, then the answer is "not directly." Such a function would likely need a LOT of specialized support electronics.

The Arduino's USB port is not a real USB port, it is just used for power and serial communications. Even if it were a real USB port, it would be on the client side (a peripheral of a larger computer), and USB flash memory sticks need to be controlled by a host side device (a port on an actual computer).

Once you got the USB communications out of the way, your Arduino program would have to know the device handling required to access the flash memory as a generic storage device (as opposed to the many other types of devices that USB can manage). It would need to have enough memory to access whole data blocks of the storage device, so it could read and write blocks (you can't just address block storage devices with individual byte addresses). Lastly, if you wanted to use the flash stick in your PC also, your Arduino program would have to know the right set of blocks to read and write to access the filesystem (allocation table, clusters, sectors, etc.).

The latter problem is mostly handled by a couple of shields you can buy for the Arduino, which allows you access to files on a FAT16-formatted 1GB SD memory card. No USB required. Not much program space left, though, as the libraries are a bit heavy.

I think this is what you need:-
http://www.arduino.cc/playground/Main/UsbMemory

or a ready built one is available at:-

http://www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/List/1/ProductID/434/Default.aspx?txtSearch=usb+datalogger&SortField=ProductName%2CProductName

2 Likes