Close
0%
0%

Portable travel NAS

A battery powered NAS that connects to your smartphones mobile hotspot

Similar projects worth following
It's summertime, vacation time! Me and my girlfriend will be on the road across Europe for two weeks, both music and movie addicts. Memory is sparse on our smartphones and we prefer not to bring a laptop. Further more, we take a TON of pictures. Those will easily fill up our phones memory

Using a lot of mobile data is still very expensive when roaming in the EU and using USB-OTG can be tedious.

A couple of devices are on the market that are essentially hard drives with a wifi-hotspot attached, connect to the network and use an app to access the files. This will cut you off of the mobile network as your phone prefers wifi. Not very useful if you need mobile data for navigation or communication.

The solution: have the NAS (network attached storage) connect to your phone as a client, now you can access the files across multiple devices as wel as the mobile data network.

The criteria for this project are as follows:

  • Low power
  • Off the shelf components
  • Portability
  • Ease of use

Low power

I chose an Atheros based board for it's low power requirements. For example, a Raspberry Pi uses > 2W. The Carambola 2 has a rated consumption of just 0,5W

Off the shelf components

As this is the age of mobile devices, there are more and more mobile accessories. Small hard drives just powered by USB are ideal for this project. Power banks have been getting cheaper and better, some of them are now supporting 'pass through charging'. See the power consumption log for more info.

Portability

Combined weight will be around 300 grams, that's a file server and UPS at a third of a kg!

At 100x60x40mm (LxWxH) it's not exactly huge.

Ease of use

This is the aspect that poses some challenges. The setup is especially hard, most notably for the ones who are not prolific in linux.

Once setup is done though it's easy as pie, just turn on your Wi-Fi hotspot and browse to the shared folder. Some apps even let you set the share as the base folder for your media library. 

  • 1 × Carambola 2 board Atheros AR9331 SoC based with OpenWRT
  • 1 × Mobile powerbank Xiaomi Mi 10400mAh
  • 1 × 1TB portable hard drive Samsung M3 portable

  • Assembly

    Guus van der Sluijs06/10/2014 at 16:43 0 comments

    The printed enclosure was finished way before I expected, I found myself racing on my bike to the pickup location on a tropical day.

    It took a couple of minutes of sanding to have all the parts fit inside, but it was a glorious moment when done.

    Not wanting to desolder the surface mounted USB ports I took a hobby knife to some mini USB cables. Thankfully the business end of the cables had some nice solder pads to them. I still need to add some shielding to the cable that runs from the carambola (top) to the hard drive (middle), read  and write times are pretty appalling now.

    Ain't she pretty?

    Weight turned out to be 500 grams, the battery pack packs the most weight at 250 grams.

  • ​3D printable enclosure

    Guus van der Sluijs06/08/2014 at 23:26 0 comments

    Instead of smacking the components together in a sandwich box I decided to design a fancy 3D printed enclosure for my components. Stacking them up in a pyramid fashion like you see in the HTC One for example.

    Here's a little render:

    As you might be able to tell; the battery pack goes into the bottom slot, hard drive in the middle and the little OpenWRT board (hopefully) slots nicely into those rails in the top compartment.

    I just submitted it to a 3D printing press, hoping to have it over here in a day or two.

    Dimensions: 

    • L: 115mm ( 4.5" )
    • W: 75mm ( 3.0" )
    • H: 55mm ( 2.2" )

  • First test

    Guus van der Sluijs06/08/2014 at 22:58 0 comments

    The battery's charged, hard drive has lost its enclosure and gained some music, the Carambola has the right config.

    This is the current setup, i'm working on an enclosure:

    I already had tried with a usb key, not sure if a 1TB hard drive could be handled by the carambola. If pictures had sound you'd hear the sweet sound of music being streamed from a battery powered nas :)

  • Power consumption: a quick calculation

    Guus van der Sluijs06/06/2014 at 10:49 0 comments

    So for how long would my NAS be able to run autonomously? 

    Carambola2 data sheet tells me power consumption is 0,5W. This boils down to a current of 100mA 

    The portable hard drive, based on a review, consumes anywhere between 1,5 and 2W. Lets stay on the high side to be safe and assume an average usage of 2W or 400mA.

    Our power bank has a rating of 10400mAh, thus 10400 / (100 + 400) ≈ 20 hours (mAh / mA) 

    What's more, the Xiaomi bank supports a thing called "pass through charging". This means it will be able to supply the NAS with power even while being charged. It just takes what it needs to charge it's battery and leaves the rest available to our SOC and hard drive.

    This means I can leave it hooked up in the car and take it with me as we go for a walk.

  • Proof of concept

    Guus van der Sluijs06/06/2014 at 10:41 0 comments

    This project relies on being able to access other devices associated with a mobile hotspot. 

    To test this I configured a basic web server and samba share on my laptop and had it connect to my phone.

    Next I used ES File Explorer to access the samba share and browsed to find the standard "it works" Apache web page.

    I managed to view and create files on the shared folder.

    Crucially, you'd want the device hosting the samba share to have the same IP every time. The android wifi-hotspot uses a pool from 192.168.43.2 - 192.168.43.10. Setting a static IP on the samba server turned out to be no problem at all, by moving it out of the pool e.g. 192.168.43.20 it was still reachable.

View all 5 project logs

  • 1
    Step 1

    Let's get cracking, get the Carambola up and running. I like to connect to the serial terminal, the development board features a usb ftdi chip allowing me to use a terminal program like PuTTy to connect.

    Connecting to serial terminal

    First step: see that (windows) installs FTDI drivers, if not see http://www.ftdichip.com/FTDrivers.htm

    Serial settings be like:

    Speed: 115200 baud
    Data bits: 8
    Stop bits: 1
    Parity: none
    Flow control: none
    

    When we press connect we're greeted by <strikethrough>the openwrt banner</strikethrough> a blinking cursor!

    Press enter

    Presto!

    If this your maiden voyage on the openWRT board be sure to set a root password.

    Type passwd into the prompt. You will be prompted to set a new password for the user root:

    root@carambola2:~$ passwd
    Changing password for root
    New password:
    Retype password:
    Password for root changed by root
    root@carambola2:~$
    

    WiFi configuration: Android

    This is the easy part, depending on geography and geekyness. Over here in The Netherlands the wifi hotspot functionality comes standard with Android, depending on your provider elsewhere this functionality might be blocked. You'd have to root your handset and install an app like android wifi tether: https://code.google.com/p/android-wifi-tether/

    By the way, root will be necessary if you'd like to mount the samba share on your phone. More on this later.

    For now, we'll use the standard android wifi hotspot functionality:

    Go Settings > Wireless & Networks > More.. > Tethering & portable hotspot > Set up Wi-Fi hotspot

    As you can see in the image this opens up a configuration screen.

    Our SSID will be hackaday

    Security WPA2 PSK

    Password; pick a nice one :)

    After pressing Save the window will close, mark the box next to Portable Wi-Fi hotspot.

    WiFi configuration: OpenWRT

    We're going to configure the device as a 'routed client' but only follow the process until half way, this device is going to be wireless only! Credit goes to the openWRT wiki.

    For the entire guide see: http://wiki.openwrt.org/doc/recipes/routedclient

    Before doing any actual configuration, the wifi interface must be enabled and put into station mode in order to be able to scan for networks in the vincinity:

    uci del wireless.@wifi-device[0].disabled
    uci del wireless.@wifi-iface[0].network
    uci set wireless.@wifi-iface[0].mode=sta
    uci commit wireless
    wifi
    • Remove the disable 1 option from the wireless configuration
    • Set the mode option to station
    • Save changed configuration file
    • Start wireless using the wifi command

    Now we can issue the iwlist scan command to list networks in range.

    !Attention: In Barier Breaker RC3, the latest release candidate, iwlist has been depreciated in favor of iw. Usage is iw dev wlan0 scan.

    Scroll around a little, if the hotspot is running on your phone a network like this will show up:

    root@carambola2:~# iwlist scan
    
    wlan0 Scan completed :
    	Cell 01 - Address: 00:1D:19:0E:03:8F
    	ESSID:"hackaday"
    	Mode:Managed
    	Channel:9
    	Quality:3/5 Signal level:-69 dBm Noise level:-92 dBm
    	IE: IEEE 802.11i/WPA2 Version 1
    	Group Cipher : TKIP
    	Pairwise Ciphers (2) : TKIP CCMP
    	Authentication Suites (1) : PSK
    	Preauthentication Supported
    	IE: WPA Version 1
    	Group Cipher : TKIP
    	Pairwise Ciphers (2) : TKIP CCMP
    	Authentication Suites (1) : PSK
    	Encryption key:on
    	Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 6 Mb/s; 9 Mb/s
    		  11 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
    		  48 Mb/s; 54 Mb/s
    

    We're going to edit a configuration file using vi, a terminal text editor. Here's a litte guide:

    My usefull vi commands:
    'i': start editing text
    'esc': Only after using 'i', when done editing
    ':x': save and quit (only when not in editing mode)
    ':q!': quit without saving
    'dd': remove entire line

    Edit /etc/config/network and change the WAN interface by editing the existing ifname option:

    Type vi /etc/config/network

    config interface 'wan' 
    	option proto 'dhcp'

    Supposed we want to connect to the network called "hackaday", the previous scan result revealed the following information:Note that the wan network section must not contain any ifname option.

    • ESSID is hackaday
    • Channel is 9
    • The network uses WPA/WPA2 mixed mode

    All except for the channel is configured in our Android Wi-Fi hotspot.

    In /etc/config/wireless, locate the existing wifi-iface section and change its network option to point to the WAN interface. Change the mode option to sta (Station) and alter the encryption options to match those of the target network.

    config wifi-device 'radio0'
    	option type 'mac80211'
    	option channel '6'
    	option hwmode '11ng'
    	option macaddr 'c4:93:00:00:1f:bf'
    	option htmode 'HT20'
    	list ht_capab 'SHORT-GI-20'
    	list ht_capab 'SHORT-GI-40'
    	list ht_capab 'RX-STBC1'
    	list ht_capab 'DSSS_CCK-40'
    	option mode 'sta'
    
    config wifi-iface
    	option device 'radio0'
    	option network 'wan'
    	option mode 'sta'
    	option ssid 'hackaday'
    	option encryption 'psk2'
    	option key 'mySuperSecretPasswordJustMadeUp'
    

    Reconfigure the wireless network.

    ifup wan
    wifi

    > reboot the system

    reboot

    Make sure your phone is connected to 3G or LTE and ping google:

    root@carambola2:~# ping <a href="http://www.google.com">www.google.com</a>
    PING <a href="http://www.google.com">www.google.com</a> (173.194.65.106): 56 data bytes
    64 bytes from 173.194.65.106: seq=0 ttl=41 time=473.932 ms
    64 bytes from 173.194.65.106: seq=1 ttl=41 time=379.458 ms
    64 bytes from 173.194.65.106: seq=2 ttl=41 time=386.784 ms
    

    Done.

View all instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates