BUILDING
CONNECTED IOT
GADGETS WITH
PARTICLE & AZURE
Nick Landry
Senior Technical Evangelist - Microsoft
AgeofMobility.com
github.com/ActiveNick
@ActiveNick
DOWNLOAD THE
SLIDES AND DEMOS
http://slideshare.net/ActiveNick
https://github.com/ActiveNick
A G E N D A
• Quick Recap: Internet of Things
• Introducing Particle Devices
• Diving into the Particle Photon
• Connecting IoT devices to Azure
• Demos
• Discussion: Join in!
QUICK RECAP: IOT
Why do we need all these connected gadgets anyways?
B U I L D I N G A B E T T E R M O U S E T R A P
Source: “TEDx Warwick – Andy Stanford-Clark – Innovation Begins at Home”
F U J I T S U C O N N E C T E D C O W
C O N N E C T I O N PAT H S
People
Machines
(things)
P2P
Social Networking
Email, Skype, etc.
P2M
Home automation,
Self Tracking, etc.
M2M
Smart Grid,
Smart Home, etc…
W I R E L E S S , S W A R M S , A N D C L O U D S
Want to know more? Check out Cisco’s Flavio Bonomi’s “Emerging Trends in Wireless in the Era of IoT”
“ W I T H O U T C O N N E C T I V I T Y, T H E R E ’ S N O
I O T. A L L Y O U H A V E I S J U S T ‘ T H I N G S ’ …”
“ I F T H E R E ’ S N O T A P E , I T ’ S N O T A H A C K .”
– Nick Landry, 2015
H A R D W A R E C H O I C E S
I S S U E S W I T H P O P U L A R FAV O R I T E S
ARDUINO UNO
• Weak 8-bit microcontroller
• No built-in connectivity
• Cheap ($20), but Wi-Fi Shields
cost an extra $15-50
• Arduino Mini/Micro for path to
production, but connectivity is
harder to add
RASPBERRY PI
• Powerful SoC but more
expensive ($30-45)
• Built-in Ethernet, but need to
pay $10 extra for Wi-Fi adapter
• More complex environment
with Raspbian Linux (though
Windows 10 IoT Core helps )
• Difficult path to production with
no built-in wireless
E A S Y I O T C O N N E C T I V I T Y W I T H
T H E PA R T I C L E P H O T O N
PA R T I C L E
( F O R M E R L Y K N O W N
A S S P A R K )
A B O U T T H E PA R T I C L E P H O T O N
• STM32F205 ARM Cortex M3 CPU
• Built-in Broadcom BCM43362 Wi-Fi chip
• Fits in a standard breadboard (with headers)
• Surface mountable for machine assembly
(without headers or using the module directly)
• Open source hardware, firmware, and server
software, includes free cloud connectivity
• http://particle.io
• Cost: $19.00 USD
U P C L O S E W I T H T H E P H O T O N
DEMO Hello World – Particle Photon Edition
P H O T O N P O W E R
The Photon can only be powered by a
micro-USB cable from the host PC or
micro-USB compatible power source
(e.g. outlet, battery pack)
The Photon has 3.3V and 5V (VIN) pins
and two GND pins to supply voltages
to your project components
The photon can be powered by any
power source via the VIN pin between
3.6VDC and 5.5VDC, and lots more
with a variety of shields, etc
Source: https://docs.particle.io/datasheets/photon-datasheet/#pin-description
G P I O
• General Purpose Input Output
• Pin that can be controlled by the user
• Can be set to input or output
• Input can be things like temperature sensors, buttons, IR, etc.
• Output can be LEDs, Motors, LCDs etc
P H O T O N D I G I TA L P I N S
Pins 0-7 Are Digital Pins
pinMode(pin,INPUT) sets a pin as an input
pinMode(pin,OUTPUT) sets the pin as output
digitalWrite(pin,LOW) sets the pin to 0v
digitalWrite(pin,HIGH) sets the pin to +3.3V
digitalRead(pin) reads the pin state
Analog A0-A5, DAC & WKP pins can
also be used as digital GPIO pins if they
aren’t needed for analog use.
Source: https://docs.particle.io/datasheets/photon-datasheet/#pin-description
A N A L O G V S . D I G I TA L
• Computers understand digital signals
• Analog needs to be converted (ADC)
• Analog signals are often useful for sensors that work by adjusting voltage
/ resistance (temperature sensors, soil moisture sensors, etc)
• Analog input covers voltage levels into a digital value within a defined
range
• Digital is counted in fixed units, not measured.
• PWM – Pulse Width Modulation – to “fake”analog
• DAC / DAC1 pins are useful for non PWM readings, microphones, etc.
(they don't use PWM)
• Serial Communication with Rx/Tx
P H O T O N A N A L O G P I N S
Pins A0-A5 Are Analog Pins. DAC pin
counts as analog pin A6.
pinMode(pin,INPUT) sets a pin as an input
analogRead(pin) reads the pin value (0-1023)
These pins map to a 6 channel, 12-bit
Analog-to-Digital converter (ADC).
Lets you read an analog voltage as a
mapped value that ranges from
decimal 0 to 4095.
A3 / A6 (DAC1, DAC) are non PWM
pins, and don't use the ADC.
Source: https://docs.particle.io/datasheets/photon-datasheet/#pin-description
L E D S
Long Leg Short Leg
Small Post Big Post
Flat Edge
Vcc (+) GND
Anode (+) Cathode (-)
Providing more current than an LED is rated for can destroy the LED.
To prevent that, you should use a “Current Limiting” resistor.
To calculate the value of the resistor you need to know the supply voltage, and the LEDs rated Forward Voltage (the
voltage drop across the LED) and Forward Current (the maximum current the LED can handle)
C U R R E N T L I M I T I N G R E S I S T O R S
𝑅𝑒𝑠𝑖𝑠𝑡𝑜𝑟 𝑉𝑎𝑙𝑢𝑒 (𝑅) =
𝑆𝑢𝑝𝑝𝑙𝑦 𝑉𝑜𝑙𝑡𝑎𝑔𝑒 𝑉𝑠 − 𝐿𝐸𝐷 𝐹𝑜𝑟𝑤𝑎𝑟𝑑 𝑉𝑜𝑙𝑡𝑎𝑔𝑒 (𝑉𝑓)
𝐿𝐸𝐷 𝐹𝑜𝑟𝑤𝑎𝑟𝑑 𝐶𝑢𝑟𝑟𝑒𝑛𝑡 (𝐼𝑓)
𝑅 =
𝑉𝑠 − 𝑉𝑓
𝐼𝑓
=
5𝑉 − 2𝑉
.02𝐴
= 150Ω
𝑉𝑓 = 2𝑉𝑑𝑐 𝐼𝑓 = 20𝑚𝐴
𝑉𝑠 = 5𝑉𝑑𝑐
That said, you’ll likely find that for most quick experiments and demos
you can skip using a current limiting resistor and just power the LED
directly. USUALLY the LED will survive just fine, but sometimes…..
P O T E N T I O M E T E R – VA R I A B L E R E S I S T O R
P U L S E W I D T H M O D U L AT I O N ( P W M )
P I N S
Pins D0, D1, D2/A5, D3/A4, WKP,
RX and TX are PWM pins. Unlike
Arduino, there is no “~” symbol to
identify them.
analogWrite(pin,value) (link)
These pins use Pulse Width Modulation to
simulate an analog voltage by turning the pin
on and off based on the value provided:
• 0 (always off) - 255 (always on)
• Can be used to dim LEDs, control motor
speed, etc.
• https://docs.particle.io/reference/firmware/
photon/#analogwrite-
Source: https://docs.particle.io/datasheets/photon-datasheet/#pin-description
B R E A D B O A R D S
Breadboards offer a great way to
prototype circuits. The provide a
number of “buses” for connecting
both power and components.
Power buses run the entire
horizontal length
Component buses give you easy
ways to connect pins together
DEMO More Cool Particle Photon Demos
C O N N E C T I N G T H I N G S T O T H E C L O U D
M I C R O S O F T A Z U R E I OT S E R V I C E S
Producers Connect Devices Storage Analytics Take Action
Event Hubs
IoT Hubs
SQL Database
Machine
Learning
Azure Websites
Service Bus
Table/Blob
Storage
Stream Analytics Power BI
External Data
Sources
DocumentDB HDInsight
Notification
Hubs
External Data
Sources
Data Factory Mobile Services
BizTalk Services
{ }
DEMO
Collecting Weather Data in the Cloud
with Particle Photon & Azure
RESOURCES
How do I get started? What should I buy? Any good tutorials out there?
W H E R E T O B U Y M A K E R S T U F F ?
• Sparkfun (www.sparkfun.com)
• Adafruit (www.adafruit.com)
• Seeed Studio (www.seeedstudio.com)
• Maker Shed (www.makershed.com)
• Mouser Electronics (www.mouser.com)
• Netgate (www.netgate.com)
• Amazon (www.amazon.com)
• Radio Shack (www.radioshack.com)
• The retail stores are perfect when you need parts urgently
M A K E M A G A Z I N E
• Makezine.com
• Print & Digital
M A K E R R E S O U R C E S
• Hackster.io (https://www.hackster.io)
• Microsoft projects: https://www.hackster.io/microsoft
• HackADay (www.hackaday.com)
• Instructables (www.instructables.com)
• CreativeApplications (www.creativeapplications.net)
M A K E R B O O K S ?
Maker Media (O’Reilly)
http://shop.oreilly.com/category/publishers/make.do
Packt Publishing
https://www.packtpub.com/hardware-and-creative
A R D U I N O P R O J E C T H A N D B O O K
• https://arduinohandbook.wordpress.com
F R I T Z I N G : E L E C T R O N I C D I A G R A M M I N G
• http://fritzing.org
• Open-source hardware initiative
that makes electronics accessible
as a creative material for anyone
• Software tool
• Community website
• Services
• Foster a creative ecosystem
• Allow user to document their
prototypes & share with others
• Teach electronics in classrooms
• Layout and manufacture
professional pcbs
M I C R O S O F T V I R T U A L A C A D E M Y
• Programming Robotic Systems with Visual Studio
• With Chris Howd & Paul Pardi, Microsoft
• Course Outline
• 01 | Embedded Systems, Robotics, and this MVA Training Series
• 02 | Getting Started with Arduino
• 03 | Creating Your First Arduino Robot
• 04 | Controlling a Robotic Arm
• 05 | Integrating Advanced Sensors and Shields
• 06 | Mapping Areas and Detecting Objects
• 07 | Integrating Wireless Control and Communication
• 08 | Looking Ahead
• http://www.microsoftvirtualacademy.com/training-courses/programming-
robotic-systems-with-visual-studio
M I C R O S O F T D X I O T R E S O U R C E L I N K S
• Bret Stateham: IoT, Galileo
• https://github.com/bretstateham/iot
• Jeremy Foster: Intel Edison
• http://codefoster.com/edison
• Stacey Mulcahy
• http://thebitchwhocodes.com/blog
• Paul de Carlo
• http://pjdecarlo.com
• Nick Landry
• http://AgeofMobility.com
I O T PA N E L AT T H I N G S E X P O 2 0 1 4
• Microsoft, IBM, Kaazing, Xively/LogMeIn & Aria
• http://aka.ms/iotpanel2014
HAVE FUN!
Go build something…
P L E A S E H A C K S A F E LY !
T H A N K Y O U !
Slides are posted on Slideshare. Demos are on GitHub.
Please fill out an evaluation. Your feedback is important and appreciated.
Slideshare: www.slideshare.net/ActiveNick
Blog: www.AgeofMobility.com
Twitter: @ActiveNick
Mobile Apps: www.bigbaldapps.com
LinkedIn: www.linkedin.com/in/activenick
GitHub: github.com/ActiveNick
Email: nick.landry@microsoft.com

Building Connected IoT Gadgets with Particle.io & Azure

  • 1.
    BUILDING CONNECTED IOT GADGETS WITH PARTICLE& AZURE Nick Landry Senior Technical Evangelist - Microsoft AgeofMobility.com github.com/ActiveNick @ActiveNick
  • 2.
    DOWNLOAD THE SLIDES ANDDEMOS http://slideshare.net/ActiveNick https://github.com/ActiveNick
  • 3.
    A G EN D A • Quick Recap: Internet of Things • Introducing Particle Devices • Diving into the Particle Photon • Connecting IoT devices to Azure • Demos • Discussion: Join in!
  • 4.
    QUICK RECAP: IOT Whydo we need all these connected gadgets anyways?
  • 5.
    B U IL D I N G A B E T T E R M O U S E T R A P Source: “TEDx Warwick – Andy Stanford-Clark – Innovation Begins at Home”
  • 6.
    F U JI T S U C O N N E C T E D C O W
  • 7.
    C O NN E C T I O N PAT H S People Machines (things) P2P Social Networking Email, Skype, etc. P2M Home automation, Self Tracking, etc. M2M Smart Grid, Smart Home, etc…
  • 8.
    W I RE L E S S , S W A R M S , A N D C L O U D S Want to know more? Check out Cisco’s Flavio Bonomi’s “Emerging Trends in Wireless in the Era of IoT”
  • 9.
    “ W IT H O U T C O N N E C T I V I T Y, T H E R E ’ S N O I O T. A L L Y O U H A V E I S J U S T ‘ T H I N G S ’ …” “ I F T H E R E ’ S N O T A P E , I T ’ S N O T A H A C K .” – Nick Landry, 2015
  • 10.
    H A RD W A R E C H O I C E S
  • 11.
    I S SU E S W I T H P O P U L A R FAV O R I T E S ARDUINO UNO • Weak 8-bit microcontroller • No built-in connectivity • Cheap ($20), but Wi-Fi Shields cost an extra $15-50 • Arduino Mini/Micro for path to production, but connectivity is harder to add RASPBERRY PI • Powerful SoC but more expensive ($30-45) • Built-in Ethernet, but need to pay $10 extra for Wi-Fi adapter • More complex environment with Raspbian Linux (though Windows 10 IoT Core helps ) • Difficult path to production with no built-in wireless
  • 12.
    E A SY I O T C O N N E C T I V I T Y W I T H T H E PA R T I C L E P H O T O N
  • 13.
    PA R TI C L E ( F O R M E R L Y K N O W N A S S P A R K )
  • 14.
    A B OU T T H E PA R T I C L E P H O T O N • STM32F205 ARM Cortex M3 CPU • Built-in Broadcom BCM43362 Wi-Fi chip • Fits in a standard breadboard (with headers) • Surface mountable for machine assembly (without headers or using the module directly) • Open source hardware, firmware, and server software, includes free cloud connectivity • http://particle.io • Cost: $19.00 USD
  • 15.
    U P CL O S E W I T H T H E P H O T O N
  • 16.
    DEMO Hello World– Particle Photon Edition
  • 17.
    P H OT O N P O W E R The Photon can only be powered by a micro-USB cable from the host PC or micro-USB compatible power source (e.g. outlet, battery pack) The Photon has 3.3V and 5V (VIN) pins and two GND pins to supply voltages to your project components The photon can be powered by any power source via the VIN pin between 3.6VDC and 5.5VDC, and lots more with a variety of shields, etc Source: https://docs.particle.io/datasheets/photon-datasheet/#pin-description
  • 18.
    G P IO • General Purpose Input Output • Pin that can be controlled by the user • Can be set to input or output • Input can be things like temperature sensors, buttons, IR, etc. • Output can be LEDs, Motors, LCDs etc
  • 19.
    P H OT O N D I G I TA L P I N S Pins 0-7 Are Digital Pins pinMode(pin,INPUT) sets a pin as an input pinMode(pin,OUTPUT) sets the pin as output digitalWrite(pin,LOW) sets the pin to 0v digitalWrite(pin,HIGH) sets the pin to +3.3V digitalRead(pin) reads the pin state Analog A0-A5, DAC & WKP pins can also be used as digital GPIO pins if they aren’t needed for analog use. Source: https://docs.particle.io/datasheets/photon-datasheet/#pin-description
  • 20.
    A N AL O G V S . D I G I TA L • Computers understand digital signals • Analog needs to be converted (ADC) • Analog signals are often useful for sensors that work by adjusting voltage / resistance (temperature sensors, soil moisture sensors, etc) • Analog input covers voltage levels into a digital value within a defined range • Digital is counted in fixed units, not measured. • PWM – Pulse Width Modulation – to “fake”analog • DAC / DAC1 pins are useful for non PWM readings, microphones, etc. (they don't use PWM) • Serial Communication with Rx/Tx
  • 21.
    P H OT O N A N A L O G P I N S Pins A0-A5 Are Analog Pins. DAC pin counts as analog pin A6. pinMode(pin,INPUT) sets a pin as an input analogRead(pin) reads the pin value (0-1023) These pins map to a 6 channel, 12-bit Analog-to-Digital converter (ADC). Lets you read an analog voltage as a mapped value that ranges from decimal 0 to 4095. A3 / A6 (DAC1, DAC) are non PWM pins, and don't use the ADC. Source: https://docs.particle.io/datasheets/photon-datasheet/#pin-description
  • 22.
    L E DS Long Leg Short Leg Small Post Big Post Flat Edge Vcc (+) GND Anode (+) Cathode (-)
  • 23.
    Providing more currentthan an LED is rated for can destroy the LED. To prevent that, you should use a “Current Limiting” resistor. To calculate the value of the resistor you need to know the supply voltage, and the LEDs rated Forward Voltage (the voltage drop across the LED) and Forward Current (the maximum current the LED can handle) C U R R E N T L I M I T I N G R E S I S T O R S 𝑅𝑒𝑠𝑖𝑠𝑡𝑜𝑟 𝑉𝑎𝑙𝑢𝑒 (𝑅) = 𝑆𝑢𝑝𝑝𝑙𝑦 𝑉𝑜𝑙𝑡𝑎𝑔𝑒 𝑉𝑠 − 𝐿𝐸𝐷 𝐹𝑜𝑟𝑤𝑎𝑟𝑑 𝑉𝑜𝑙𝑡𝑎𝑔𝑒 (𝑉𝑓) 𝐿𝐸𝐷 𝐹𝑜𝑟𝑤𝑎𝑟𝑑 𝐶𝑢𝑟𝑟𝑒𝑛𝑡 (𝐼𝑓) 𝑅 = 𝑉𝑠 − 𝑉𝑓 𝐼𝑓 = 5𝑉 − 2𝑉 .02𝐴 = 150Ω 𝑉𝑓 = 2𝑉𝑑𝑐 𝐼𝑓 = 20𝑚𝐴 𝑉𝑠 = 5𝑉𝑑𝑐 That said, you’ll likely find that for most quick experiments and demos you can skip using a current limiting resistor and just power the LED directly. USUALLY the LED will survive just fine, but sometimes…..
  • 24.
    P O TE N T I O M E T E R – VA R I A B L E R E S I S T O R
  • 25.
    P U LS E W I D T H M O D U L AT I O N ( P W M ) P I N S Pins D0, D1, D2/A5, D3/A4, WKP, RX and TX are PWM pins. Unlike Arduino, there is no “~” symbol to identify them. analogWrite(pin,value) (link) These pins use Pulse Width Modulation to simulate an analog voltage by turning the pin on and off based on the value provided: • 0 (always off) - 255 (always on) • Can be used to dim LEDs, control motor speed, etc. • https://docs.particle.io/reference/firmware/ photon/#analogwrite- Source: https://docs.particle.io/datasheets/photon-datasheet/#pin-description
  • 26.
    B R EA D B O A R D S Breadboards offer a great way to prototype circuits. The provide a number of “buses” for connecting both power and components. Power buses run the entire horizontal length Component buses give you easy ways to connect pins together
  • 27.
    DEMO More CoolParticle Photon Demos
  • 28.
    C O NN E C T I N G T H I N G S T O T H E C L O U D
  • 29.
    M I CR O S O F T A Z U R E I OT S E R V I C E S Producers Connect Devices Storage Analytics Take Action Event Hubs IoT Hubs SQL Database Machine Learning Azure Websites Service Bus Table/Blob Storage Stream Analytics Power BI External Data Sources DocumentDB HDInsight Notification Hubs External Data Sources Data Factory Mobile Services BizTalk Services { }
  • 30.
    DEMO Collecting Weather Datain the Cloud with Particle Photon & Azure
  • 31.
    RESOURCES How do Iget started? What should I buy? Any good tutorials out there?
  • 32.
    W H ER E T O B U Y M A K E R S T U F F ? • Sparkfun (www.sparkfun.com) • Adafruit (www.adafruit.com) • Seeed Studio (www.seeedstudio.com) • Maker Shed (www.makershed.com) • Mouser Electronics (www.mouser.com) • Netgate (www.netgate.com) • Amazon (www.amazon.com) • Radio Shack (www.radioshack.com) • The retail stores are perfect when you need parts urgently
  • 33.
    M A KE M A G A Z I N E • Makezine.com • Print & Digital
  • 34.
    M A KE R R E S O U R C E S • Hackster.io (https://www.hackster.io) • Microsoft projects: https://www.hackster.io/microsoft • HackADay (www.hackaday.com) • Instructables (www.instructables.com) • CreativeApplications (www.creativeapplications.net)
  • 35.
    M A KE R B O O K S ? Maker Media (O’Reilly) http://shop.oreilly.com/category/publishers/make.do Packt Publishing https://www.packtpub.com/hardware-and-creative
  • 36.
    A R DU I N O P R O J E C T H A N D B O O K • https://arduinohandbook.wordpress.com
  • 37.
    F R IT Z I N G : E L E C T R O N I C D I A G R A M M I N G • http://fritzing.org • Open-source hardware initiative that makes electronics accessible as a creative material for anyone • Software tool • Community website • Services • Foster a creative ecosystem • Allow user to document their prototypes & share with others • Teach electronics in classrooms • Layout and manufacture professional pcbs
  • 38.
    M I CR O S O F T V I R T U A L A C A D E M Y • Programming Robotic Systems with Visual Studio • With Chris Howd & Paul Pardi, Microsoft • Course Outline • 01 | Embedded Systems, Robotics, and this MVA Training Series • 02 | Getting Started with Arduino • 03 | Creating Your First Arduino Robot • 04 | Controlling a Robotic Arm • 05 | Integrating Advanced Sensors and Shields • 06 | Mapping Areas and Detecting Objects • 07 | Integrating Wireless Control and Communication • 08 | Looking Ahead • http://www.microsoftvirtualacademy.com/training-courses/programming- robotic-systems-with-visual-studio
  • 39.
    M I CR O S O F T D X I O T R E S O U R C E L I N K S • Bret Stateham: IoT, Galileo • https://github.com/bretstateham/iot • Jeremy Foster: Intel Edison • http://codefoster.com/edison • Stacey Mulcahy • http://thebitchwhocodes.com/blog • Paul de Carlo • http://pjdecarlo.com • Nick Landry • http://AgeofMobility.com
  • 40.
    I O TPA N E L AT T H I N G S E X P O 2 0 1 4 • Microsoft, IBM, Kaazing, Xively/LogMeIn & Aria • http://aka.ms/iotpanel2014
  • 41.
    HAVE FUN! Go buildsomething…
  • 42.
    P L EA S E H A C K S A F E LY !
  • 43.
    T H AN K Y O U ! Slides are posted on Slideshare. Demos are on GitHub. Please fill out an evaluation. Your feedback is important and appreciated. Slideshare: www.slideshare.net/ActiveNick Blog: www.AgeofMobility.com Twitter: @ActiveNick Mobile Apps: www.bigbaldapps.com LinkedIn: www.linkedin.com/in/activenick GitHub: github.com/ActiveNick Email: nick.landry@microsoft.com