How to Set up Wireless Communication on an SBC When an Ad-Hoc Network Won’t Work

Recently, we have had several people reporting that our instructions for setting up an ad-hoc network with the SBC3 do not work. I, as lead support at Phidgets, decided to investigate.

Yup, that’s broken.

There are two reasons this might not work. First, the instructions were written for the SBC2. It’s possible that some differences exist on the SBC3. Second, the newer WiFi adapter we have stocked since the SBC3 launched does not support ad-hoc mode. The most likely reason is the second. The SBC3 runs Debian Linux, so let’s see what the Debian team has to say about setting up ad-hoc networks:

Debian instructions for setting up an ad-hoc network


That does not appear to work either, which more or less confirms my suspicion that the new WiFi adapter does not support ad-hoc mode. Is there a work around for this?  For that matter, is an ad-hoc network even the best solution for communicating with the SBC in the absence of a proper local network?  Maybe it makes more sense to set the SBC up as a wireless access point that other devices can connect to. For testing purposes, I am going to try using hostapd, which is a Linux utility designed for wireless access points and authentication servers.

First, install hostapd on the SBC.

apt-get install hostapd

Now, configure the new network and set the path to the hostapd configuration file. Edit the file /etc/default/hostapd with a text editor like nano or vi. Uncomment the DAEMON_CONF line and set it to

DAEMON_CONF = "/etc/hostapd/hostapd.conf"

Close that file. Now, check what interface the WiFi adapter is associated with. Run ifconfig and it should list all the interfaces available on the system. The WiFi adapter will be something like wlan0 or wlan1. Now open /etc/hostapd/hostapd.conf. Set the interface to be used, the driver that interface uses, and a few other options. A list of everything you might want can be found here, but I found the following options to be all that is actually necessary:

driver=nl80211 ##the driver you should use depends on the device. you can check the driver with lsmod##

country_code=CA ##or whatever country you are in##

ssid=SBCAP ##this is the name of your network, you can call it whatever you like##





All that I had to do after this was give the interface a static IP address (you could let DNS take care of it, but then you have to install some more software, which I was too impatient to bother with). This is straight forward enough. Open /etc/network/interfaces in a text editor and add:

auto wlan0 ##or whichever number yours is##
iface wlan0 inet static
address ##these are more or less randomly selected. you can select an appropriate one for your network##

Finally I started the service, making sure to associate the config file I just made

hostapd -dd /etc/hostapd/hostapd.conf

Now I can connect to the network from other computers with wireless capability:

Untitled Screenshot from 2014-06-13 10_06_11



Now, I should point something out. The driver used by our current WiFi adapter does not support AP mode or ad-hoc mode, from what I can tell. I was able to get this working with our older model and another random part we had lying around. Certainly, most 3rd party adapters would be suitable. The issue is that our current adapter uses a staging driver, which is basically beta software. There are plans to bring out a proper version of it in the future – near future even, according to some things I have read, but I don’t know how soon that actually means.

Tagged with: , , ,
Posted in Products
2 comments on “How to Set up Wireless Communication on an SBC When an Ad-Hoc Network Won’t Work
  1. James Folk says:

    I followed the tutorial, but I ran into two issues. One of which is stopping me from making this work properly. The first was I get the error ‘WPA-PSK enabled, but PSK or passphrase is not configured.’ when i try to connect. I found out the problem was that the ‘wpa_passphrase’ must be longer than 8 characters. The second is that although I am able to view the wlan device, i times out while trying to connect. I can send you the log file if it helps.

  2. James Folk says:

    What software do you need to install to allow DHCP?

Leave a Reply

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

You are commenting using your 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

%d bloggers like this: