Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

83
Welcome to

Transcript of Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Page 1: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Welcome to

Page 2: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

#BdgIoTDay

Page 3: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

sponsored by

organized by

IoT4Bdg

supported by

media partners

http://bit.ly/bdg-iotdevday

Page 4: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Raspberry Pi 2 + Windows 10 IoT Core

Page 5: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Andri Yadi

@andri_yadi | a at dycode dot com

http://andriyadi.me

Page 6: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

CEO of

Page 7: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

CEO of

Page 8: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core
Page 9: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

8 years in a row

Page 10: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

My Experience around Raspberry Pi

Page 11: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

A custom-made, compact, autonomous machine for delivering engagements

Co-creator of

Page 12: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core
Page 13: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Inside

Page 14: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Inside

Raspberry Pi 2

Raspbian

Node.js

Arduino

Page 15: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core
Page 16: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core
Page 17: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Windows 10 – at least 10240

Page 18: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Visual Studio 2015 - 14.0.24720.00 Update 1

Page 19: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Developer Mode

Page 20: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core
Page 21: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

:)

Page 22: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

What is the Internet of Things (IoT)?

Connectivity Data AnalyticsThings

Page 23: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Raspberry Pi 2

SoC: Broadcom BCM2836 (CPU, GPU, DSP, SDRAM)

900 MHz quad-core ARM Cortex A7

Memory: 1 GB (shared with GPU)

GPU: Broadcom VideoCore IV @ 250 MHz

Storage: MicroSD

Page 24: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Raspberry Pi 2 & GPIO

Page 25: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Raspberry Pi OS

Page 26: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core
Page 27: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Windows 10 IoT Core on Raspberry Pi 2

Page 28: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Windows 10 IoT Core Supported boards

Raspberry Pi 2 Minnowboard Max DragonBoard 410c

Page 29: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Out focus today!

Raspberry Pi 2

Page 30: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Full list: http://ms-iot.github.io/content/en-US/win10/SupportedInterfaces.htm

Compatible Hardware

WiFi Dongle Bluetooth Webcam NFC/RFID ADC

Page 31: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

install & run Windows 10 IoT Core in Raspberry Pi 2

Page 32: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Windows 10 IoT Core Dashboard

Download: http://go.microsoft.com/fwlink/?LinkID=708576

Page 33: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Windows 10 IoT Core Dashboard

Select, Download and Install

Page 34: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

That easy! Now insert MicroSD to Raspberry Pi 2

Page 35: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Connecting Raspberry Pi 2 to Wi-Fi for the 1st time

Page 36: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

New device will appear here…

Page 37: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

What next after installingWindows 10 IoT Core?

Code it!

Page 38: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Supported development paths

Arduino Wiring &UWP Lightning Providers

Windows Remote Arduino

Windows Virtual Shields for Arduino

Native

Page 39: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Supported development language/frameworks

Page 40: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Out focus today!

Page 41: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Why JavaScript?

Explanation in Bahasa Indonesia: http://andriyadi.me/bandung-iot-developer-day/

Page 42: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

What do you need?

tool for VS

IoT side Desktop side

NTVS IoT

Page 43: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

http://github.com/andriyadi/Win10IoT-AzureIotHub-SmartLamp

Page 44: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core
Page 45: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

run #1 Node.js app

Page 46: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

blink it!

Page 47: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Setup

GPIO 5

Page 48: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Code in Node.js

var http = require('http'), uwp = require("uwp");

//Enables Universal Windows Platform (UWP) "Windows" namespace to be //accessibleuwp.projectNamespace("Windows");

var gpioCtrl = Windows.Devices.Gpio.GpioController.getDefault();var switchPin = gpioCtrl.openPin(5);

//Set pin as outputswitchPin.setDriveMode(Windows.Devices.Gpio.GpioPinDriveMode.output);

var currentValue = Windows.Devices.Gpio.GpioPinValue.high;//Write HIGH value to GPIO PIN 5, to light up the LEDswitchPin.write(currentValue);

uwp.close(); //Call this when all UWP usage is completed.

Page 49: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

blink that RGB LED

Page 50: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

RGB LED

All colours are made of RED, GREEN, and BLUE

Page 51: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Connecting to RPi2

26 1913GPIO

Page 52: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Let’s turn on bigger light, a light bulb

Page 53: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

AC solid state switch

To RPi2

GPIO 5

Page 54: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Detect motion using PIR -

GPIO interrupt HOL

Page 55: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Setup

Page 56: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Turn on light bulb when

motion detected

Page 57: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Setup

Page 58: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Capture motion -

Access USB Camera HOL

Page 59: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Setup

Page 60: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

https://github.com/andriyadi/Win10IoT-

AzureIotHub-

SmartLamp/blob/master/SmartLamp/lib/Camera.js

Page 61: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Upload captured photo

to Cloud

Page 62: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core
Page 63: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Architecture

Raspberry Pi 2Web app

Blob Storage

Page 64: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Creating Azure Storage Account

Page 65: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core
Page 66: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Master(µC or µP)

SPI Serial Peripheral Interface

SCLK

MOSI

Slave(display)

Slave(sensor)

MISO

Slave(other µC)CS0CS1CSn

Page 67: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core
Page 68: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

ADC MCP3008 via SPI

Light Sensor

Sound Sensor

Page 69: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

https://github.com/andriyadi/Win10IoT-AzureIotHub-

SmartLamp/blob/master/SmartLamp/lib/ADC.js

Page 70: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Read analog

Page 71: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

….or HOL to turn on the light when it’s dark,

using light sensor

Page 72: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

To turn on the light when it’s dark

Page 73: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Light Sensor

Setup

Page 74: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

All HOLs setup

Sound Sensor

PIR Sensor

Webcam

AC Switch

Light Sensor

Page 75: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

http://github.com/andriyadi/Win10IoT-AzureIotHub-SmartLamp

Page 76: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Closing

Most common RPi features are accessible via Node.js UWP

On-going project, keep checking: https://github.com/ms-iot/ntvsiot

Page 77: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Custom IoT/hardware for your startup or any

custom requirements?

[email protected]

Page 78: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Bandung IoT Developer Day ep. 2 News

http://edu.dycode.co.id/2016/02/bdgiotdevday-ep2/

Page 79: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

http://edu.dycode.co.id |

[email protected]

a bit of ads…

Page 80: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

100+ seminars, workshops, trainings delivered

Delivered to 20+ communities, organisations, campuses

Next event could be your event!

Just drop us a message:http://edu.dycode.co.id | [email protected]

Page 81: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

+ + [Obj-C]

+

Page 82: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

+

Page 83: Hands-on Labs: Raspberry Pi 2 + Windows 10 IoT Core

Thanks!

Andri Yadi

Email — a at dycode dot com

twitter — @andri_yadi

www — andriyadi.me

github — github.com/andriyadi