122
abusing phones DAHO.AM 12 June 2015 to make the internet of things @janjongboom

DAHO.AM 2015 - Abusing phones to make the internet of things

Embed Size (px)

Citation preview

Page 1: DAHO.AM 2015 - Abusing phones to make the internet of things

abusing phones

DAHO.AM 12 June 2015

to make the internet of things

@janjongboom

Page 2: DAHO.AM 2015 - Abusing phones to make the internet of things

abusing phones

DAHO.AM 12 June 2015

to make the internet of things

@janjongboom

Page 3: DAHO.AM 2015 - Abusing phones to make the internet of things

@janjongboom

Telenor R&D

Mozilla things

Page 4: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 5: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 6: DAHO.AM 2015 - Abusing phones to make the internet of things

I hate JavaScript!

Page 7: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 8: DAHO.AM 2015 - Abusing phones to make the internet of things

VBScript <3 <3 <3

Page 9: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 10: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 11: DAHO.AM 2015 - Abusing phones to make the internet of things

Before mobile revolution…Limited input methods

Page 12: DAHO.AM 2015 - Abusing phones to make the internet of things

Vibration sensor?

Page 13: DAHO.AM 2015 - Abusing phones to make the internet of things

Accelerometer?

Page 14: DAHO.AM 2015 - Abusing phones to make the internet of things

Accelerometer?

Page 15: DAHO.AM 2015 - Abusing phones to make the internet of things

Proximity Accelerometer Ambient Light Magnetometer Gyroscope Humidity Ambient Temperature Pressure Battery Cameras

Page 16: DAHO.AM 2015 - Abusing phones to make the internet of things

Bend sensor

Page 17: DAHO.AM 2015 - Abusing phones to make the internet of things

Internet of Things

Page 18: DAHO.AM 2015 - Abusing phones to make the internet of things

Moves IHR SleepCycle

Page 19: DAHO.AM 2015 - Abusing phones to make the internet of things

BORING!

Page 20: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 21: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 22: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 23: DAHO.AM 2015 - Abusing phones to make the internet of things

Device LightReal purpose: adjust brightness

Page 24: DAHO.AM 2015 - Abusing phones to make the internet of things

MusicTheremin is instrument

Use device light as tone frequency

Wave your hands and magic!

Page 25: DAHO.AM 2015 - Abusing phones to make the internet of things

MusicTheremin is instrument

Use device light as tone frequency

Wave your hands and magic!

Page 26: DAHO.AM 2015 - Abusing phones to make the internet of things

1 var context = new AudioContext(); 2 var oscillator = context.createOscillator(); 3 oscillator.connect(context.destination); 4 oscillator.start(0); 5 6 window.addEventListener('devicelight', function(e) { 7 oscillator.frequency.value = e.value * 10; 8 });

Music

Page 27: DAHO.AM 2015 - Abusing phones to make the internet of things

GyroscopeReal purpose: rotate screen

Page 28: DAHO.AM 2015 - Abusing phones to make the internet of things

GyroscopeReal purpose: rotate screen

Page 29: DAHO.AM 2015 - Abusing phones to make the internet of things

Track real life movementDraw 3D model of phones

Measure gyroscope data

Show real life state on screen

Page 30: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 31: DAHO.AM 2015 - Abusing phones to make the internet of things

Track real life movement 1 var front = new THREE.MeshBasicMaterial({ map: loadTexture('front.jpg') }); 2 var back = new THREE.MeshBasicMaterial({ map: loadTexture('back.jpg') }); 3 var border = new THREE.MeshBasicMaterial({ color: 0xffe04526 }); 4 5 var materials = [ border, border, border, 6 border, front, back ]; 7 8 var geometry = new THREE.BoxGeometry(2, 4, 0.3); 9 var cube = new THREE.Mesh(geometry, 10 new THREE.MeshFaceMaterial(materials)); 11 scene.add(cube);

Page 32: DAHO.AM 2015 - Abusing phones to make the internet of things

Track real life movement

1 window.addEventListener('deviceorientation', function(e) { 2 cube.rotation.x = e.beta / 60; 3 cube.rotation.y = e.gamma / 60; 4 cube.rotation.z = e.alpha / 60; 5 });

Page 33: DAHO.AM 2015 - Abusing phones to make the internet of things

AccelerometerReal purpose: Turn to mute

Page 34: DAHO.AM 2015 - Abusing phones to make the internet of things

Juggling visualizerMeasure z-forces on device

Plot it in graph over time

Juggle with multiple devices

Page 35: DAHO.AM 2015 - Abusing phones to make the internet of things

Juggling visualizer

1 window.addEventListener('devicemotion', function(e) { 2 var serie = getGraphSerieForDevice(e.data.deviceId); 3 serie.addPoint([ e.data.timestamp, Math.abs(e.data.z) ]); 4 });

Page 36: DAHO.AM 2015 - Abusing phones to make the internet of things

Weight scale

Page 37: DAHO.AM 2015 - Abusing phones to make the internet of things

Computer generated

music

Page 38: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 39: DAHO.AM 2015 - Abusing phones to make the internet of things

http://gibber.mat.ucsb.edu/

Page 40: DAHO.AM 2015 - Abusing phones to make the internet of things

1 a = Drums('x*o*x*o-')

Gibber

Page 41: DAHO.AM 2015 - Abusing phones to make the internet of things

1 a = Drums('x*o*x*o-')

Gibber

Page 42: DAHO.AM 2015 - Abusing phones to make the internet of things

Gibber 1 a = Drums('x*o*x*o-') 2 a.pitch = 0.5

Page 43: DAHO.AM 2015 - Abusing phones to make the internet of things

Gibber 1 a = Drums('x*o*x*o-') 2 a.pitch = 0.5

Page 44: DAHO.AM 2015 - Abusing phones to make the internet of things

Gibber 1 a = Drums('x*o*x*o-') 2 3 speak = Speak({ pitch: 70, wordgap:5 }) 4 .say.seq( 5 ['Mu', 'nich', 'Mu', 'Mu', 'nich'], 6 [1/2, 1/2, 1/4, 1/4, 1/2] 7 ) 8 9 speak.pitch.seq( [1,.8,1.2].rnd() ) 10 Clock.bpm = 120;

Page 45: DAHO.AM 2015 - Abusing phones to make the internet of things

Gibber 1 a = Drums('x*o*x*o-') 2 3 speak = Speak({ pitch: 70, wordgap:5 }) 4 .say.seq( 5 ['Mu', 'nich', 'Mu', 'Mu', 'nich'], 6 [1/2, 1/2, 1/4, 1/4, 1/2] 7 ) 8 9 speak.pitch.seq( [1,.8,1.2].rnd() ) 10 Clock.bpm = 120;

Page 46: DAHO.AM 2015 - Abusing phones to make the internet of things

Gibber 1 a = Drums('x*o*x*o-') 2 3 speak = Speak({ pitch: 70, wordgap:5 }) 4 .say.seq( 5 ['Mu', 'nich'], 6 [1/4, 1/4, 1/4, 1/2].rnd() 7 ) 8 9 speak.pitch.seq( [1,.8,1.2].rnd() ) 10 Clock.bpm = 120;

Page 47: DAHO.AM 2015 - Abusing phones to make the internet of things

Gibber 1 a = Drums('x*o*x*o-') 2 3 speak = Speak({ pitch: 70, wordgap:5 }) 4 .say.seq( 5 ['Mu', 'nich'], 6 [1/4, 1/4, 1/4, 1/2].rnd() 7 ) 8 9 speak.pitch.seq( [1,.8,1.2].rnd() ) 10 Clock.bpm = 120;

Page 48: DAHO.AM 2015 - Abusing phones to make the internet of things

Gibber 1 a = Drums('x*o*x*o-') 2 3 speak = Speak({ pitch: 70, wordgap:5 }) 4 .say.seq( 5 ['Mu', 'nich'], 6 [1/4, 1/4, 1/4, 1/2].rnd() 7 ) 8 9 speak.pitch.seq( [1,.8,1.2].rnd() ) 10 Clock.bpm = 120;

Page 49: DAHO.AM 2015 - Abusing phones to make the internet of things

So much phones!

Page 50: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 51: DAHO.AM 2015 - Abusing phones to make the internet of things

Gibber

Page 52: DAHO.AM 2015 - Abusing phones to make the internet of things

Gibber 1 a = Drums('x*o*x*o-') 2 a.pitch = Phone.X

https://github.com/janjongboom/jsconf-us/blob/master/gibber/gibber-phone.js

Page 53: DAHO.AM 2015 - Abusing phones to make the internet of things

Gibber 1 a = Drums('x*o*x*o-') 2 a.pitch = Phone.X

https://github.com/janjongboom/jsconf-us/blob/master/gibber/gibber-phone.js

Page 54: DAHO.AM 2015 - Abusing phones to make the internet of things

Getting data out of thereal world

Page 55: DAHO.AM 2015 - Abusing phones to make the internet of things

Bluetooth beaconsBroadcasting their existence

Page 56: DAHO.AM 2015 - Abusing phones to make the internet of things

Bluetooth beaconsLong battery life

Cheap URLs, sensor values, etc.

Page 57: DAHO.AM 2015 - Abusing phones to make the internet of things

Coming to a web browser near youhttps://bugzilla.mozilla.org/show_bug.cgi?id=1063444

Page 58: DAHO.AM 2015 - Abusing phones to make the internet of things

Coming to a web browser near youhttps://bugzilla.mozilla.org/show_bug.cgi?id=1063444

Page 59: DAHO.AM 2015 - Abusing phones to make the internet of things

Scanning beacons 1 var adapter = navigator.mozBluetooth.defaultAdapter 2 adapter.startLeScan([]).then(handle => { 3 handle.ondevicefound = e => { 4 // handle e.scanRecord 5 } 6 7 setTimeout(() => { 8 adapter.stopLeScan(handle) 9 }, 5000) 10 }, err => console.error(err))

Page 60: DAHO.AM 2015 - Abusing phones to make the internet of things

Scanning beacons 1 var adapter = navigator.mozBluetooth.defaultAdapter 2 adapter.startLeScan([]).then(handle => { 3 handle.ondevicefound = e => { 4 // handle e.scanRecord 5 } 6 7 setTimeout(() => { 8 adapter.stopLeScan(handle) 9 }, 5000) 10 }, err => console.error(err))

Page 61: DAHO.AM 2015 - Abusing phones to make the internet of things

Scanning beacons 1 var adapter = navigator.mozBluetooth.defaultAdapter 2 adapter.startLeScan([]).then(handle => { 3 handle.ondevicefound = e => { 4 // handle e.scanRecord 5 } 6 7 setTimeout(() => { 8 adapter.stopLeScan(handle) 9 }, 5000) 10 }, err => console.error(err))

Page 62: DAHO.AM 2015 - Abusing phones to make the internet of things

Scanning beacons 1 var adapter = navigator.mozBluetooth.defaultAdapter 2 adapter.startLeScan([]).then(handle => { 3 handle.ondevicefound = e => { 4 // handle e.scanRecord 5 } 6 7 setTimeout(() => { 8 adapter.stopLeScan(handle) 9 }, 5000) 10 }, err => console.error(err))

Page 63: DAHO.AM 2015 - Abusing phones to make the internet of things

Scanning beacons 1 var adapter = navigator.mozBluetooth.defaultAdapter 2 adapter.startLeScan([]).then(handle => { 3 handle.ondevicefound = e => { 4 // handle e.scanRecord 5 } 6 7 setTimeout(() => { 8 adapter.stopLeScan(handle) 9 }, 5000) 10 }, err => console.error(err))

Page 64: DAHO.AM 2015 - Abusing phones to make the internet of things

JavaScript baby monitorTag your baby with a phone

Get three beacons Some math

Page 65: DAHO.AM 2015 - Abusing phones to make the internet of things

JavaScript baby monitorTag your baby with a phone

Get three beacons Some math

Page 66: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 67: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 68: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 69: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 70: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 71: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 72: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 73: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 74: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 75: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 76: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 77: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 78: DAHO.AM 2015 - Abusing phones to make the internet of things

Linux Kernel

Page 79: DAHO.AM 2015 - Abusing phones to make the internet of things

Linux Kernel

Gecko

Page 80: DAHO.AM 2015 - Abusing phones to make the internet of things

Linux Kernel

Gecko HTML5UI

Page 81: DAHO.AM 2015 - Abusing phones to make the internet of things

Linux Kernel

Gecko HTML5UI

Has all phone APIs in JS

Page 82: DAHO.AM 2015 - Abusing phones to make the internet of things

Linux Kernel

Gecko

Has all phone APIs in JS

Page 83: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 84: DAHO.AM 2015 - Abusing phones to make the internet of things

First screwdriver ever!

Page 85: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 86: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 87: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 88: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 89: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 90: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 91: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 92: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 93: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 94: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 95: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 96: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 97: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 98: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 99: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 100: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 101: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 102: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 103: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 104: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 105: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 106: DAHO.AM 2015 - Abusing phones to make the internet of things

Booting / flashing

Page 107: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 108: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 109: DAHO.AM 2015 - Abusing phones to make the internet of things

Linux Kernel

Gecko

Has all phone APIs in JS

Page 110: DAHO.AM 2015 - Abusing phones to make the internet of things

Linux Kernel

Gecko JanOS

Has all phone APIs in JS

Page 111: DAHO.AM 2015 - Abusing phones to make the internet of things

Linux Kernel

Gecko JanOS

Has all phone APIs in JS

Page 112: DAHO.AM 2015 - Abusing phones to make the internet of things
Page 113: DAHO.AM 2015 - Abusing phones to make the internet of things

JanOSFork of Firefox OS For phones & Rpi

Runs without display

Page 114: DAHO.AM 2015 - Abusing phones to make the internet of things

1 var conn = navigator.mozMobileConnections[0]; 2 conn.addEventListener('voicechange', function vc() { 3 if (conn.voice.connected) { 4 conn.removeEventListener('voicechange', vc); 5 6 var req = navigator.mozMobileMessage 7 .send('+31612345678', 'Hello from JanOS!'); 8 req.onsuccess = function() { 9 console.log('Message sent successfully'); 10 }; 11 req.onerror = function() { 12 console.error('Could not send SMS', req.error); 13 }; 14 } 15 });

Page 115: DAHO.AM 2015 - Abusing phones to make the internet of things

1 var conn = navigator.mozMobileConnections[0]; 2 conn.addEventListener('voicechange', function vc() { 3 if (conn.voice.connected) { 4 conn.removeEventListener('voicechange', vc); 5 6 var req = navigator.mozMobileMessage 7 .send('+31612345678', 'Hello from JanOS!'); 8 req.onsuccess = function() { 9 console.log('Message sent successfully'); 10 }; 11 req.onerror = function() { 12 console.error('Could not send SMS', req.error); 13 }; 14 } 15 });

Page 116: DAHO.AM 2015 - Abusing phones to make the internet of things

1 var conn = navigator.mozMobileConnections[0]; 2 conn.addEventListener('voicechange', function vc() { 3 if (conn.voice.connected) { 4 conn.removeEventListener('voicechange', vc); 5 6 var req = navigator.mozMobileMessage 7 .send('+31612345678', 'Hello from JanOS!'); 8 req.onsuccess = function() { 9 console.log('Message sent successfully'); 10 }; 11 req.onerror = function() { 12 console.error('Could not send SMS', req.error); 13 }; 14 } 15 });

Page 117: DAHO.AM 2015 - Abusing phones to make the internet of things

1 var conn = navigator.mozMobileConnections[0]; 2 conn.addEventListener('voicechange', function vc() { 3 if (conn.voice.connected) { 4 conn.removeEventListener('voicechange', vc); 5 6 var req = navigator.mozMobileMessage 7 .send('+31612345678', 'Hello from JanOS!'); 8 req.onsuccess = function() { 9 console.log('Message sent successfully'); 10 }; 11 req.onerror = function() { 12 console.error('Could not send SMS', req.error); 13 }; 14 } 15 });

Page 118: DAHO.AM 2015 - Abusing phones to make the internet of things

1 var conn = navigator.mozMobileConnections[0]; 2 conn.addEventListener('voicechange', function vc() { 3 if (conn.voice.connected) { 4 conn.removeEventListener('voicechange', vc); 5 6 var req = navigator.mozMobileMessage 7 .send('+31612345678', 'Hello from JanOS!'); 8 req.onsuccess = function() { 9 console.log('Message sent successfully'); 10 }; 11 req.onerror = function() { 12 console.error('Could not send SMS', req.error); 13 }; 14 } 15 });

Page 119: DAHO.AM 2015 - Abusing phones to make the internet of things

-

Page 120: DAHO.AM 2015 - Abusing phones to make the internet of things

-

Page 121: DAHO.AM 2015 - Abusing phones to make the internet of things

Get hacking!Grab a phone that has latest Chrome / Firefox

Use that sensor data

Think outside the box

Or buy a ZTE Open C for 60 euro's and break it!

Page 122: DAHO.AM 2015 - Abusing phones to make the internet of things

Thank you!http://janjongboom.com

janos.io github.com/janjongboom/(jsconf-asia|jsconf-us)