...stuff I do and things I like...

Saturday, June 23 2018

USB Mass Storage with Network Access

I finally had time and a use case to build this idea that I had some years ago. The idea is pretty simple. I wanted to have a USB flash drive that is network connected to allow adding files remotely while the drive is connected to a device such as a SmartTV. Basically this would allow any device that is capable of reading files from USB flash drive to have access to data stored on the network.

For the first version of this project I used a Raspberry Pi Zero W. The PiZW comes with a USB OTG port, Wifi, and runs of a mini SDcard. So we have USB client (to emulate a USB mass storage device), Wifi (for network connectivity), and the SDcard for the actual storage.

The current implementation basically is a small linux system that takes up a tiny part of the SD card, the rest of the SD card is used to emulate the USB flash drive. The linux system automatically connects to my WiFi network. You can transfer files to the SD card via SCP. The trick of the system is that you can soft plug and un-plug the USB drive via SSH. This means you simply run a command to enable or disable the mass storage emulation, this will look like an plug or un-plug event to the device the PiZW is connected to.

I used Buildroot for this project, I created a repository that allows you to build this entire device for yourself. My Buildroot repository contains all the scripts and settings to enable USB OTG and device switching. The repository can be found here: github.com/crmulliner/usbnetstore.

After finishing this project I found the SanDisk Wireless Stick basically a USB flash drive with built-in Wifi. Sadly it turns out you can't switch between WiFi and USB using their app (it comes with a mobile app). This means as long as it detects a USB connection it will not allow Wifi Access. Therefore, the SanDisk device is not sufficient for my use case.

My SanDisk Wireless Stick also stopped charging after a week or so (and thus became a brick). I disassembled it and found that the storage is provided by a SD card. The device is actually made by AirStash and sadly does NOT run Linux and therefore is not easily modifiable.

Below some pictures of this project:


One USB connector for power and one USB connector for the flash drive.

I'm now working on the second version of this project.