raspberry pi 2 + windows 10 iot core + node.js

Post on 11-Jan-2017

2.117 Views

Category:

Software

6 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Ep.1 Developing for IoT with Web Technologies

Andri YadiCEO, DyCode

sponsored by

organized by

IoT4Bdg

supported by

Raspberry Pi 2 + Windows 10 IoT Core + Node.js

Let’s talk about…

Andri Yadi

@andri_yadi | a at dycode dot com

http://andriyadi.me

CEO of

CEO of

Been coding in awesome languages/Frameworks for 18 years

QBasic, Pascal, c, C++, Java, PHP, Bash, C#, Visual Basic, HTML, JavaScript, Python, Objective-C, Swift

.NET, Qt/QML, Java ME/EE/SE, Android SDK, iOS SDK, Node.js, Arduino

8 years in a row

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

Co-creator of

Inside

Inside

Disclaimer

Let’s have Fun today!

Disclaimer

I’ll do More demo, less Slides

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

New Comer

Windows 10 IoT Core on Raspberry Pi 2

Windows 10 IoT Core Supported boards

Raspberry Pi 2 Minnowboard Max

What to do after install Windows 10 IoT Core?

Code it!

Supported development paths

Arduino Wiring &UWP Lightning Providers

Windows Remote Arduino

Windows Virtual Shields for ArduinoNative

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

DemoDon’t blink!

Setup

GPIO 5

Code in Node.jsvarhttp=require('http'),uwp=require("uwp");

//EnablesUniversalWindowsPlatform(UWP)"Windows"namespacetobe //accessibleuwp.projectNamespace("Windows");

vargpioCtrl=Windows.Devices.Gpio.GpioController.getDefault();varswitchPin=gpioCtrl.openPin(5);

//SetpinasoutputswitchPin.setDriveMode(Windows.Devices.Gpio.GpioPinDriveMode.output);varcurrentValue=Windows.Devices.Gpio.GpioPinValue.high;//WriteHIGHvaluetoGPIOPIN5,tolightuptheLEDswitchPin.write(currentValue);

uwp.close();//CallthiswhenallUWPusageiscompleted.

DemoSmiiiile!

Display smiley on LED matrix

Setup

Let there be a lightLet’s turn on bigger light, a light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date: 7-Oct-2015 Sheet ofFile: D:\DYCODE\Layout PCB\Demo.ddb Drawn By:

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

AC lamp switch setup

AC Switch

Motion detectedGPIO interrupt demo

Setup

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date: 7-Oct-2015 Sheet ofFile: D:\DYCODE\Layout PCB\Demo.ddb Drawn By:

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Motion CapturedAccess USB Camera

Setup

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date: 7-Oct-2015 Sheet ofFile: D:\DYCODE\Layout PCB\Demo.ddb Drawn By:

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

I made a library to Access Webcam using Node.js !

https://github.com/andriyadi/Win10IoT-AzureIotHub-SmartLamp/blob/master/SmartLamp/

lib/Camera.js

Control the light from Mars….or from anywhere connected to internet

We need Cloud

for that…

MQTT

Scenario

Raspberry Pi 2Web/desktop app

IoT Hub

AMQP/HTTP

AMQP/HTTP

Scenario

MQTT

Raspberry Pi 2Web dashboard

IoT Hub

Photo storageStorage

Beyond BITS

Master (µC or µP)

SPI Serial Peripheral Interface

SCLK

MOSI

Slave (display)

Slave (sensor)

MISO

Slave (other µC)CS0CS1CSn

Raspberry Pi can’t read analog

as we know

ADC MCP3008 via SPI

Light Sensor

Habis gelap, terbitlah terang….or demo to turn on the light when it’s dark,

using light sensor

I made a library to read from MCP3008https://github.com/andriyadi/Win10IoT-

AzureIotHub-SmartLamp/blob/master/SmartLamp/lib/MCP3008.js

All demo setup

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date: 7-Oct-2015 Sheet ofFile: D:\DYCODE\Layout PCB\Demo.ddb Drawn By:

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Sound Sensor

Current Sensor

PIR Sensor

Webcam

AC Switch

Light Sensor

Summary

Most common RPi features are accessible via Node.js UWP On-going project, keep checking: https://github.com/ms-iot/ntvsiot All of my demo is here: https://github.com/andriyadi/Win10IoT-AzureIotHub-SmartLamp

Custom IoT/hardware for your startup or any custom requirements?

office@dycode.com

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

a bit of ads…

We contribute100+ 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

Our classes

+ + [Obj-C]

+

Opening soon…

+

Thanks!Andri YadiEmail — a at dycode dot com twitter — @andri_yadi www — andriyadi.me github — github.com/andriyadi

top related