Slide 1

Slide 1 text

Jav a S c r i p t fo r t h e P hy s i c a l Wo r l d P E A R L C H E N J AVA S C R I P T O P E N D AY 2 0 1 5

Slide 2

Slide 2 text

He l l o ! My Na m e I s

Slide 3

Slide 3 text

Only some of my microcontrollers…

Slide 4

Slide 4 text

computer icon by Juan Pablo Bravo & painting icon by Mikael Westman (via thenounproject.com) X

Slide 5

Slide 5 text

computer icon by Juan Pablo Bravo & modified classroom icon by Rafael Farias Leão (via thenounproject.com)

Slide 6

Slide 6 text

(fly)light LED sculpture by Pearl Chen

Slide 7

Slide 7 text

(fly)light LEDs by Pearl Chen

Slide 8

Slide 8 text

(fly)light circuits by Pearl Chen

Slide 9

Slide 9 text

A few websites I've done as a front end developer

Slide 10

Slide 10 text

Two of my HTML5Rocks articles.

Slide 11

Slide 11 text

I mostly work on IoT hackathon on boarding materials.

Slide 12

Slide 12 text

W H Y A M I I N T E R E S T E D ? • sense the world around me → CONTEXT is KING • add internet: dumb things → smart things • screen-less experiences / ambient notifications • body and location awareness → wearables

Slide 13

Slide 13 text

Haptic navigator prototype by Pearl Chen, Connie Leung, Harold Treen

Slide 14

Slide 14 text

2 T R U T H S Hardware
 is becoming more like
 software. Hardware
 is hard.

Slide 15

Slide 15 text

Basic Stamp 1975: Microchip PIC example Arduino shield Arduino

Slide 16

Slide 16 text

stacked shields (via wikipedia)

Slide 17

Slide 17 text

H O W D O YO U C H O O S E ? • Price?
 $100+, < $100 USD, < $80, < $50, < $30, < $20, < $10 • Form factor?
 Dedicated space, tight space, wearable • Connectivity?
 Ethernet, Wi-Fi, Bluetooth, BLE, none • Programming language?
 Arduino, JavaScript, C++, Python, no programming • Run-time environment and processing speed?
 Arduino/Embedded vs. Linux • Community?
 Can you get help when you need it?

Slide 18

Slide 18 text

2 PAT H S F O R J AVA S C R I P T- C O M PAT I B L E B O A R D S Linux-based
 operating systems JavaScript-only boards

Slide 19

Slide 19 text

Jav a S c r i p t - o n l y b o a r d s

Slide 20

Slide 20 text

T E S S E L

Slide 21

Slide 21 text

E S P R U I N O

Slide 22

Slide 22 text

L i n u x - b a s e d 
 o p e r a t i n g s y s t e m s

Slide 23

Slide 23 text

A R D U I N O Y U N

Slide 24

Slide 24 text

R A S P B E R R Y P I

Slide 25

Slide 25 text

I N T E L E D I S O N

Slide 26

Slide 26 text

G e t t i n g s t a r t e d & o t h e r r e s o u rc e s

Slide 27

Slide 27 text

H A C K S T E R .I O

Slide 28

Slide 28 text

I N S T R U C TA B L E S

Slide 29

Slide 29 text

S PA R K F U N

Slide 30

Slide 30 text

A D A F R U I T

Slide 31

Slide 31 text

G R O V E S TA R T E R K I T S

Slide 32

Slide 32 text

W H E R E TO B U Y E L E C T R O N I C S ( I N T O R O N T O )

Slide 33

Slide 33 text

S m a r t C l o c k B u i l t w i t h : No d e J S + I n t e l E d i s o n WA L K T H R O U G H

Slide 34

Slide 34 text

• 500 MHz dual-core, dual-threaded Intel® AtomTM CPU • 32-bit Intel® QuarkTM microcontroller at 100 MHz • 1 GB RAM • 4 GB onboard flash memory • built-in Wi-Fi and Bluetooth 4.0 • Yocto Linux OS

Slide 35

Slide 35 text

It ' s a p o s t a g e - s i z e d c o m p u t e r t h a t c a n c o n t ro l e l e c t r i c i t y. E S S E N T I A L LY…

Slide 36

Slide 36 text

B r e a ko u t b o a r d s A C C E S S I N G G E N E R A L P U R P O S E I N P U T O U T P U T ( G P I O )

Slide 37

Slide 37 text

S e t u p t h e b o a r d G E T T I N G S TA R T E D 1. Connect cables & power up 2. Install USB drivers (if needed) 3. Gain remote command line access of board 4. Update firmware 5. Get board online 6. Install an IDE (optional)

Slide 38

Slide 38 text

C l o c k A C C E S S I N G G E N E R A L P U R P O S E I N P U T O U T P U T ( G P I O ) Google Calendar API 1 0 m i n u t e s u n t i l y o u r m e e t i n g !

Slide 39

Slide 39 text

No d e G o o g l e C a l e n d a r A P I a p p D E S K T O P P R O T OT Y P E Follow the tutorial on Google Developers: 1. Enable Calendar API & download secret.json. 2. Install two Node libraries:
 Google Client Library & Google Auth Library 3. Copy their sample code & run it. 4. Get authorization token.

Slide 40

Slide 40 text

R u n No d e a p p o n b o a r d M I C R O C O N T R O L L E R P O R T Follow my Instructables tutorial from Step 6: 1. Create/import Node app into Intel XDK. 2. Create a package.json
 & install dependencies directly on board. 3. Run Node app using command line. 4. Code Tweak: Update file path references. 5. Get authorization token.

Slide 41

Slide 41 text

A d d e l e c t ro n i c s S O F T WA R E TO C O N T R O L H A R D WA R E Use MRAA & UPM libraries to talk to GPIO pins. • GPIO = General Purpose Input/Output • MRAA = low level library to talk to GPIO • UPM = higher level abstraction library (builds on top of MRAA) for various sensors More info: go.klab.ca/js-grove-samples

Slide 42

Slide 42 text

A d d L C D s c r e e n S O F T WA R E TO C O N T R O L H A R D WA R E Add LCD UPM library: var  jsUpmI2cLcd  =  require  ('jsupm_i2clcd');
 var  lcd  =  new  jsUpmI2cLcd.Jhd1313m1(6,  0x3E,  0x62);
 lcd.setColor(255,  0,  0);
 lcd.setCursor(1,5);
 lcd.write('Hello!');   More info: https://github.com/intel-iot-devkit/upm/ blob/master/examples/javascript/rgb-lcd.js

Slide 43

Slide 43 text

T h e r e s t i s J S c o d e I N T E G R AT I O N

Slide 44

Slide 44 text

S m a r t C l o c k Wa t c h B u i l t w i t h : No d e J S + I n t e l E d i s o n D E M O

Slide 45

Slide 45 text

C O D E T W E A K S Tweaks • update: 
 var lcd = 
 new jsUpmI2cLcd.SSD1308(0, 0x3C); • remove .
 setColor()

Slide 46

Slide 46 text

Re m o t e c a t t o y B u i l t w i t h : No d e J S + E x p r e s s + I n t e l E d i s o n D E M O

Slide 47

Slide 47 text

S c a r e y o u r c a t r e m o t e l y W E B S E R V E R • Express server: http://expressjs.com/starter/hello- world.html • Motor UPM library: https://github.com/intel-iot- devkit/upm/blob/master/examples/javascript/es08a.js

Slide 48

Slide 48 text

TWITTER @PearlChen GOOGLE+ klab.ca/+ P E A R L C H E N T h a n k s !