Ep.1 Developing for IoT with Web Technologies
Andri Yadi
CEO, 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 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
Demo
Don’t blink!
Setup
GPIO 5
Code in Node.js
var	http	=	require('http')	
				,	uwp	=	require("uwp");	
//Enables	Universal	Windows	Platform	(UWP)	"Windows"	namespace	to	be	

//accessible	
uwp.projectNamespace("Windows");	
var	gpioCtrl	=	Windows.Devices.Gpio.GpioController.getDefault();	
var	switchPin	=	gpioCtrl.openPin(5);	
//Set	pin	as	output	
switchPin.setDriveMode(Windows.Devices.Gpio.GpioPinDriveMode.output);	
					
var	currentValue	=	Windows.Devices.Gpio.GpioPinValue.high;	
//Write	HIGH	value	to	GPIO	PIN	5,	to	light	up	the	LED	
switchPin.write(currentValue);	
uwp.close();	//Call	this	when	all	UWP	usage	is	completed.
Demo
Smiiiile!
Display smiley on LED matrix
Setup
Let there be a light
Let’s turn on bigger light, a light bulb
Q1
TRIAC
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 detected
GPIO interrupt demo
Setup
D
C
B
A
Title
NumbeSize
A4
Date: 7-Oct-20
File: D:DYCO
Q1
TRIAC
U1
OPTOTRIAC_1
R2
1K
R1
470
LAMP
AC PLUG
GPIO
Motion Captured
Access USB Camera
Setup
D
C
B
A
Title
NumbeSize
A4
Date: 7-Oct-20
File: D:DYCO
Q1
TRIAC
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 2
Web/desktop app
IoT Hub
AMQP/HTTP
AMQP/HTTP
Scenario
MQTT
Raspberry Pi 2 Web dashboard
IoT Hub
Photo storage
Storage
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 MCP3008
https://github.com/andriyadi/Win10IoT-
AzureIotHub-SmartLamp/blob/master/SmartLamp/
lib/MCP3008.js
All demo setup
C
B
A
Q1
TRIAC
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 contribute
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
Our classes
+ + [Obj-C]
+
Opening soon…
+
Thanks!
Andri Yadi
Email — a at dycode dot com

twitter — @andri_yadi
www — andriyadi.me 

github — github.com/andriyadi

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