PhotoBox Fragment Dos – Hardware & WiFi Hotspot

Hardware

The CubieTruck is a good start, to turn it into a useful photo storage device, I believe that it needs a few hardware additions. The hardware I’ve used is detailed below:
  • CubieTruck;
  • Black Ewell case – it has a nice rubberised exterior and enough space for all of the other items I wanted to add;
  • WD 1.0TB 2.5″ hard drive – the case is specific for 2.5″ disk and you can power it from the board. There is a 3.5″ adapter available, which requires a dedicated external power supply;
  • 5300mAh Li-bartery – found on https://www.buyapi.ca/;
  • 150M USB WiFi Module – explained lower why I use 2 WiFi adaptors;
  • 2A USB power-supply – not necessary if you already have one and,
  • Double-sided tape – to hold the battery in place.
The battery fits neatly underneath the harddrive (only the cable shown in the image). For a nice guide on the hardware install see the following link: http://cubieboard.org/2014/02/27/ewell-has-come-minipc-not-be-far-behind/
Approximate over all cost is somewhere in $200-$250 (CAD): $100 of which was the 1TB drive (March 2014).

A WiFi hotspot

WiFi Background

The initial plan was to let the PhotoBox connect to a network through WiFi or Ethernet (or both) for my devices to gain access. This works well while at home; however after setting up the WiFi (see the first Blog post), I realised that access to setup the WiFi access (to other networks) would require a cable between the box and a computer to connect to new hot[-]spots.

For a very small price, there is a USB WiFi Dongle (specifically for CubieBoard I and II) that I added to the set up to allow it to act as both a WiFi client and hotspot. Note: there are other ways that this would be possible, such as a script that auto-starts the hotspot after it detects there is no active WiFi, but I wanted to keep it simple for the initial project set up.

WiFi USB Dongle

Before trying to set up the PhotoBox as a WiFi hotspot, I needed to ensure that I could still access the internet wirelessly and through a cable. The cable, known as ‘eth0’ was already working as is the onboard WiFi known as ‘wlan0’. The USB WiFi Dongle wasn’t detected until I added its module to the kernel:
$ sudo
$ modprobe 8188eu
$ ifconfig -a
$ iwlist wlan1 scan
The initial network configuration is just the same as before, edit “/etc/network/interfaces” and add:
auto wlan1
iface wlan1 inte dhcp
wpa-conf /etc/wpa.conf
(for testing I use the same wifi file)
$ ifconfig wlan1 down
$ ifconfig wlan1 up
$ ifconfig
Both interfaces now show an IP address, and connection to the router. (remember to add the module into the “/etc/modules” file to have it operate on boot).

Hotspot Software & Settings

Hostapd is the program that I used for creating and managing the WiFi hotspot. It can be obtained through apt-get (for version 1 at time of writing), but for higher level security (WPA or WPA2) you need version 2.

Getting hostapd v2

Normally I’m not a fan of compiling software that I want to use, if something goes wrong you need a lot of patience to sort it out, thankfully there is a decent setup-by-setup guide found at: http://www.pietervanos.net/knowledge/debian-install-hostapd-2/ I have also included the steps I followed as a reference point here:
$ sudo apt-get install git-core
$ cd ~/
$ git clone git://w1.fi/srv/git/hostap.git
$ cd hostap/hostapd
$ cp defconfig .config
$ sudo apt-get install build-essential pkg-config
$ sudo apt-get install libnl-3-dev libnl-genl-3-dev libssl-dev

Edit the “.config” file and remove the ‘#’ from the beginning of the following lines:

CONFIG_LIBNL32=y
CONFIG_IEEE80211N=y
CONFIG_IEEE80211AC=y
CONFIG_DEBUG_FILE=y
CONFIG_HS20=y
$ sudo make
$ sudo make install
$ hostapd -v
Update the kernal modules “/etc/modules” to all for the WiFi card to act as a hot-spot
bcmdhd op_mode=2

Making a WiFi hotspot

For ‘quick and easy’, only a few basic settings are applied to the hostapd config file “/etc/hostapd-basic.conf”:
interface=wlan0
driver=nl80211
ssid=test
channel=1
wpa_passphrase=password

I’m using the onboard WiFi ‘wlan0’ as the hotspot interface: to test, just start the hostapd application:

sudo hostapd /etc/hostapd.conf
A machine / mobile device can now see the WiFi (and probably connect), but nothing more until the network configuration which will be in the next blog post.
use ‘control’ + ‘c’ keys together to terminate before continuing to the next bet.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s