Goodbye IDF 2015

IDF this year was a massive amount of work but well worth the effort.

Intel IDF 2015 Setup

Spent the last two weeks building (in C++, Arduino, Node.js and Python) these lasercut Intel Edison slap boxes to show off how to build an IBM Bluemix MQTT game. Martin Kronberg did amazing work putting this all together and creating the designs. Finally we got it all setup and running here at IDF, a few highlights.

Intel Edison Slap Box game

Dancing spiders

Resin.io releases official Intel Edison support

Publish to IBM Bluemix via Mosquitto from Intel Edison

Here is how to publish to IBM Bluemix via ‘mosquitto_pub’ (comes already installed on Intel Edison).


$ mosquitto_pub -h 'your_org.messaging.internetofthings.ibmcloud.com' 
-i 'd:your_org:your_type:your_mac' -m '{"d":{"Volts":5}}' 
-t 'iot-2/evt/status/fmt/json' -q 1 -p 1883 
-u 'use-token-auth' -P 'YOUR_TOKEN_HERE'

These are the required inputs, replace the variable bits with your own authentication info:
-i client_id aka d:[YOUR_ORG]:[YOUR_TYPE]:[YOUR_MAC]
-h host [YOUR_ORG].messaging.internetofthings.ibmcloud.com
-t topic iot-2/evt/status/fmt/json
-q quality 1
-m value e.g. ‘{“d”:{“Volts”:5}}’
-p port 1883
-u username use-token-auth
-P password ‘YOUR_TOKEN’

Publish to IBM Bluemix from Arduino using Intel Edison

Here is how to publish data to IBM Bluemix from your Intel Edison or other Wi-Fi enabled Arduino device. Making this work first requires that you import and add the PubSub library for Arduino (generally by copying the .h and .cpp (and examples) folder into your Arduino Libraries folder and restarting your environment. This was written using this guide from IBM (there is more comprehensive source linked way down at the very bottom as a .ino file).

Get the file here on Gist.

Simple REST calls with Arduino over WiFi

Just ported RestClient for Arduino to use WiFi instead of Ethernet. I specifically did this to make it easier for developers to use Intel Edison’s WiFi while doing REST API calls.

I haven’t yet tested an integration but I believe aJSON or equivalent will be really useful for doing anything beyond very basic REST calls here. All I wanted was a way to make some basic REST calls with Edison over WiFi.

While I am short on time, if I get more time I might consider producing a version which support both WiFi and ethernet.

Installation

  • In a terminal, browse to the directory in your OS where your Arduino IDE keeps it’s libraries (probably “/Documents/Arduino/libraries”)
  • Run “git clone https://github.com/rexstjohn/arduino-restclient.git RestClient” to download the WiFi RestClient into your libraries
  • Restart your Arduino IDE
  • Use “File -> Examples -> RestClient -> simple_GET” to test it
/* RestClient simple GET request
 *
 * by Rex St John
 */

#include 
#include 
#include "RestClient.h"

char ssid[] = "YOUR_SSID";            //  your network SSID (name)
char pass[] = "YOUR_WIFI_PW";         // your network password
char host[] = "jsonplaceholder.typicode.com";      // target for your REST queries
int status = WL_IDLE_STATUS;         // the Wifi radio's status

// Create your WiFi RestClient, pass in the ssid and password.
RestClient client = RestClient(host, ssid, pass);

String response;
void setup() {

  // Initiate Serial Connection
  Serial.begin(9600);
  Serial.println("Starting REST client over Wi-Fi");
  if(client.connect() == WL_CONNECTED){
    response = "";
    int statusCode = client.get("/posts/1", &response);
    Serial.print("Status code from server: ");
    Serial.println(statusCode);
    Serial.print("Response body from server: ");
    Serial.println(response);
    delay(1000);
  }
}

void loop(){
  // 
}

LA Roadshow

Wonderful hackathon and workshops in Santa Monica, LA.

Connect Intel Edison to 802.11G or 802.11N Wireless

Thanks to Jeffery Tu for sharing the below solution to connecting Edison to 802.11G and 802.11N.

First, run:

configure_edison --wifi

Next, use the script from the PDF file: edison_wifi_331438001.pdf

Like this:


##
if [ $# != 2 ] ; then
echo "$0  "
exit
fi

wpa_cli -iwlan0 disconnect
wpa_cli -iwlan0 remove_network all
wpa_cli -iwlan0 add_network
wpa_cli -iwlan0 set_network 0 mode 0
wpa_cli -iwlan0 set_network 0 ssid \"$1\"
wpa_cli -iwlan0 set_network 0 aut h_alg OPEN
wpa_cli -iwlan0 set_network 0 key_mgmt WPA-PSK
wpa_cli -iwlan0 set_network 0 proto RSN
wpa_cli -iwlan0 set_network 0 psk \"$2\"
wpa_cli -iwlan0 set_network 0 scan_ssid 1
wpa_cli -iwlan0 select_network 0
wpa_cli -iwlan0 enable_network 0
wpa_cli -iwlan0 reassociate
wpa_cli -iwlan0 status