A mobile electronic survey unit – A.K.A. A Cunning Use for Netbooks

Hi, it’s been a while since I’ve posted anything here, mainly because I’ve been incredibly busy with Uni and work and haven’t had time for hacking on anything interesting at home. However, I’m going to tell you about a really interesting and quite novel use for netbooks that I’ve been setting up at work, hopefully someone else will find it useful and use it in a similar way…

A while ago my boss came to me with an idea. He wanted to purchase a number of netbooks and install LimeSurvey on each of them to be used as a mobile survey unit, that could be taken to schools, colleges, workplaces, etc. and used to collect data for research projects. I pointed out that if we were to install LimeSurvey on all the netbooks each would need an individual webserver and MySQL server, which apart from being a lot of effort would fragment the dataset and make it much more difficult to collect the data together.

Hence, I suggested that we setup one of the machines as the server and set it’s built-in Wifi to work as an access point for the others so they could access the server. This means that no external network access is required, you carry the server with you!

Well, today the netbooks arrived (we ended up with Acer Aspire Ones in the end). So I set about configuring one to be our server. This model came with Windows XP pre-installed (not sure if you can get a Linux version), but also had a 160GB hard drive. My instinct was to install Ubuntu Server as it has an option to deploy a LAMP server out of the box (which is awesome and would have saved me loads of time). So I downloaded it from our local mirror and flashed the iso to my usbstick with Unetbootin, which I hadn’t used before. I booted from the usbstick and everything went well until I got to the ‘detect CDROM drives’ bit – which usually detects the usbstick as containing the files from the iso. Not so here, no matter what I tried it wouldn’t be convinced that the usbstick was a CDROM!

So, I fell back to what I have previously used, Isotostick, a nice little shell script thats always done this well for me. Same problem.

Turns out the problem is with the server and alternate isos of Ubuntu, which don’t contain the correct FAT driver for loading the installation packages from a usbstick. There is a workaround for this, here, but I couldn’t get it to work. So, I decided to use the Ubuntu Desktop version (thank God our mirror is internal to the university!). I realised later that this had the advantage that the server could also be used as a client and the server software would be invisible to the user.

So I installed that. Which went fine as you’d expect. When I rebooted after the install I found that the wifi didn’t work. A quick google turned up a page which gave instructions on how to install the latest madwifi driver from source, which I did, though I had to manually dig up build-essential (and dependancies) from the /pool folder on my usbstick and install them with dpkg as I couldn’t get it to recognise the usbstick as an apt repository. I wouldn’t have had this problem if I’d have had a wired connection on the machine though.

Then I set about installing the packages required to turn it into a server:

$ sudo apt-get install apache2 phpmyadmin mysql-server dhcp3-server bridge-utils

I’m not sure whether the bridge-utils package is strictly required, but I installed it anyway. It doesn’t do any harm as it’s only a few kB to download. If you are following this as a howto and are only using the Wifi as your net connection (as I was), make sure you install all of this now as later on you’ll lose your connection when we setup the Wifi to be an access point. If you’re on ethernet, you’ll be able to keep your connection (but see later).

Installing those packages took a while over the Wifi, so while it was going on I downloaded and installed LimeSurvey. I don’t really need to say how to do that as it’s all documented on their site. I unpacked it to /var/www/survey on the server and configured it as per the instructions. Once I had all the packages above installed I was able to create a database and user through phpmyadmin and run the LimeSurvey installation script. Pretty much the same as installing any other PHP app.

Next came the wifi setup, I played around for a while trying to get this working, but I think the following is probably the best course to take in setting this up. You need to start by putting the wireless adapter into access point/master mode, you do this (for the atheros card used in the Aspire One) by editing/creating the /etc/modprobe.d/madwifi file (documented here):

$ sudo nano /etc/modprobe.d/madwifi

The file contents should be:

options ath_pci autocreate=ap

Then reload the kernel module:

$ sudo modprobe ath_pci

You’re then ready to reconfigure the network interfaces, if you type iwconfig, you should see that the ath0 device now has the capability to act as an access point. To setup the access point you need to edit the network interfaces file:

$ sudo nano /etc/network/interfaces

The contents of my file were as follows:

auto lo

iface lo inet loopback

# uncomment the following two lines if you’re on ethernet and you want to still have a connection once you restart the networking!

#auto eth0

#iface eth0 inet dhcp

auto ath0

iface ath0 inet static

wireless-mode master

wireless-essid my-access-point

address 192.168.1.1

network 192.168.1.0

netmask 255.255.255.0

broadcast 192.168.1.255

This sets up the network interface acting as an access point with name ‘my-access-point’ and assigns the local machine a static address of 192.168.1.1 on the network. To reload the configuration, do this:

$ sudo /etc/init.d/networking restart

Note: at this point you will lose ‘outgoing’ wifi connectivity as your adapter is now acting as an access point!

Now, if you boot up another machine with Wifi, you should be able to see the ‘my-access-point’ network in the list of available networks. However, connecting to it won’t currently work as you won’t be able to get an IP address, this is where the DHCP server, which we installed earlier, comes in.

In order to set this up we first need to tell it to listen for DHCP requests on the correct interface, in our case ath0. We do this by editing the /etc/default/dhcp3-server file to look like this:

# Defaults for dhcp initscript

# sourced by /etc/init.d/dhcp

# installed at /etc/default/dhcp3-server by the maintainer scripts

#

# This is a POSIX shell fragment

#

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?

# Separate multiple interfaces with spaces, e.g. “eth0 eth1”.

INTERFACES=”ath0″

Next we setup the DHCP server to dish out addresses to the clients on out network, edit the file /etc/dhcp3/dhcpd.conf to have an entry like the following:

subnet 192.168.1.0 netmask 255.255.255.0 {

range 192.168.1.100 192.168.1.200;

option domain-name-servers 192.168.1.1;

option domain-name “mynetwork.local”;

option routers 192.168.1.1;

option broadcast-address 192.168.1.255;

default-lease-time 600;

max-lease-time 7200;

}

I don’t know whether all those options are definitely needed, but this configuration works. I think you could probably get away without the routers and name servers, as these won’t exist on this small standalone network.

OK, now start up the DHCP server and you should be in business:

$ sudo /etc/init.d/dhcp3 start

Assuming that works OK, try connecting to the ‘my-access-point’ network from another machine, it should work (if it doesn’t or you can’t see the network, try rebooting the server machine).

Once you’ve successfully connected you should be able to browse pages hosted on the server at http://192.168.1.1, so my LimeSurvey install would be at http://192.168.1.1/survey. Now you have a portable server that you can take round to serve web apps to machines in the vicinity! Awesome!

That just covers the server part of what I have planned for these small netbooks, my ultimate aim is to set them all up running Ubuntu with a lightweight desktop and Firefox started automatically in Kiosk mode (thanks to the R-Kiosk addon). This will give us ten little survey machines which will just ‘boot’ into Firefox and go to the LimeSurvey page. I’ll post details of that setup once I’ve done it, but for now that’s all! Bye!

2 responses to “A mobile electronic survey unit – A.K.A. A Cunning Use for Netbooks”

  1. AndrewBoldman Avatar
    AndrewBoldman

    Hi, cool post. I have been wondering about this topic,so thanks for writing.

  2. Spenser Avatar
    Spenser

    Rob,
    Very interested in this particular post topic and would like to chat outside this forum. Please contact me on email if possible. Spenser

Leave a Reply

Your email address will not be published. Required fields are marked *

Bad Behavior has blocked 788 access attempts in the last 7 days.