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(){
  // 
}

What the Hack! Hardware hackathon discussion with Jeremy Foster

Thanks so much to Jeremy Foster from Microsoft for spending an hour with Intel to discuss the topic of hardware hackathons. We had a great exchange of ideas about the future of Internet of Things and the importance of DX for hardware and software developers!

How to install Mono on Intel Edison

This is the fastest way to get Mono onto your Intel Edison. I saw some other solutions that involve compiling Mono yourself which takes hours, do this instead to install an existing precompiled image using opkg.

This process works specifically for the Week 18 build (Yocto 2.1).

Step 1: Flash your Edison with the latest image and get it online

Step 2: Configure your Edison with the extended OPKG binaries

First, open a terminal to your Edison and run vi like this:

vi /etc/opkg/base-feeds.conf

Now insert these lines:

 src/gz all http://repo.opkg.net/edison/repo/all
src/gz edison http://repo.opkg.net/edison/repo/edison
src/gz core2-32 http://repo.opkg.net/edison/repo/core2-32

Now save and quit and run update:

opkg update
opkg upgrade

Step 3: Install Mono

opkg install mono

Microcontrollers for Web Developers

This is the talk I am planning on presenting this coming Wednesday at Future Insights, Las Vegas. I haven’t decided how much to add or remove from this deck in particular yet as it is the first test run of this thing. The focus is going to be on giving a basic overview of important concepts from the world of microcontrollers that may interest web developers who are interested in using their existing skills to work with hardware (something that is now possible due to intermediate layers such as Intel’s LibMRAA).

More likely than not I will be tweaking this thing constantly over the next week.

ACT-W Seattle: Advancing The Careers of Technical Women

Intel made several major announcements about it’s future intentions on the issues of diversity in STEM. When I learned that ACT-W (a technical conference which recently sold out in Portland being organized by ChickTech, Women Who Code and Geek Girls Carrots) was coming to Seattle I knew it was an event that Intel should sponsor! Working with our fantastic internal diversity team we were able to put together a presence. So glad we could be a part of this event, really sorry I was at Maker Faire and couldn’t attend in person.