Wireless USB flash drive using Raspberry Pi

Configurare noua (How To)

Situatie

1. What this Project does

You will create a portable Wi-Fi storage device that:

  • Acts like a USB flash drive over Wi-Fi

  • Lets phones, laptops, or tablets connect wirelessly

  • Allows file upload/download

  • Can create its own Wi-Fi network

  • Runs from a power bank

Final result:

Phone / Laptop

Wi-Fi

Raspberry Pi

USB Flash Drive / SD Storage

2. Hardware Requirements

You need:

Core components

  • Raspberry Pi Zero W (best for portable)

  • MicroSD card (16–32GB recommended)

  • USB flash drive (optional for extra storage)

  • Micro USB OTG adapter

  • Power bank or USB power supply

Optional but useful

  • Case

  • Heat sinks

  • Small OLED screen for status

3. Install Raspberry Pi OS

Download Raspberry Pi OS and flash it.

Step 1 – Install Raspberry Pi Imager

Download:

Install Raspberry Pi Imager

Step 2 – Flash the SD card

Choose:

Raspberry Pi OS Lite

(Lite version is best for this project)

Configure before writing:

Enable:

  • SSH

  • Wi-Fi

  • Username/password

Insert the card into the Pi and boot.

4. Update the System

Connect via SSH:

ssh pi@raspberrypi.local

Update everything:

sudo apt update
sudo apt upgrade -y

5. Attach the USB Flash Drive

Insert your USB drive and check:

lsblk

Example output:

sda1 64G

Create mount point:

sudo mkdir /mnt/usb

Mount it:

sudo mount /dev/sda1 /mnt/usb

Make it permanent:

sudo nano /etc/fstab

Add:

/dev/sda1 /mnt/usb vfat defaults,nofail 0 0

Install Samba:

sudo apt install samba -y

Edit config:

sudo nano /etc/samba/smb.conf

Add at bottom:

[USB]
path = /mnt/usb
browseable = yes
writeable = yes
create mask = 0777
directory mask = 0777
public = yes
guest ok = yes

Restart Samba:

sudo systemctl restart smbd

7. Create a Wi-Fi Access Point

Install required tools:

sudo apt install hostapd dnsmasq -y

Stop services temporarily:

sudo systemctl stop hostapd
sudo systemctl stop dnsmasq

Edit:

sudo nano /etc/dhcpcd.conf

Add:

interface wlan0
static ip_address=192.168.4.1/24
nohook wpa_supplicant

Configure hostapd

Create config:

sudo nano /etc/hostapd/hostapd.conf

Add:

interface=wlan0
driver=nl80211
ssid=PiFlashDrive
hw_mode=g
channel=7
wmm_enabled=0
auth_algs=1
wpa=2
wpa_passphrase=raspberry123
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP

Tell hostapd to use the config:

sudo nano /etc/default/hostapd

Change:

DAEMON_CONF=”/etc/hostapd/hostapd.conf”

Configure DHCP

Backup original:

sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig

Create new config:

sudo nano /etc/dnsmasq.conf

Add:

interface=wlan0
dhcp-range=192.168.4.10,192.168.4.50,255.255.255.0,24h

8. Enable Services

Start services:

sudo systemctl start hostapd
sudo systemctl start dnsmasq

Enable on boot:

sudo systemctl enable hostapd
sudo systemctl enable dnsmasq

9. Test the Wireless Flash Drive

  1. Power the Raspberry Pi

  2. Look for Wi-Fi network:

PiFlashDrive
  1. Connect using password:

raspberry123
  1. Access storage from:

Windows:

\\192.168.4.1

Mac/Linux:

smb://192.168.4.1

You now have a wireless USB flash drive.

10. Optional Improvements

Web file manager

Install FileBrowser for browser uploads.

Add battery monitoring

Useful for portable setups.

Enable internet sharing

So the Pi acts as Wi-Fi storage + internet router.

Add SSD storage

For large capacity wireless storage.

11. Powering the Device

Use:

  • 10,000mAh power bank

  • 5V 2A output

Runtime:

6–12 hours

depending on model.

12. Final Result

You now have a DIY wireless USB drive that:

  • Works with phones

  • Works with Windows / macOS / Linux

  • Requires no cables

  • Can hold hundreds of GB.

Solutie

Tip solutie

Permanent

Voteaza

(11 din 21 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?