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

Post on 15-Apr-2017

1.069 views 2 download

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

Welcome to

#BdgIoTDay

sponsored by

organized by

IoT4Bdg

supported by

media partners

http://bit.ly/bdg-iotdevday

Raspberry Pi 2 + Windows 10 IoT Core

Andri Yadi

@andri_yadi | a at dycode dot com

http://andriyadi.me

CEO of

CEO of

8 years in a row

My Experience around Raspberry Pi

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

Co-creator of

Inside

Inside

Raspberry Pi 2

Raspbian

Node.js

Arduino

Windows 10 – at least 10240

Visual Studio 2015 - 14.0.24720.00 Update 1

Developer Mode

:)

What is the Internet of Things (IoT)?

Connectivity Data AnalyticsThings

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

Raspberry Pi 2 & GPIO

Raspberry Pi OS

Windows 10 IoT Core on Raspberry Pi 2

Windows 10 IoT Core Supported boards

Raspberry Pi 2 Minnowboard Max DragonBoard 410c

Out focus today!

Raspberry Pi 2

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

Compatible Hardware

WiFi Dongle Bluetooth Webcam NFC/RFID ADC

install & run Windows 10 IoT Core in Raspberry Pi 2

Windows 10 IoT Core Dashboard

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

Windows 10 IoT Core Dashboard

Select, Download and Install

That easy! Now insert MicroSD to Raspberry Pi 2

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

New device will appear here…

What next after installingWindows 10 IoT Core?

Code it!

Supported development paths

Arduino Wiring &UWP Lightning Providers

Windows Remote Arduino

Windows Virtual Shields for Arduino

Native

Supported development language/frameworks

Out focus today!

Why JavaScript?

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

What do you need?

tool for VS

IoT side Desktop side

NTVS IoT

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

run #1 Node.js app

blink it!

Setup

GPIO 5

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.

blink that RGB LED

RGB LED

All colours are made of RED, GREEN, and BLUE

Connecting to RPi2

26 1913GPIO

Let’s turn on bigger light, a light bulb

AC solid state switch

To RPi2

GPIO 5

Detect motion using PIR -

GPIO interrupt HOL

Setup

Turn on light bulb when

motion detected

Setup

Capture motion -

Access USB Camera HOL

Setup

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

AzureIotHub-

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

Upload captured photo

to Cloud

Architecture

Raspberry Pi 2Web app

Blob Storage

Creating Azure Storage Account

Master(µC or µP)

SPI Serial Peripheral Interface

SCLK

MOSI

Slave(display)

Slave(sensor)

MISO

Slave(other µC)CS0CS1CSn

ADC MCP3008 via SPI

Light Sensor

Sound Sensor

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

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

Read analog

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

using light sensor

To turn on the light when it’s dark

Light Sensor

Setup

All HOLs setup

Sound Sensor

PIR Sensor

Webcam

AC Switch

Light Sensor

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

Closing

Most common RPi features are accessible via Node.js UWP

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

Custom IoT/hardware for your startup or any

custom requirements?

office@dycode.com

Bandung IoT Developer Day ep. 2 News

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

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

edu@dycode.com

a bit of ads…

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 | edu@dycode.com

+ + [Obj-C]

+

+

Thanks!

Andri Yadi

Email — a at dycode dot com

twitter — @andri_yadi

www — andriyadi.me

github — github.com/andriyadi