Configuring a System

On this page I will summarise the steps needed to setup your Raspberry Pi for video streaming.  I’m going to be configuring the system with the Edimax EW-7612UAn V2 wifi stick.  This is a 2.4 GHz device and while we eventually want to use the 5 GHz band, for now this device has proven totally reliable on all versions of the Raspberry Pi.  I will also cover setting up a Linux PC to receive and display the stream.

To prevent things from getting confusing with lots of options across different platforms, I’m only going to cover the procedure I use.  This is based on using a Windows 7 PC for doing most of the installation and configuration.

I’m working on a download and script that will automate many of the following steps.  I will keep and update this page to show all the steps for those who want to know what has been done and to aid with debugging if in future a Raspbian update causes an issue.  The download and instructions for its use should be published in the next couple of weeks.

Setting Up the Pi

Download the necessary files

  1. Download and install Win32 Disk Imager on your PC from Sourceforge:
  2. Download and unzip the latest Raspbian Image from :
  3. Download and install the putty ssh client:
  4. Optionally you can download and install WinSCP.  It’s useful for transferring files between your PC and Pi.

Copy Raspbian to your SD Card.

  1. Insert your SD card into your computers card slot or use a USB card reader.  Take a note of the drive letter allocated to the card (E.g. E:).
  2. Launch Win32DiskImager and make sure the selected Device matches the SD card location ( [E:\] ).  Having the wrong letter here will corrupt that drive.
  3. Click the small blue folder icon and select the expanded Raspbian image.
  4. With everything set click the Write button.  You will get a last chance warning about overwriting the drive.  Click ‘Yes’ if you are happy to continue.
  5. Once the image has been written, a small ‘Done’ message box will pop-up.  Click the button and then Exit Win32DiskImager.
  6. Eject/Safely remove the SD card from your computer and insert into your Pi.

Raspbian Configuration and Update.

  1. Connect the camera to the Pi.
  2. Connect your Pi to a monitor and keyboard.
  3. Power it on.
  4. Once the boot sequence is completed you will be dropped straight into raspi-config.Raspi-config
  5. Hit ‘Enter’ on “Expand the Filesystem” to fill the SD card and the ‘Enter’ again to clear the “resize on next boot” notice.
  6. Use the down arrow key to select “Enable Camera” and hit ‘Enter’.  On the next screen use the right arrow to select ‘<Enable>’, then hit ‘Enter’ again.
  7. Enter “Advanced Options” and then “Hostname”.  Give your install an identifiable name.
  8. Ssh should already be enabled, but if you want to check, go back into “Advanced Options”, select “SSH” and then ‘<Enable>’.
  9. If you haven’t already connect the Pi to your LAN.
  10. Press the Tab key a couple of times to select ‘<Finish>’ and then press enter to exit raspi-config and reboot the Pi.
  11. When the boot sequence completes you will see the login prompt and above it the network address. In this case
  12. You can continue the configuration directly on the Pi, but I prefer to switch to ssh so that I can continue working on other stuff, while the Pi chugs away downloading and installing packages.  It also makes it easy to copy and paste commands and file contents without using the X desktop.
  13. Launch putty and enter the IP address.  I like to save the address as a session as I go along to save having to type the full IP address every time.  When you are ready to proceed, click ‘Open’ to launch a command window.putty
  14. At the prompt login as pi
  15. unless you changed it in raspi-config the password is raspberry
  16. The first task is to update the base system.  The number of packages that need updating will depend on how long it’s been since the base image was released.  First we need to update the package catalogue.
    sudo apt-get update
  17. Then we upgrade the currently installed packages.
    sudo apt-get upgrade
  18. Now is a good point to test the camera
    raspivid --demo
  19. While we are here, we may as well generate an ssh key pair.  We probably will never need the keys, but in doing so, we will create the ~/.ssh directory structure that will be needed later on.  Just hit enter for all the options offered.

Wifi Configuration

For this example had hoped to use the Tenda W522U 300Mbps Dual Band Wireless N USB Adapter, as its chipset is natively compatible by hostapd.  To my knowledge, it is currently the only dual band adapter that works “out of the box” on the Raspberry Pi.  The problem is that in 2.4GHz mode it is Slooooooowwwwww and it doesn’t have a high gain antenna, so range will be limited.  Having run some comparative tests there is no point in recommending it, even in 5GHz mode.

Because of the problems with the W522U, I’m sticking with the 2.4 GHz band Edimax EW-7612UAn V2 has proven very reliable over the last year.

I default to using vi for editing configuration files.  If you prefer a different editor like nano then replace vi with nano in the commands below.

  1. If it’s not already connected, plug in your USB WiFi  adapter and reboot with:
    sudo reboot
  2. As a time saver you may want to create some aliases for shutdown and reboot.  These are set in the .bash_aliases file.
    vi .bash_aliases

    Paste in the following

    alias shutdown='sudo shutdown -hHP now'
    alias reboot='sudo reboot'

    From the next time you login you will be able to type ‘reboot’ instead of ‘sudo reboot’ and ‘shutdown’ instead of ‘sudo shutdown -hHP now’

  3. We are aiming to use this system for FPV where most radio control systems work on the 2.4 GHz band which is also the main band used for WiFi.  Ideally, we want to use the 5GHz band, especially now that Raspberry Pi compatible dual band USB Wifi dongles are starting to become available. The problem is that the 5GHz band is more regulated, so we need to install the Central Regulatory Domain Agent (CRDA) package that controls which frequencies and features are available to your country.  Hostapd does not work with the world domain (00).  You have to be specific.  To get the necessary package use:
    sudo apt-get install iw crda
  4. Then to set the CRDA region edit the file /etc/default/crda
    sudo vi /etc/default/crda
  5. Append your domain to the line “REGDOMAIN=”, which in my case is GB
  6. Next we can set the IP address for the WiFi adapter in the /etc/network/interfaces file
    sudo vi /etc/network/interfaces
  7. Edit the file to look like this:
    iface default inet dhcp
    iface lo inet loopback
    auto eth0
    allow-hotplug eth0
    iface eth0 inet dhcp
    auto wlan0
    iface wlan0 inet static

    Some people like to include “allow-hotplug wlan0”, however I found in the previous build of Raspbian that this caused some issues with ifplugd dropping the IP address when hostapd started.

  8. With the file saved, reboot.
    sudo reboot
  9. Login again and check that wlan0 has an IP address using:
    ip addr list
  10. The next task is to setup the Pi as a WiFi access point, so we need to install hostpad.  As a convenience we will also install dnsmasq to hand out IP addresses to client computers.  Once everything is working as expected we give the receiving computer a fixed IP address to reduce the connect and reconnect times.  I’ve also added haveged to the install.  This helps provide a pool of good entropy to hostapd for WPA encryption.  You can manage without it, but may see lots of warnings about /dev/random having insufficient entropy.
     sudo apt-get install hostapd dnsmasq haveged
  11. The Edimax EW-7612UAn V2 wifi stick uses a Realtek chipset which does not provide a standard nl80211 interface so can’t be used with the default hostapd installation.  We install it anyway to get all the startup/shutdown scripts.  Realtek provide a custom version of hostapd on their website as source code.  This has to downloaded, extracted, compiled and installed.  The download can be found on the realtek website at
    Pick the download location to nearest to you and download the file to your PC.
  12. The download is a zip file with a long name like:  If the filenames have changed for newer versions then adjust the commands below to suit.
  13. Open the zip file and work your way through the directory structure until you get into the wpa_supplicant_hostapd directory.
  14. Extract the wpa_supplicant_hostapd-0.8_rtw_r7475.20130812.tar.gz file to your downloads directory and then use WinSCP to copy it onto the Pi.
  15. On the Pi extract the contents of the file with the command
    tar zxvf wpa_supplicant_hostapd-0.8_rtw_r7475.20130812.tar.gz
  16. Step down into the new directory and then to the hostapd directory.
    cd wpa_supplicant_hostapd-0.8_rtw_r7475.20130812\hostapd\
  17. Type make

    Then go and make a drink while hostapd is compiled.

  18. When compilation is finished, we need to replace the default hostapd executables with the Realtek ones.
    sudo mv /usr/sbin/hostapd /usr/sbin/hostapd_nl80211
    sudo mv /usr/sbin/hostapd_cli /usr/sbin/hostapd_cli_nl80211
    sudo cp hostapd /usr/sbin/hostapd
    sudo cp hostapd_cli /usr/sbin/hostapd_cli
  19. To configure hostapd we need to create/edit its config file.
    sudo vi /etc/hostapd/hostapd.conf
  20. The configuration below covers a basic 2.4GHz setup using the Edimax EW-7612UAn V2 stick.  Make sure there are no spaces on the ends of lines or you will get an error when you try to run hostapd.
  21. To have hostapd start at boot we need to edit the file /etc/default/hostapd.
    sudo vi /etc/default/hostapd
  22. Uncomment the DAEMON_CONF line and add the path to the hostapd config file.  You can add the debug message option if you want.
  23. With the previous release of Raspbian, I couldn’t get a reliable WiFi connection from hostapd.  After days of searching I found the solution at  The ifplugd config file has been changed to make all the network interfaces hot-plugable.  This was causing the interface to be dropped when hostapd tried to start. To fix it we need to edit the file /etc/default/ifplugd.
    sudo vi /etc/default/ifplugd
  24. Change the INTERFACES and HOTPLUG_INTERFACES to “eth0”
    ARGS="-q -f -u0 -d10 -w -I"
  25. Test the access point.  This will make the access point visible to your PC (assuming it has WiFi) or you can use an phone app like WiFi analyzer.   Use Control-C to exit.
     sudo hostapd -d /etc/hostapd/hostapd.conf
  26. At this point you may wish to reboot again to check hostapd comes up at boot time and that wlan0 is still being given an IP address.
  27. With hostapd working the final network package to configure is dnsmasq.  Create a custom config file:
    sudo vi /etc/dnsmasq.d/dnsmasq.custom.conf
  28. Paste in the following
    # Gateway
    # DNS
  29. One final reboot to check all is working.
    sudo reboot
  30. Now you should be able to connect to the access point from your computer or phone.  Windows will show a warning triangle as it cannot connect to the internet through this connection, but putty should be able to connect to

Gstreamer and GPS installation.

  1. Almost there.  We need a lot of packages for gstreamer, but we can get them with a single target.
    sudo apt-get install gstreamer1.0
  2. If you want to log your position using a GPS then install these packages as well.
    sudo apt-get install gpsd gpsd-clients

Get the scripts

  1. You can download a tarball of the scripts from Google Drive.  The command below will download and extract the files in one shot.
    wget -O - | tar zxvf -

    Alternatively you can download the file to your PC, copy it across using WinSCP and then expand it using:

    tar zxvf AirSideScripts.tgz

Setting up the Receiving Computer.

For my system I use my Dell XPS 17 laptop, simply because it’s what I’ve got.  Although it is Windows 7 based, I have repartitioned the disk so that I could create and dual boot a Lubuntu installation.  I choose this as a lighter weight version, which should hopefully allow gstreamer to run faster, although I have no evidence to suggest it does.  I’m using version 13 because my WiFi card didn’t work very well in 14.  I’m not going to cover installing Lubuntu; there is plenty of information on the Web if you need help.

  1. The first task is to establish the WiFi connection to the Pi.  If you have used my hostapd.conf file then look for an access point Pi_AP and use Raspberry for the WPA key.
  2. Open a Terminal window.
  3. We need to create a key pair for ssh so that we don’t need to enter a password every time we connect.

    Just hit enter for all the options offered to you.  We don’t want a password as this would negate the whole point of creating the keys for this application.

  4. Next we copy the public key to the Pi.  The ~/.ssh directory should already exist from step 29 above.
    scp ~/.ssh/ pi@

    This should be the last time you will need to enter a password.

  5. Open a new terminal window and try to connect to the Pi.  If the previous step was successful you should be able to connect without entering a password.
    ssh pi@
  6. That’s configuration complete

Start Streaming

  1. For details on using the installed scripts have a look at the “Script Usage” Section on the “Current Raspberry Pi Scripts Page”.

2 responses to “Configuring a System

  1. great tutorial! may i suggest using “kitty” instead of “putty”.. it is a lot easier to setup a username:password of your choice to login. it would save a lot of these steps. and also configure samba to transfer files.. easier as well because you can acces as a network drive from windows explorer and just drag files.

  2. Thanks Bruno. I’ll have a look at kitty. With the installation script I’m working on there is no longer a need to transfer from PC to Pi, so WinSCP is no longer needed. I’ll have a look at incorporating Samba though for getting videos off the Pi.

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 )

Google photo

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

Connecting to %s