{"id":19148,"date":"2016-04-12T18:38:03","date_gmt":"2016-04-12T15:38:03","guid":{"rendered":"https:\/\/www.altoros.com\/blog\/?p=19148"},"modified":"2019-06-20T03:44:31","modified_gmt":"2019-06-20T00:44:31","slug":"iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot","status":"publish","type":"post","link":"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/","title":{"rendered":"IoT Platform on Bluemix: Experimenting with IBM Watson and Gobot"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/ibm-bluemix-internet-of-things-platform-catalog.png\" alt=\"ibm-bluemix-internet-of-things-platform-catalog\" width=\"100\" style=\"margin: 0px 0px 20px 15px;\" class=\"alignright size-full wp-image-19252\" \/><\/p>\n<p>The demo app described in this post consists of two main components:<\/p>\n<ul>\n<li>A \u201csensor\u201d that collects various information about a MacBook laptop: CPU temperature, fan speed, and laptop position using the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Sudden_Motion_Sensor\" target=\"_blank\" rel=\"noopener noreferrer\">Sudden Motion Sensor<\/a><\/li>\n<li>A web application that visualizes data from the sensor and allows you to set fan speed and display brightness<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_79_2 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/#Prerequisites\" >Prerequisites<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/#Preparing_Internet_of_Things_Platform\" >Preparing Internet of Things Platform<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/#Connecting_a_device_to_the_IoT_platform\" >Connecting a device to the IoT platform<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/#Publishing_device_events\" >Publishing device events<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/#Subscribing_to_commands\" >Subscribing to commands<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/#Connecting_an_application_to_the_IoT_platform\" >Connecting an application to the IoT platform<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/#Subscribing_to_device_events\" >Subscribing to device events<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/#Publishing_device_commands\" >Publishing device commands<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/#Related_reading\" >Related reading<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Prerequisites\"><\/span>Prerequisites<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p> To follow the instructions, you need:<\/p>\n<ul>\n<li>A Bluemix account<\/li>\n<li>The Cloud Foundry CLI<\/li>\n<\/ul>\n<p>The source code for the demo is available <a href=\"https:\/\/github.com\/Altoros\/gobot-starter\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Preparing_Internet_of_Things_Platform\"><\/span>Preparing Internet of Things Platform<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ol>\n<li>Clone my <a href=\"https:\/\/github.com\/Altoros\/gobot-starter\" target=\"_blank\" rel=\"noopener noreferrer\">repository<\/a>.<\/li>\n<li>Create a Go web application from the Bluemix dashboard.<\/li>\n<li>Create an instance of the Internet of Things Platform service:\n<ol type=\"a\">\n<li>Click <strong>Internet of Things Platform<\/strong> on the Bluemix dashboard.<\/li>\n<li>Click <strong>Launch dashboard<\/strong>.<\/li>\n<\/ol>\n<\/li>\n<p><center><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/ibm-bluemix-internet-of-things-dashboard.png\" alt=\"ibm-bluemix-internet-of-things-dashboard\" width=\"640\" class=\"aligncenter size-full wp-image-19251\" \/><\/center><\/p>\n<li>Create a new device on the IoT Platform dashboard.<\/li>\n<p><center><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/experimenting-with-ibm-watson-iot-platform-and-gobot-on-bluemix-add-device.gif\"><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/experimenting-with-ibm-watson-iot-platform-and-gobot-on-bluemix-add-device.gif\" alt=\"experimenting-with-ibm-watson-iot-platform-and-gobot-on-bluemix-add-device\" width=\"640\" class=\"aligncenter size-full wp-image-19250\" \/><\/a><\/center><\/p>\n<li>From the sensor directory, run the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">go build<\/code> command and then the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">sudo .\/sensor -id <em>id you provided when creating the device<\/em> -org <em>organization id<\/em> -api_token <em>authentication token<\/em><\/code> command. The Organization ID and Authentication Token are shown after your create a device.<\/li>\n<li>Go to the repository directory and run the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">cf push <em>application name<\/em><\/code> command. See step 2.<\/li>\n<li>Open the application in a browser and provide the device ID.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Connecting_a_device_to_the_IoT_platform\"><\/span>Connecting a device to the IoT platform<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Every registered organization has a unique endpoint that must be used when connecting <a href=\"https:\/\/cloud.ibm.com\/docs\/IoT\/index.htmldevices\/mqtt.html\" target=\"_blank\" rel=\"noopener noreferrer\">MQTT<\/a> clients for devices in that organization:<\/p>\n<pre style=\"padding-left: 30px;\"><code>org_id.messaging.internetofthings.ibmcloud.com<\/code><\/pre>\n<p>You can find your <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">org_id<\/code> on the IoT Platform dashboard.<\/p>\n<p><center><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/org_id-iot-platform.png\" alt=\"org_id-iot-platform\" width=\"238\" height=\"98\" class=\"aligncenter size-full wp-image-19253\" \/><\/center><\/p>\n<p>A device must authenticate using a client ID in the following format:<\/p>\n<pre style=\"padding-left: 30px;\"><code>D:org_id:device_type:device_id<\/code><\/pre>\n<p>where:<\/p>\n<ul>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">d<\/code> identifies your client as a device.<\/li>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">org_id<\/code> is your unique organization ID.<\/li>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">type_id<\/code> is the device type you specified when creating the device on the dashboard.<\/li>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">device_id<\/code> is the ID you specified when creating the device on the dashboard.<\/li>\n<\/ul>\n<p>The Watson IoT platform currently only supports token-based authentication for devices, so there is only one valid username for them\u2014<code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">use-token-auth<\/code>. Use the authentication token generated by the platform upon device creation as a password.<\/p>\n<p>Connecting your Gobot sensor to the IoT platform should look similar to:<\/p>\n<pre style=\"padding-left: 30px;\"><code>mqttAdaptor := mqtt.NewMqttAdaptorWithAuth(\"sensor\",\r\n    fmt.Sprintf(\"tcp:\/\/%s.messaging.internetofthings.ibmcloud.com:1883\", *org),\r\n    fmt.Sprintf(\"d:%s:gobot-sensor:%s\", *org, *deviceId), username, *apiToken)<\/code><\/pre>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Publishing_device_events\"><\/span>Publishing device events<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Devices can only publish to the event topic:<\/p>\n<pre style=\"padding-left: 30px;\"><code>iot-2\/evt\/event_id\/fmt\/format_string<\/code><\/pre>\n<p>where:<\/p>\n<ul>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">event_id<\/code> is the ID of the event, for example <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">status<\/code>. The event ID can be any string permitted by MQTT. Subscriber applications must use this string in their subscription topic to receive the events published on this topic if wildcards are not used.<\/li>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">format_string<\/code> is the format of the event payload, for example <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">json<\/code>. The format can be any string permitted by MQTT. Subscriber applications must use this string in their subscription topic to receive events published on this topic if wildcards are not used.<\/li>\n<\/ul>\n<p>For example:<\/p>\n<pre style=\"padding-left: 30px;\"><code>gobot.Every(1*time.Second, func() {\r\n    data, err := json.Marshal(GatherSensorInfo())\r\n    if err == nil {\r\n        mqttAdaptor.Publish(\"iot-2\/evt\/status\/fmt\/json\", data)\r\n    }\r\n})<\/code><\/pre>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Subscribing_to_commands\"><\/span>Subscribing to commands<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>To receive a command, your device has to subscribe to command topics:<\/p>\n<pre style=\"padding-left: 30px;\"><code>iot-2\/cmd\/command_id\/fmt\/format_string<\/code><\/pre>\n<p>where:<\/p>\n<ul>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">command_id<\/code>  is the ID of the command, for example <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">update<\/code>. The command ID can be any string permitted by MQTT. A device must use this string in its subscription topic to receive commands published on this topic if wildcards are not used.<\/li>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">format_string<\/code> is the format of the event payload, for example <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">json<\/code>. The format can be any string permitted by MQTT. A device must use this string in its subscription topic to receive commands published on this topic if wildcards are not used.<\/li>\n<\/ul>\n<p>For example:<\/p>\n<pre style=\"padding-left: 30px;\"><code>mqttAdaptor.On(\"iot-2\/cmd\/set_speed\/fmt\/json\", func(data []byte) {\r\n    var cmd SetSpeedCmd\r\n\r\n    if err := json.Unmarshal(data, &cmd); err == nil {\r\n        C.SMCSetFanSpeed(C.int(cmd.Fan), C.int(cmd.Speed))\r\n    } else {\r\n        log.Printf(\"Error: %s\", err)\r\n    }\r\n})\r\nmqttAdaptor.On(\"iot-2\/cmd\/inc_brightness\/fmt\/json\", func(data []byte) {\r\n    C.IncreaseBrightness()\r\n})\r\nmqttAdaptor.On(\"iot-2\/cmd\/dec_brightness\/fmt\/json\", func(data []byte) {\r\n    C.DecreaseBrightness()\r\n})\r\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Connecting_an_application_to_the_IoT_platform\"><\/span>Connecting an application to the IoT platform<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>An application has to use the same organization endpoint as  your device. The application must authenticate using a client ID in the following format:<\/p>\n<pre style=\"padding-left: 30px;\"><code>a:org_id:app_id<\/code><\/pre>\n<p>where:<\/p>\n<ul>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">a<\/code> indicates the client is an application.<\/li>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">org_id<\/code> is your unique organization ID.<\/li>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">app_id<\/code> is a user-defined unique string identifier for this client.<\/li>\n<\/ul>\n<p>You don\u2019t need to register the application before it is connected, so <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">app_id<\/code> can be any string that follows these rules:<\/p>\n<ul>\n<li>Contains only alphanumeric characters (a-z, A-Z, 0-9) and hyphen (-), underscore (_), or dot (.)<\/li>\n<li>Has a maximum length of 36 characters<\/li>\n<\/ul>\n<p>Applications need an API key to connect to an organization. When an API key is registered, a token will be generated and it must be used with that API key.<\/p>\n<p>The API key looks similar to this: <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">a-org_id-b2roh3bptq<\/code>. The token looks similar to this: <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">p3C76R-54EPKmeKCPA<\/code>.<\/p>\n<p><center><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/reading-service-credentials-on-the-bluemix-website.png\" alt=\"reading-service-credentials-on-the-bluemix-website\" width=\"404\" height=\"609\" class=\"aligncenter size-full wp-image-19254\" \/><\/center><\/p>\n<p>For example:<\/p>\n<pre style=\"padding-left: 30px;\"><code>if appEnv, err := cfenv.Current(); err != nil {\r\n    org = \"quickstart\"\r\n    port = \":8080\"\r\n} else {\r\n    port = fmt.Sprintf(\":%d\", appEnv.Port)\r\n    if iotfService, err := appEnv.Services.WithLabel(\"iotf-service\"); err == nil {\r\n        org = fmt.Sprintf(\"%s\", iotfService[0].Credentials[\"org\"])\r\n        apiKey = fmt.Sprintf(\"%s\", iotfService[0].Credentials[\"apiKey\"])\r\n        apiToken = fmt.Sprintf(\"%s\", iotfService[0].Credentials[\"apiToken\"].(string))\r\n    }\r\n}\r\n...\r\nmqttAdaptor := mqtt.NewMqttAdaptorWithAuth(\"server\",\r\n    fmt.Sprintf(\"tcp:\/\/%s.messaging.internetofthings.ibmcloud.com:1883\", org),\r\n    fmt.Sprintf(\"a:%s:%s\", org, uuid.Formatter(u, uuid.CleanHyphen)),\r\n    apiKey,\r\n    apiToken)\r\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Subscribing_to_device_events\"><\/span>Subscribing to device events<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Subscribe to the topic:<\/p>\n<pre style=\"padding-left: 30px;\"><code>iot-2\/type\/device_type\/id\/device_id\/evt\/event_id\/fmt\/format_string<\/code><\/pre>\n<p>The MQTT \u201cany\u201d wildcard character (+) may be used for any of the following components if you want to subscribe to more than one type of event or events from more than a single device:<\/p>\n<ul>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">device_type<\/code><\/li>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">device_id<\/code><\/li>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">event_id<\/code><\/li>\n<li><code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">format_string<\/code><\/li>\n<\/ul>\n<p>For example:<\/p>\n<pre style=\"padding-left: 30px;\"><code>mqttAdaptor.On(fmt.Sprintf(\"iot-2\/type\/+\/id\/%s\/evt\/+\/fmt\/json\", deviceId), func(data []byte) {\r\n    ...\r\n})\r\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Publishing_device_commands\"><\/span>Publishing device commands<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Your application can publish a command to any registered device. Publish to the topic:<\/p>\n<pre style=\"padding-left: 30px;\"><code>iot-2\/type\/device_type\/id\/device_id\/cmd\/command_id\/fmt\/format_string<\/code><\/pre>\n<p>For example:<\/p>\n<pre style=\"padding-left: 30px;\"><code>cmdData, err := json.Marshal(cmd)\r\nif err == nil {\r\n    mqttAdaptor.Publish(fmt.Sprintf(\"iot-2\/type\/gobot-sensor\/id\/%s\/cmd\/set_speed\/fmt\/json\", deviceId), cmdData)\r\n} else {\r\n    log.Printf(\"Error sending command: %s\", err)\r\n}<\/code><\/pre>\n<p>For more information about application and device communication, see <a href=\"https:\/\/docs.internetofthings.ibmcloud.com\" target=\"_blank\" rel=\"noopener noreferrer\">IBM Watson IoT Platform Documentation<\/a>.<\/p>\n<p>As you can see, with MQTT support in Watson IoT Platform and Gobot, it is really easy to connect your devices and applications.<\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Related_reading\"><\/span>Related reading<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/deploying-a-goji-and-postgresql-application-to-ibm-bluemix\/\">Deploying a Goji + PostgreSQL App to IBM Bluemix<\/a><\/li>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/how-to-use-elastic-services-for-anomaly-detection-in-an-ibm-bluemix-app\/\">How to Use Elastic Services for Anomaly Detection in an IBM Bluemix App<\/a><\/li>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/ibm-bluemix-openwhisk-101-developing-a-microservice\/\">IBM Bluemix OpenWhisk 101: Developing a Microservice<\/a><\/li>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/how-to-use-openwhisk-docker-actions-in-ibm-bluemix\/\">How to Use OpenWhisk Docker Actions in IBM Bluemix<\/a><\/li>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/continuous-integration-and-continuous-delivery-in-ibm-bluemix\/\">Continuous Integration and Continuous Delivery in IBM Bluemix<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<\/p>\n<p>The demo app described in this post consists of two main components:<\/p>\n<p>A \u201csensor\u201d that collects various information about a MacBook laptop: CPU temperature, fan speed, and laptop position using the Sudden Motion Sensor<br \/>\nA web application that visualizes data from the sensor and allows you to set fan speed and display [&#8230;]<\/p>\n","protected":false},"author":90,"featured_media":19251,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","footnotes":"","_links_to":"","_links_to_target":""},"categories":[214],"tags":[873,187,810,117],"class_list":["post-19148","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-cloud-native","tag-ibm-bluemix","tag-ibm-watson","tag-iot"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>IoT Platform on Bluemix: Experimenting with IBM Watson and Gobot | Altoros<\/title>\n<meta name=\"description\" content=\"In this post, we show how to turn your laptop into an IoT device and connect it to the Watson platform, controlling the system from a sample web app.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"IoT Platform on Bluemix: Experimenting with IBM Watson and Gobot | Altoros\" \/>\n<meta property=\"og:description\" content=\"The demo app described in this post consists of two main components: A \u201csensor\u201d that collects various information about a MacBook laptop: CPU temperature, fan speed, and laptop position using the Sudden Motion Sensor A web application that visualizes data from the sensor and allows you to set fan speed and display [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/\" \/>\n<meta property=\"og:site_name\" content=\"Altoros\" \/>\n<meta property=\"article:published_time\" content=\"2016-04-12T15:38:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-06-20T00:44:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/ibm-bluemix-internet-of-things-dashboard.png\" \/>\n\t<meta property=\"og:image:width\" content=\"688\" \/>\n\t<meta property=\"og:image:height\" content=\"626\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Stas Turlo\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Stas Turlo\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/\",\"url\":\"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/\",\"name\":\"IoT Platform on Bluemix: Experimenting with IBM Watson and Gobot | Altoros\",\"isPartOf\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/ibm-bluemix-internet-of-things-dashboard.png\",\"datePublished\":\"2016-04-12T15:38:03+00:00\",\"dateModified\":\"2019-06-20T00:44:31+00:00\",\"author\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/11d47ed3fb77ea65d2dd1af0af17f1f1\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/#primaryimage\",\"url\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/ibm-bluemix-internet-of-things-dashboard.png\",\"contentUrl\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/ibm-bluemix-internet-of-things-dashboard.png\",\"width\":688,\"height\":626},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.altoros.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"IoT Platform on Bluemix: Experimenting with IBM Watson and Gobot\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.altoros.com\/blog\/#website\",\"url\":\"https:\/\/www.altoros.com\/blog\/\",\"name\":\"Altoros\",\"description\":\"Insight\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.altoros.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/11d47ed3fb77ea65d2dd1af0af17f1f1\",\"name\":\"Stas Turlo\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/12\/Turlo_Stanislav.png\",\"contentUrl\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/12\/Turlo_Stanislav.png\",\"caption\":\"Stas Turlo\"},\"description\":\"Stas Turlo is a software engineer at Altoros. He has 10+ years of experience in reverse engineering, object-oriented programming, cloud computing, and data analysis. His expertise includes reconstructing algorithms, file formats, and structures of binary data. Using Golang and Ruby as his primary tools, Stas is also proficient in Python, C \/ C++, and C#. You can find Stas on GitHub.\",\"url\":\"https:\/\/www.altoros.com\/blog\/author\/s-turlo\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"IoT Platform on Bluemix: Experimenting with IBM Watson and Gobot | Altoros","description":"In this post, we show how to turn your laptop into an IoT device and connect it to the Watson platform, controlling the system from a sample web app.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/","og_locale":"en_US","og_type":"article","og_title":"IoT Platform on Bluemix: Experimenting with IBM Watson and Gobot | Altoros","og_description":"The demo app described in this post consists of two main components: A \u201csensor\u201d that collects various information about a MacBook laptop: CPU temperature, fan speed, and laptop position using the Sudden Motion Sensor A web application that visualizes data from the sensor and allows you to set fan speed and display [...]","og_url":"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/","og_site_name":"Altoros","article_published_time":"2016-04-12T15:38:03+00:00","article_modified_time":"2019-06-20T00:44:31+00:00","og_image":[{"width":688,"height":626,"url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/ibm-bluemix-internet-of-things-dashboard.png","type":"image\/png"}],"author":"Stas Turlo","twitter_misc":{"Written by":"Stas Turlo","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/","url":"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/","name":"IoT Platform on Bluemix: Experimenting with IBM Watson and Gobot | Altoros","isPartOf":{"@id":"https:\/\/www.altoros.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/#primaryimage"},"image":{"@id":"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/#primaryimage"},"thumbnailUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/ibm-bluemix-internet-of-things-dashboard.png","datePublished":"2016-04-12T15:38:03+00:00","dateModified":"2019-06-20T00:44:31+00:00","author":{"@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/11d47ed3fb77ea65d2dd1af0af17f1f1"},"breadcrumb":{"@id":"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/#primaryimage","url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/ibm-bluemix-internet-of-things-dashboard.png","contentUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/ibm-bluemix-internet-of-things-dashboard.png","width":688,"height":626},{"@type":"BreadcrumbList","@id":"https:\/\/www.altoros.com\/blog\/iot-platform-on-bluemix-experimenting-with-ibm-watson-and-gobot\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.altoros.com\/blog\/"},{"@type":"ListItem","position":2,"name":"IoT Platform on Bluemix: Experimenting with IBM Watson and Gobot"}]},{"@type":"WebSite","@id":"https:\/\/www.altoros.com\/blog\/#website","url":"https:\/\/www.altoros.com\/blog\/","name":"Altoros","description":"Insight","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.altoros.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/11d47ed3fb77ea65d2dd1af0af17f1f1","name":"Stas Turlo","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/12\/Turlo_Stanislav.png","contentUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/12\/Turlo_Stanislav.png","caption":"Stas Turlo"},"description":"Stas Turlo is a software engineer at Altoros. He has 10+ years of experience in reverse engineering, object-oriented programming, cloud computing, and data analysis. His expertise includes reconstructing algorithms, file formats, and structures of binary data. Using Golang and Ruby as his primary tools, Stas is also proficient in Python, C \/ C++, and C#. You can find Stas on GitHub.","url":"https:\/\/www.altoros.com\/blog\/author\/s-turlo\/"}]}},"_links":{"self":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/19148","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/users\/90"}],"replies":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/comments?post=19148"}],"version-history":[{"count":9,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/19148\/revisions"}],"predecessor-version":[{"id":44465,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/19148\/revisions\/44465"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/media\/19251"}],"wp:attachment":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/media?parent=19148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/categories?post=19148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/tags?post=19148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}