Intel Galileo 2 with USB WiFi Dongle (RT3070)

The WiFi dongle I am using here is Edimax EW-7711UMn

Here I will talk about how to use it on Intel Galileo 2

prerequisite

Install Linux on Intel Galileo 2

Establish communication through terminal

Step 1.

This USB Wifi dongle is supported by Intel Galileo 2, so we don’t need to install driver.

Just plugin it on the board.

$ iwconfig

Find the dongle identifier as “wlp0s20f3u1”

螢幕快照 2015-10-11 21.00.31

The example here is based on WPA WiFi Router

killall wpa_supplicant
ifconfig wlp0s20f3u1 up
wpa_passphrase "YOUR ESSID" "YOUR PASSWORD" > /tmp/wpa.conf 
wpa_supplicant -BDwext -i YOURWIFIIDENTIFIER -c/tmp/wpa.conf

Then you will see “Successfully initialized wpa_supplicant”

If it appears “ifconfig: SIOCSIFFLAGS: Operation not possible due to RF-kill”, when you are entering “ifconfig wlp0s20f3u1 up”.

rfkill unblock all

You can scan to search nearby SSID

iwlist YOURWIFIIDENTIFIER scan

Make a file “udhcpc.sh” in /etc as below code

#!/bin/sh
# udhcpc script edited by Tim Riker <Tim@Rikers.org>
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1

RESOLV_CONF="/etc/resolv.conf"
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
[ -n "$subnet" ] && NETMASK="netmask $subnet"

case "$1" in
  deconfig)
    /sbin/ifconfig $interface 0.0.0.0
    ;;

  renew|bound)
    /sbin/ifconfig $interface $ip $BROADCAST $NETMASK

    if [ -n "$router" ] ; then
      echo "deleting routers"
      while route del default gw 0.0.0.0 dev $interface ; do
        :
      done

      for i in $router ; do
        route add default gw $i dev $interface
      done
    fi

   echo -n > $RESOLV_CONF
    [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
    for i in $dns ; do
     echo adding dns $i
      echo nameserver $i >> $RESOLV_CONF
    done
    ;;
esac
exit 0

Then run

udhcpc -i YOURWIFIIDENTIFIER -p /var/run/udhcpc.pid -S -s /etc/udhcpc.sh

You will see like this

螢幕快照 2015-10-11 21.15.59

It works now!!

Advertisements

Intel Galileo 2 Linux installation

This tutorial is about how to running Linux on Intel Galileo 2 without FTDI to USB Converter.

In the end, we will be able to develop APP on Intel XDK

Instead of FTDI converter, we use wired connection to a DHCP enabled router.

Requirements:

  • Intel Galileo 2
  • micro USB to USB converter
  • micro SD card (above 2 GB)
  • RJ45 ethernet cable

Step 1.

prepare micro SD card

download the latest image file from http://iotdk.intel.com/images/iot-devkit-latest-mmcblkp0.direct.bz2 and extract it

format your memory card as MS-DOT (FAT) format

using shell command to unmount the card

diskutil unmountDisk disk3s

replace “disk3s” from your own disk Identifier which you can find in Disk Utility.app

using shell command to install the image file

sudo dd bs=8m if=iot-devkit-version-mmcblkp0.direct of=/dev/disk3s

replace “disk3s” as before

This may take serval minutes.

Step 2.

insert the micro SD on Galileo 2

connect the ethernet cable and the usb cable to your DHCP router and your computer respectively.

power it up.

Open Arduino APP on your computer
using the below code to detect your network status


 void setup() {
 Serial.begin(9600);
 //It’ll not continue until you send an ‘a’ through the serial monitor
 while(Serial.read()!='a'){
 Serial.println("hello");
 delay(1000);
 }
 //Display ifconfig result to serial monitor
 system("ifconfig > /dev/ttyGS0");
 }
 void loop() {
 }
 

Upload it, and open Serial Monitor in Arduino APP.

send a string “a”

螢幕快照 2015-10-11 13.38.28

You can find your IP Address as 192.168.0.118

Step 3.

use the below shell script in Terminal

 ssh root@192.168.0.118 

It will ask you “Are you sure you want to continue connecting (yes/no)? yes”
Then you can use this script to check your IoT develop kit version

  cat /etc/version 

Step 4.

Install Intel XDK on your computer

create a template using OnBoardLED

螢幕快照 2015-10-11 13.49.31

At the drop down list – select a device.

add manual connection

Address as the IP address you got

and the user name is root

Press the button Install/Build (The second button near the drop down list)

and press the button run (The fourth button from left)

You will be able to see the LED on board blinking