Products for USB Sensing and Control

Ad-Hoc Networks on the SBC

From Phidgets Support
Jump to: navigation, search

If you ever wanted to communicate with your single board computer wirelessly and without using your home network, then you're probably going to be interested in setting up an Ad-Hoc network connection. And though we currently do not have a proper interface for doing this, the entire process is relatively simple. (Please remember that you will need two wireless adapters to set up your ad-hoc network. One adapter for your SBC and one adapter for your desktop or laptop.)

(You should also disable any current wireless connections you have on the SBC before you attempt to follow this guide.)

In this example, I'm going to show you how to communicate between a computer running a Linux based operating system, such as a laptop or desktop, and the Phidgets Single Board Computer. The first thing you'll need to do is connect to your Single Board Computer via SSH. Remember that you'll need to enable the "SSH Server" on your SBC first.

You can do this by:

  • logging into the SBC's web interface
  • clicking on the "Network" tab
  • clicking on the "Settings" tab
  • selecting "enabled" under "SSH Server"
  • clicking "Save Changes"

When that's done, you can use SSH to log in to your SBC by typing:

ssh root@phidgetsbc.local

Remember, if you changed the hostname of your SBC, you'll need to enter that hostname instead of "phidgetsbc". If you prefer, and if you know what it is, you can always type in the ip address instead.

Once you're logged in, the next step is to navigate to the root directory. If you're not sure how to navigate to the root directory, you can do that by typing:

cd /

Then, we need to create a file called "wireless". We can do this with a simple text editor such as pico.

pico wireless

When pico launches, you will need to copy the following lines of code.

ifconfig wlan0 down
iwconfig wlan0 mode ad-hoc
iwconfig wlan0 essid 'test'
iwconfig wlan0 key 1234567890
ifconfig wlan0 up
ifconfig wlan0
iwconfig wlan0 channel 4

One the code is copied, you can press "ctrl+o" to save the file and "ctrl+x" to exit pico. You may notice that we're setting a lot of the specifics of our ad-hoc network in this file. If you ever want to change any of these settings, you will need to change this file.

You will also need to change the permissions of this file to make it an executable. You can do this by typing in:

chmod +x wireless

When this is done, you will need to edit another file. This time, we're going to edit a file that runs every time the SBC boots up. Begin by navigating to the "etc" directory from root.

cd /etc

Then, start up pico again, but this time, by opening the file "rc.local".

pico rc.local

Finally, copy this line of code right before the "exit 0" line.


After you're done that, simply save the file with "ctrl+o" and exit with "ctrl+x", like you did before. When the file has been saved, you exit out of SSH and reboot the robot.

We have now finished setting up the Ad-Hoc network on the SBC.

The next thing we're going to do is connect our Linux based computer to the SBC via our new Ad-Hoc network. If you're not using Linux, this process is a little bit different.

The nice thing about using Linux is that it's exactly the same process as before. The only difference is only in how we set up the wireless file. For your Linux based computer, the wireless file will look like this instead:

ifconfig wlan0 down
iwconfig wlan0 mode ad-hoc
iwconfig wlan0 essid 'test'
iwconfig wlan0 key 1234567890
ifconfig wlan0 up
ifconfig wlan0
iwconfig wlan0 channel 4

Notice that the only thing I have changed is the ip address. On the SBC, I used an ip address of "".

When you're finished, you can reboot your computer, or alternatively, run the "wireless" script from the command line by navigating to the root directory and typing:


After this is done, you should be able to connect to your SBC over the ad-hoc network.

Personal tools