Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
FieldGateways
ProtocolAdapters
OSSProject
CloudGateway
EventHub->IoTHub
Hot Path Analytics
Azure Stream Analytics, Azure S...
FieldGateways
ProtocolAdapters
OSSProject
CloudGateway
IoTHub
Hot Path Analytics
Azure Stream Analytics, Azure Storm
Cold ...
MCU + MPUMCU (e.g. ATMega) MPU
Micro-controller (MCU) MCU + MPU MPU
Example
Arduino Pro Mini Arduino Uno Arduino Yún Parti...
Preparing your development environment
Photon.ThingLabs.io/00/
(v 4.0 is not compatible with this lab)
If you have a 64-bit OS, be sure to install the
64-bit version of Node.js
The fundamentals of maker development kits
Azure IoT
Azure IoT
SETUP
Push & Hold to set to
Listen mode
D7
Digital pin with
onbaod LED
RESET
Push to reboot
Azure IoTParticle Cloud
The ‘Hello, World!’ of devices
Photon.ThingLabs.io/01/
Tweet with @ThingLabsIO and #HelloIoT
"name" "IoT-Labs"
"version" "0.1.0"
"private"
"description" ”Building Things with Node.js and Johnny-Five"
"main" ”lab01.j...
// lab01.js
var "johnny-five"
var "particle-io"
// Set up the access credentials for Particle and Azure
var 'YOUR PARTICLE...
// The board.on() executes the anonymous function when the
// board reports back that it is initialized and ready.
"ready"...
In this lab you will read input from an analog sensor using a voltage divider.
Photon.ThingLabs.io/02/
Tweet with @ThingLa...
A voltage divider splits input
voltage input amongst two or
more components.
The resisted voltage indicates the
value.
Bri...
// lab02.js
var "johnny-five"
var "particle-io"
// Set up the access credentials for Particle and Azure
var 'YOUR PARTICLE...
// The board.on() executes the anonymous function when the
// board reports back that it is initialized and ready.
"ready"...
In this lab you will use analog input to control digital output.
Photon.ThingLabs.io/03/
Tweet with @ThingLabsIO and #Nigh...
// lab03.js
var "johnny-five"
var "particle-io"
// Set up the access credentials for Particle and Azure
var 'YOUR PARTICLE...
// The board.on() executes the anonymous function when the
// board reports back that it is initialized and ready.
"ready"...
// Replace ‘TODO: Handle the photoresistor data events’ with the following:
// Define the callback function for the photor...
The fundamentals of connecting Things to the Cloud
In this lab you will gather telemetry and send it to the cloud.
Azure.ThingLabs.io/02/
Tweet with @ThingLabsIO and #Teleme...
{
"name": "IoT-Labs",
"version": "0.1.0",
"private": true,
"description": "Sample app that connects a device to Azure usin...
// weather.js
var five = require ("johnny-five");
var device = require("azure-iot-device");
var Weather = require("j5-spar...
// Create a Johnny Five board instance to represent your Particle Photon.
// Board is simply an abstraction of the physica...
// The board.on() executes the anonymous function when the
// board reports back that it is initialized and ready.
board.o...
// The weather.on("data", callback) function invokes the anonymous callback function
// whenever the data from the sensor ...
// Create the message based on the payload JSON
var message = new device.Message(payload);
// For debugging purposes, writ...
In this lab you will create visualizations of IoT data.
Azure.ThingLabs.io/03/
Tweet with @ThingLabsIO and #IoTBI
SELECT
MAX(fahrenheit) MaxTempF,
MIN(fahrenheit) MinTempF,
AVG(fahrenheit) AvgTempF,
MAX(celsius) MaxTempC,
MIN(celsius) M...
Tweet with @ThingLabsIO and #ThatWasAwesome
ThingLabs IoT Workshop
ThingLabs IoT Workshop
ThingLabs IoT Workshop
ThingLabs IoT Workshop
ThingLabs IoT Workshop
ThingLabs IoT Workshop
ThingLabs IoT Workshop
ThingLabs IoT Workshop
ThingLabs IoT Workshop
ThingLabs IoT Workshop
ThingLabs IoT Workshop
ThingLabs IoT Workshop
ThingLabs IoT Workshop
ThingLabs IoT Workshop
ThingLabs IoT Workshop
ThingLabs IoT Workshop
ThingLabs IoT Workshop
ThingLabs IoT Workshop
ThingLabs IoT Workshop
ThingLabs IoT Workshop
ThingLabs IoT Workshop
ThingLabs IoT Workshop
ThingLabs IoT Workshop
Upcoming SlideShare
Loading in …5
×

ThingLabs IoT Workshop

1,212 views

Published on

This is the slide deck from the ThingLabs IoT Workshop at DEVintersection in October 2015

Published in: Technology
  • Be the first to comment

ThingLabs IoT Workshop

  1. 1. FieldGateways ProtocolAdapters OSSProject CloudGateway EventHub->IoTHub Hot Path Analytics Azure Stream Analytics, Azure Storm Cold / Batch Analytics & Visualizations Azure HDInsight, AzureML, Power BI, Azure Data Factory Hot Path Business Logic PaaS V2 & Actor Framework EnterpriseProcessConnections BizTalkServices,NotificationHubs Devices Linux,Android,iOS,RTOS,Windows Device Connectivity Analytics & Operationalized Insights Business Connectivity
  2. 2. FieldGateways ProtocolAdapters OSSProject CloudGateway IoTHub Hot Path Analytics Azure Stream Analytics, Azure Storm Cold / Batch Analytics & Visualizations Azure HDInsight, AzureML, Power BI, Azure Data Factory Hot Path Business Logic PaaS V2 & Actor Framework EnterpriseProcessConnections BizTalkServices,NotificationHubs Devices Linux,Android,iOS,RTOS,Windows Device Connectivity Analytics & Operationalized Insights Business Connectivity
  3. 3. MCU + MPUMCU (e.g. ATMega) MPU Micro-controller (MCU) MCU + MPU MPU Example Arduino Pro Mini Arduino Uno Arduino Yún Particle Photon Raspberry Pi 2 MinnowBorad MAX Micro- controller ATmega328 ATmega328 ATmega32u4 -- -- -- Micro- processor -- -- Atheros AR9331 ARM Cortex-M3 ARM Cortex-A7 Intel Atom E38xx GPU No No No No Yes Integrated Wi-Fi SoC No No Yes Yes No No Linux No No Yes No Yes Yes Windows 10 IoT No No No No Yes Yes
  4. 4. Preparing your development environment Photon.ThingLabs.io/00/
  5. 5. (v 4.0 is not compatible with this lab) If you have a 64-bit OS, be sure to install the 64-bit version of Node.js
  6. 6. The fundamentals of maker development kits
  7. 7. Azure IoT
  8. 8. Azure IoT
  9. 9. SETUP Push & Hold to set to Listen mode D7 Digital pin with onbaod LED RESET Push to reboot
  10. 10. Azure IoTParticle Cloud
  11. 11. The ‘Hello, World!’ of devices Photon.ThingLabs.io/01/ Tweet with @ThingLabsIO and #HelloIoT
  12. 12. "name" "IoT-Labs" "version" "0.1.0" "private" "description" ”Building Things with Node.js and Johnny-Five" "main" ”lab01.js" "author" "YOUR NAME HERE" "license" "MIT" "dependencies" "johnny-five" "^0.8.104” "particle-io" "^0.10.1”
  13. 13. // lab01.js var "johnny-five" var "particle-io" // Set up the access credentials for Particle and Azure var 'YOUR PARTICLE ACCESS TOKEN HERE' var 'YOUR PARTICLE PHOTON DEVICE ID/ALIAS HERE' // Define the pin that is connected to the LED var // Create a Johnny Five board instance to represent your Particle Photon. // ‘Board ‘is simply an abstraction of the physical hardware, // whether it is a Photon, Arduino, Raspberry Pi or other boards. var new new
  14. 14. // The board.on() executes the anonymous function when the // board reports back that it is initialized and ready. "ready" function "Board connected..." // Set the pin you connected to the LED to OUTPUT mode this // Create a loop to "flash/blink/strobe" the LED once per second var this function this
  15. 15. In this lab you will read input from an analog sensor using a voltage divider. Photon.ThingLabs.io/02/ Tweet with @ThingLabsIO and #ilikedark
  16. 16. A voltage divider splits input voltage input amongst two or more components. The resisted voltage indicates the value. Brighter light == Less resistance;
  17. 17. // lab02.js var "johnny-five" var "particle-io" // Set up the access credentials for Particle and Azure var 'YOUR PARTICLE ACCESS TOKEN HERE' var 'YOUR PARTICLE PHOTON DEVICE ID/ALIAS HERE' // Define the pin you will use to read the residual voltage // coming from the photoresistor var // Create a Johnny Five board instance to represent your Particle Photon. // ‘Board ‘is simply an abstraction of the physical hardware, whether // it is a Photon, Arduino, Raspberry Pi or other boards. var new new
  18. 18. // The board.on() executes the anonymous function when the // board reports back that it is initialized and ready. "ready" function "Board connected..." // Read the residual voltage coming from the photoresistor this function // Multiple the value by 3.3V / 1024, which the the // value range of the photoresistor
  19. 19. In this lab you will use analog input to control digital output. Photon.ThingLabs.io/03/ Tweet with @ThingLabsIO and #NightLight
  20. 20. // lab03.js var "johnny-five" var "particle-io" // Set up the access credentials for Particle and Azure var 'YOUR PARTICLE ACCESS TOKEN HERE' var 'YOUR PARTICLE PHOTON DEVICE ID/ALIAS HERE' // Define the pin that is connected to the LED var “D0" // Define the pin you will use to read the residual voltage // coming from the photoresistor var "A0" // Create a Johnny Five board instance to represent your Particle Photon. ‘Board ‘is simply an abstraction of // the physical hardware, whether it is a Photon, Arduino, Raspberry Pi or other boards. var new new
  21. 21. // The board.on() executes the anonymous function when the // board reports back that it is initialized and ready. "ready" function "Board connected..." // Set the pin you connected to the LED to OUTPUT mode this // Create a new 'photoresistor' hardware instance. new // Analog pin 0 // TODO: Handle the photoresistor data events
  22. 22. // Replace ‘TODO: Handle the photoresistor data events’ with the following: // Define the callback function for the photoresistor reading. // The freq value used when the photoresistor was defined // determines how often this is invoked. // Scale the sensor's data from 0-1023 to 0-255. "data" function // Multiple the value by 3.3V / 1024, which the the // value range of the photoresistor this // Set the brigthness of the LED this
  23. 23. The fundamentals of connecting Things to the Cloud
  24. 24. In this lab you will gather telemetry and send it to the cloud. Azure.ThingLabs.io/02/ Tweet with @ThingLabsIO and #Telemetry
  25. 25. { "name": "IoT-Labs", "version": "0.1.0", "private": true, "description": "Sample app that connects a device to Azure using Node.js", "main": "weather.js", "author": "YOUR NAME HERE", "license": "MIT", "dependencies": { "johnny-five": "^0.8.104", "particle-io": "^0.10.1” , "j5-sparkfun-weather-shield": "^0.2.0", "azure-iot-device": "^1.0.0-preview.3” } }
  26. 26. // weather.js var five = require ("johnny-five"); var device = require("azure-iot-device"); var Weather = require("j5-sparkfun-weather-shield")(five); var Particle = require("particle-io"); // Set up the access credentials for Particle and Azure var token = 'YOUR PARTICLE ACCESS TOKEN HERE'; var deviceId = 'YOUR PARTICLE PHOTON DEVICE ID/ALIAS HERE'; var location = 'THE LOCATION OF THE PARTICLE PHOTON DEVICE'; var connectionString = 'YOUR IOT HUB DEVICE-SPECIFIC CONNECTION STRING HERE';
  27. 27. // Create a Johnny Five board instance to represent your Particle Photon. // Board is simply an abstraction of the physical hardware, whether it is // a Photon, Arduino, Raspberry Pi or other boards. var board = new five.Board({ io: new Particle({ token: token, deviceId: deviceId }) }); // Create an Azure IoT client that will manage the connection to your IoT Hub // The client is created in the context of an Azure IoT device, which is why // you use a device-specific connection string. var client = new device.Client(connectionString, new device.Https());
  28. 28. // The board.on() executes the anonymous function when the // board reports back that it is initialized and ready. board.on("ready", function() { console.log("Board connected..."); // The SparkFun Weather Shield for the Particle Photon has two sensors on the I2C bus – // a humidity sensor (HTU21D) which can provide both humidity and temperature, and a // barometer (MPL3115A2) which can provide both barometric pressure and humidity. // Controllers for these are wrapped in the convenient ‘Weather’ plug-in class: var weather = new Weather({ variant: "PHOTON", freq: 1000, elevation: 100 // Put your current elevation (in feet) here }) // Don’t close the board.on() function yet
  29. 29. // The weather.on("data", callback) function invokes the anonymous callback function // whenever the data from the sensor changes (no faster than every 25ms). The anonymous // function is scoped to the object (e.g. this == the instance of Weather class object). weather.on(“data" , function () { // Create an Azure IoT Message var payload = JSON.stringify({ deviceId: deviceId, location: location, // celsius & fahrenheit are averages taken from both sensors on the shield celsius: this.celsius, fahrenheit: this.fahrenheit, relativeHumidity: this.relativeHumidity, pressure: this.pressure, feet: this.feet, meters: this.meters }); // Don’t close the weather.on() or board.on() functions yet
  30. 30. // Create the message based on the payload JSON var message = new device.Message(payload); // For debugging purposes, write out the message payload to the console console.log("Sending message: " + message.getData()); // Send the message to Azure IoT Hub // printResultsFor() is a function you will write next client.sendEvent(message, printResultFor('send')); }); // Close the weather.on() function }); // Close the board.on() function
  31. 31. In this lab you will create visualizations of IoT data. Azure.ThingLabs.io/03/ Tweet with @ThingLabsIO and #IoTBI
  32. 32. SELECT MAX(fahrenheit) MaxTempF, MIN(fahrenheit) MinTempF, AVG(fahrenheit) AvgTempF, MAX(celsius) MaxTempC, MIN(celsius) MinTempC, AVG(celsius) AvgTempC, MAX(relativeHumidity) MaxHumidity, MIN(relativeHumidity) MinHumidity, AVG(relativeHumidity) AvgHumidity, location, deviceId, System.Timestamp AS Timestamp INTO [TemperatureBI] FROM [DeviceInputStream] GROUP BY TumblingWindow (second, 1), deviceId, location
  33. 33. Tweet with @ThingLabsIO and #ThatWasAwesome

×