Using hostapd on Ubuntu to create a wifi access point

I’ve been working on an autonomous hexacopter, which has a Pandaboard ES running Ubuntu on it, and I wanted it to setup its own wifi network in the field for easy ssh access. Turns out this is pretty simple to do, but you need to configure several different daemons to get it working right.

1. Check your wifi card

You’ll need a wifi card that supports master mode, if you’re going to create an access point with it. First, figure out what your wifi card is named (look for one starting with ‘wlan’)


Next, check if “AP” mode is supported

iw list

and look for something like:

Supported interface modes:
         * IBSS
         * managed
         * AP

On some drivers you can also check for master mode with iwconfig:

sudo iwconfig  mode master

2. Setup hostapd

Assuming your wifi card supports master mode, the next step is to setup hostapd

sudo apt-get install hostapd

Now create the file /etc/hostapd/hostapd.conf with the follow content: (if you want to use 5Ghz instead of 2.4Ghz, use hw_mode=a and channel=149 instead)


Finally, edit /etc/default/hostapd to have the line:


3. Setup dnsmasq

Now, it’s time to setup dnsmasq to handle DHCP and DNS on our wifi network, otherwise your clients won’t be able to get an IP address.

sudo apt-get install dnsmasq

Next, edit the dnsmasq configuration file to include this:


We set ‘no-hosts’ to avoid including all the entries in your hosts file in the DNS server, and instead set a separate file that will configure the DNS mapping for the machine hosting the AP. Make sure to create the file /etc/hosts.dnsmasq with the name of your computer: my_hostname

4. Modify /etc/network/interfaces

Add these lines to your /etc/network/interfaces file, to give it a static IP address:

auto wlan0
iface wlan0 inet static

5. Troubleshooting

If you have network-manager configured to use your wifi card, you should disable auto-connect for all the wireless connections. Otherwise, it may interfere with hostapd. If some frequencies are disabled, make sure your driver is set to use the right regulatory domain. You can see the current one with:

iw reg get

If it says “country 00”, you need to set it manually, in /etc/default/crda. To set it manually you need (at least for some cards) to have cfg80211 and mac80211 installed as kernel modules. You can check if they’re installed as modules by using

zcat /proc/config.gz

Look for CONFIG_CFG80211=m, if it says “=y” then it’s compiled into the kernel, and you’ll need to re-install your kernel. If you’re using an Atheros card, you may also need to set the region in the driver. Do this by adding “cfg80211 ieee80211_regdom=US” to /etc/modules

Programming for the Orangutan SVP-1284 on Ubuntu

I just got my Orangutan SVP-1284, which uses the Atmega1284 processor.

Getting your dev environment setup on Ubuntu is pretty easy:

1) Download the prerequisites you need (
sudo apt-get install avr-libc gcc-avr avra binutils-avr avrdude

2) Download the latest Pololu library from:

3) Extract the library, and install it. From the extracted directory run:
sudo cp *.a /usr/lib/avr/lib/ && sudo cp -r pololu /usr/lib/avr/include/

4) As of version 5.10 of AVRDUDE, the default config file will not work. Edit /etc/avrdude.conf and under the ATmega1284P section change chip_erase_delay to 55000, if you have the SVP324 then change the ATmega324PA section instead.

5) Test that everything is working. The green LED should be on, to indicate that the ISP is working, and the blue LED should be on to indicate that the AVR is receiving power. (The AVR will not receive power from the USB connection, so make sure that you provide power on GND and VIN.) Also if you run:
You should see that three new devices have been detected on ttyACM0, ttyACM1, and ttyACM2. If your computer lists different ports you will need to edit the PORT section of the Makefile in step 6.

6) Check that you can program your microcontroller. From the Pololu library that you extracted, look in examples/atmega1284p/simple-test, then run:
make && make program


7) Note: If you decide to program in C++, make sure you set the CXX variable to ‘avr-g++’ in your Makefile, and set CXXFLAGS to CFLAGS

Robot v0.1

Well, I’ve moved on from LEDs, and built a little robot. It’s powered by a 16MHz Atmel chip, and currently you have to hard code instructions into it, but I’m hoping to add wireless control soon.

Robot v0.1 Video