Connect to the Erle Copter and Network Configuration

From COINS Research Group
Jump to: navigation, search

Tutorial Overview

Title

Connect to the Erle Copter with Erle Brain 1.1

Author

Anis Koubaa

Note

This tutorial shows the different connection mode to Erle Copter with Erle Brain v1.1.

References

Connections Types and Steps

To connect to the Erle Brain of the copter, there are two options: (1) using WiFi, (2) using minUSB

Using WiFi

First, make sure that your laptop/phone/tablet/... has 5 GHz support. You should look for 802.11 ac support.
Connect to WiFi network, Erle-Brain creates a network called erle-< product >.
The password for the network is "holaerle". Afterwards, SSH into the board:

#Under Debian
ssh root@10.0.0.1
#Under Snappy Ubuntu Core
ssh ubuntu@10.0.0.1
#password: ubuntu

Through mini USB

Erle-Brain supports client mode USB. Using this connection mechanism and the Ethernet-over-USB kernel module you should be able to SSH into the board.

  • First check which interfaces you have in your computer, execute ifconfig.
  • Connect Erle-Brain using the mini USB connector:
  • Find the new network interface that should've been created in your OS, executing again ifconfig.
  • Assign the following IP address: 192.168.7.1. Assuming that your new interface is eth6:
sudo ifconfig eth6 192.168.7.1
  • Now that you are in the same subnet, just ssh into the board:
#Under Debian 
ssh root@192.168.7.2
#Under Snappy Ubuntu Core
#password: ubuntu
ssh ubuntu@192.168.7.2

the password is ubuntu

Changing Network Configurations

It is possible to change the network configuration of the Erle brain such that to allow Internet connection. This can be achieved in two ways (1) using Ethernet cable, (2) using WiFi.

Using Ethernet

  • Plug Ethernet wire to Erle-Brain using the RJ-45 connector:

Erleethernet.jpg

  • Now we need to stand ethernet interface up, once you're connected to Erle-Brain, type:
$ sudo ifconfig eth0 up
$ sudo dhclient eth0
#Check if Erle BRain has Internet access
$ ping www.google.es
# press |ctrl| |c| to exit

Using WiFi

I followed the steps in Internet through WiFi.
First, I connect to the Erle copter using Mini-USB. This is needed as AdHoc WiFi network of the drone will be lost once you make it connected to the WiFi router.
Once connected, you need to generate the passkey for your infrastructure network. In my case, I used a WiF router that I configured to have an SSID equal to dronemap and a password my_password. To generate the passkey execute the command:

wpa_passphrase "dronemap" my_password

then it generates a text as follows:

network={
       ssid="dronemap"
       #psk="my_password"
       psk=35091c6ae9cb90305aa8bbf795c05691512544e1c628ebac15094ctree2428eee
}

Then, I had to add this text into the file /etc/wpa_supplicant/wpa_supplicant.conf. To do so, use either vi or, you can import the file using FileZilla into your PC, make the changes using NotePad++ or Sublime Editor, then, copy it back into home directory, and finally copy it back and replace /etc/wpa_supplicant/wpa_supplicant.conf.
Finally, You need to execute

sudo /home/ubuntu/wifi/wifi-connect.sh

or you execute the command:

wpa_supplicant -B -i interface -c /etc/wpa_supplicant/example.conf

After a few seconds, you are connected to your WiFi router.
You can test the connection to Internet using a ping.

Connect to a Wireless Infrastructure WiFi Router

How to connect your Drone to a WiFi router: my steps

I followed the steps in Internet through WiFi.
First, I connect to the Erle copter using Mini-USB. This is needed as AdHoc WiFi network of the drone will be lost once you make it connected to the WiFi router.
Once connected, you need to generate the passkey for your infrastructure network. In my case, I used a WiF router that I configured to have an SSID equal to dronemap and a password my_password. To generate the passkey execute the command:

wpa_passphrase "dronemap" my_password

then it generates a text as follows:

network={
       ssid="dronemap"
       #psk="my_password"
       psk=35091c6ae9cb90305aa8bbf795c05691512544e1c628ebac15094ctree2428eee
}

Manual connection

Then, I had to add this text

network={
      ssid="dronemap"
      #psk="my_password"
      psk=35091c6ae9cb90305aa8bbf795c05691512544e1c628ebac15094ctree2428eee
}

into the file /etc/wpa_supplicant/wpa_supplicant.conf. To do so, use either vi or, you can import the file using FileZilla into your PC, make the changes using NotePad++ or Sublime Editor, then, copy it back into home directory, and finally copy it back and replace /etc/wpa_supplicant/wpa_supplicant.conf.
Finally, You need to execute sudo /home/ubuntu/wifi/wifi-connect.sh.
After a few seconds, you are connected to your WiFi router.
You can test the connection to Internet using a ping.

automatic connection

Connect to your Erle Brain as mentioned above. For auto connection, First, create the configuration file /etc/wpa_supplicant/wpa_supplicant.confcontains the following instruction

network={
     ssid="dronemap"
     #psk="my_password"
     psk=35091c6ae9cb90305aa8bbf795c05691512544e1c628ebac15094ctree2428eee
}

NOTE: make sure that ssid and psk correspond to the parameters of your WiFi router and generated by the instruction

wpa_passphrase "your_ssid" my_password

Then, it is needed to modify the file as follow

auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet static
address 192.168.8.101
network 192.168.8.0
gateway 192.168.8.1
netmask 255.255.255.0
broadcast 192.168.8.255
wpa-essid dronemap
wpa-psk 557788c6ae9cb9030daa8bbf795c08691b1ertyu1c628ebac17094u8u7u4428e1
wireless-mode managed


the last line represent the passkey that is generated with the command above.

wpa_passphrase "dronemap" my_password

Note that the WiFi router has an IP address 192.168.8.1
In addition, you need to go to /etc/hostapd/hostapd.conf and disable the wireless hotspot.
In /etc/hostapd/ I renamed hostapd.conf to disable it.
I put an executable file that I called wifi.sh in folder /etc/init.d and it contains the instruction

wpa_supplicant -B -i interface -c /etc/wpa_supplicant/wpa_supplicant.conf

replace interface with the name of the wireless interface wlan0 or wlan1 depending on your configuration.


Remember that the file /etc/wpa_supplicant/wpa_supplicant.confcontains the following instruction

network={
     ssid="dronemap"
     #psk="my_password"
     psk=35091c6ae9cb90305aa8bbf795c05691512544e1c628ebac15094ctree2428eee
}

Erle Tutorial

Reference: GETTING WIFI IN SNAPPY UBUNTU CORE WITH ERLE-BRAIN This blog post explains how to connect to the Internet wirelessly using Erle-Brain running Snappy Ubuntu Core. In order to do so (WiFi mode infrastructure) we’ll use wpa_supplicant. You’ll need the following armhf packages:

  • libpcsclite1_1.8.11-3ubuntu1_armhf.deb
  • libreadline5_5.2+dfsg-2_armhf.deb
  • wpasupplicant_0.7.3-6ubuntu2.3_armhf.deb

You can easily install these deb packages by typing:

dpkg -i <package-name>

Once the packages are installed, you’ll notice that wpa_supplicant is in the path. Let’s make a script that helps automating the process of connecting to a network. Check the name of your wireless interface:

(ErleRobotics)root@localhost:/home/ubuntu# ifconfig
lo        Link encap:Local Loopback  
         inet addr:127.0.0.1  Mask:255.0.0.0
         inet6 addr: ::1/128 Scope:Host
         UP LOOPBACK RUNNING  MTU:65536  Metric:1
         RX packets:187347 errors:0 dropped:0 overruns:0 frame:0
         TX packets:187347 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:0 
         RX bytes:14804850 (14.8 MB)  TX bytes:14804850 (14.8 MB)
 
usb0      Link encap:Ethernet  HWaddr 06:59:8e:d4:75:da  
         inet addr:192.168.7.2  Bcast:192.168.7.255  Mask:255.255.255.0
         inet6 addr: fe80::459:8eff:fed4:75da/64 Scope:Link
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:93258 errors:0 dropped:0 overruns:0 frame:0
         TX packets:92164 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000 
         RX bytes:5366538 (5.3 MB)  TX bytes:7672724 (7.6 MB)

wlan0     Link encap:Ethernet  HWaddr 80:1f:02:f9:1f:75  
         inet addr:10.0.0.1  Bcast:10.0.0.255  Mask:255.255.255.0
         inet6 addr: fe80::821f:2ff:fef9:1f75/64 Scope:Link
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:1243 errors:0 dropped:317 overruns:0 frame:0
         TX packets:1235 errors:0 dropped:32 overruns:0 carrier:0
         collisions:0 txqueuelen:1000 
         RX bytes:417444 (417.4 KB)  TX bytes:818244 (818.2 KB)

We’ll be using wlan0. Create the following script named wifi.sh:

wpa_supplicant -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf & dhclient wlan0

Make sure that you configure your wpa_supplicant.conf appropriately. Here’s a guideline but it’ll depend on your router configuration:

ctrl_interface=/var/run/wpa_supplicant
# Unsecure Network
network={
   ssid=""
   key_mgmt=NONE
   priority=
}
# WEP Network
network={
   ssid=""
   key_mgmt=NONE
   wep_key0=""
   priority=
}
# WPA Network
network={
   ssid=""
   psk=""
   priority=
}

Once the interface has been properly configured just launch wifi.sh:

(ErleRobotics)root@localhost:/home/ubuntu# source wifi.sh
ioctl[SIOCSIWAP]: Operation not permitted
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument 
Trying to associate with 00:13:13:00:3a:01 (SSID='erle-net' freq=2432 MHz)
Association request to the driver failed
Associated with 00:13:13:00:3a:01
CTRL-EVENT-CONNECTED - Connection to 00:13:13:00:3a:01 completed (auth) [id=0 id_str=]

That should do it:

(ErleRobotics)root@localhost:/home/ubuntu# ping google.com
PING google.com (173.194.32.225) 56(84) bytes of data.
64 bytes from ber01s09-in-f1.1e100.net (173.194.32.225): icmp_seq=1 ttl=51 time=121 ms
64 bytes from ber01s09-in-f1.1e100.net (173.194.32.225): icmp_seq=2 ttl=51 time=46.1 ms
64 bytes from ber01s09-in-f1.1e100.net (173.194.32.225): icmp_seq=3 ttl=51 time=39.2 ms
^C
--- google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms

Video Tutorial