68
abusing phones to make the internet of things Jan Jongboom JSConf EU 2014

Abusing phones to make the internet of things - JSConf EU 2014

Embed Size (px)

DESCRIPTION

My talk from JSConf EU 2014 about abusing Firefox OS to make Internet of Things appliances.

Citation preview

Page 1: Abusing phones to make the internet of things - JSConf EU 2014

abusing phonesto make the internet of things

Jan JongboomJSConf EU 2014

Page 2: Abusing phones to make the internet of things - JSConf EU 2014

@janjongboomJan, live in Amsterdam. Work for Telenor, LAAARGE telco. They pay me to work on Firefox OS.

Page 3: Abusing phones to make the internet of things - JSConf EU 2014

@janjongboomJan, live in Amsterdam. Work for Telenor, LAAARGE telco. They pay me to work on Firefox OS.

Page 4: Abusing phones to make the internet of things - JSConf EU 2014

Let me start w/ confession... Before this talk I never owned a screwdriver. That’s a dangerous road when doing a hardware talk.

Page 5: Abusing phones to make the internet of things - JSConf EU 2014

First screwdriver ever!

Let me start w/ confession... Before this talk I never owned a screwdriver. That’s a dangerous road when doing a hardware talk.

Page 6: Abusing phones to make the internet of things - JSConf EU 2014

Maker movement is

EVERYWHERE(Kickstarter, spaces, fairs, Wired)

These days hardware is totally coming back. Maker movement is everywhere. Can buy all stuff on Kickstarter, iot, etc. Even on cover of Wired.

Page 7: Abusing phones to make the internet of things - JSConf EU 2014

Reason: Arduino & Raspberry boards that can connect ordinary stuff. Amazing for building new stuff. Phone sensors can be attached, low cost because huge volume.

Page 8: Abusing phones to make the internet of things - JSConf EU 2014

Now one big problem for people that hardware-challenged like me. I don’t wanna do stuff like this, but still want to make things.

Page 9: Abusing phones to make the internet of things - JSConf EU 2014

€ 34,99Also: stuff is expensive. Get a TFT display for a Rasperry Pi for 35 euro

Page 10: Abusing phones to make the internet of things - JSConf EU 2014

€ 25,-

While you can get a FULL phone for 25?!

Page 11: Abusing phones to make the internet of things - JSConf EU 2014

So let’s make some cool shit. This is the Geeksphone Peak. It just has normal phone features. Compared to 25$ it has 1 camera more & 3G instead of 2g. It can run Firefox OS that’s nice.

Page 12: Abusing phones to make the internet of things - JSConf EU 2014

Bluetooth, WiFi, 3G,2 Cameras, GPS,

qHD touch screen

So let’s make some cool shit. This is the Geeksphone Peak. It just has normal phone features. Compared to 25$ it has 1 camera more & 3G instead of 2g. It can run Firefox OS that’s nice.

Page 13: Abusing phones to make the internet of things - JSConf EU 2014

Bluetooth, WiFi, 3G,2 Cameras, GPS,

qHD touch screen

So let’s make some cool shit. This is the Geeksphone Peak. It just has normal phone features. Compared to 25$ it has 1 camera more & 3G instead of 2g. It can run Firefox OS that’s nice.

Page 14: Abusing phones to make the internet of things - JSConf EU 2014

From code perspective it looks like this: kernel, Gecko, UI. We don’t need a UI for IoT things. So let’s strip it off. What do we have: phone chipset + JS bindings to everything (OMG AWESOME)

Page 15: Abusing phones to make the internet of things - JSConf EU 2014

LinuxKernel

From code perspective it looks like this: kernel, Gecko, UI. We don’t need a UI for IoT things. So let’s strip it off. What do we have: phone chipset + JS bindings to everything (OMG AWESOME)

Page 16: Abusing phones to make the internet of things - JSConf EU 2014

LinuxKernel

Gecko

From code perspective it looks like this: kernel, Gecko, UI. We don’t need a UI for IoT things. So let’s strip it off. What do we have: phone chipset + JS bindings to everything (OMG AWESOME)

Page 17: Abusing phones to make the internet of things - JSConf EU 2014

LinuxKernel

Gecko HTML5UI

From code perspective it looks like this: kernel, Gecko, UI. We don’t need a UI for IoT things. So let’s strip it off. What do we have: phone chipset + JS bindings to everything (OMG AWESOME)

Page 18: Abusing phones to make the internet of things - JSConf EU 2014

LinuxKernel

Gecko HTML5UI

Has all phone APIs in JS

From code perspective it looks like this: kernel, Gecko, UI. We don’t need a UI for IoT things. So let’s strip it off. What do we have: phone chipset + JS bindings to everything (OMG AWESOME)

Page 19: Abusing phones to make the internet of things - JSConf EU 2014

LinuxKernel

Gecko

Has all phone APIs in JS

From code perspective it looks like this: kernel, Gecko, UI. We don’t need a UI for IoT things. So let’s strip it off. What do we have: phone chipset + JS bindings to everything (OMG AWESOME)

Page 20: Abusing phones to make the internet of things - JSConf EU 2014

That is awesome.

Page 21: Abusing phones to make the internet of things - JSConf EU 2014

Only thing is that we still have a body around the phone. Let’s remove that.

Page 22: Abusing phones to make the internet of things - JSConf EU 2014

Remove screws and open le phone.

Page 23: Abusing phones to make the internet of things - JSConf EU 2014

We have SIM card, SD card, screen connector, back camera, flash, touchscreen connector

Page 24: Abusing phones to make the internet of things - JSConf EU 2014

We have SIM card, SD card, screen connector, back camera, flash, touchscreen connector

Page 25: Abusing phones to make the internet of things - JSConf EU 2014

We have SIM card, SD card, screen connector, back camera, flash, touchscreen connector

Page 26: Abusing phones to make the internet of things - JSConf EU 2014

We have SIM card, SD card, screen connector, back camera, flash, touchscreen connector

Page 27: Abusing phones to make the internet of things - JSConf EU 2014

We have SIM card, SD card, screen connector, back camera, flash, touchscreen connector

Page 28: Abusing phones to make the internet of things - JSConf EU 2014

We have SIM card, SD card, screen connector, back camera, flash, touchscreen connector

Page 29: Abusing phones to make the internet of things - JSConf EU 2014

We have SIM card, SD card, screen connector, back camera, flash, touchscreen connector

Page 30: Abusing phones to make the internet of things - JSConf EU 2014

Camera can click it out. Have standard connectors. Very awesome

Page 31: Abusing phones to make the internet of things - JSConf EU 2014

Camera can click it out. Have standard connectors. Very awesome

Page 32: Abusing phones to make the internet of things - JSConf EU 2014

There is also this thing. It does radio communication. Also need it. I don’t what this is, I just ripped it off and it still works.

Page 33: Abusing phones to make the internet of things - JSConf EU 2014

So we are left with this. Printboard, radio and camera.

Page 34: Abusing phones to make the internet of things - JSConf EU 2014

I also wanted to reuse the touchscreen.

Page 35: Abusing phones to make the internet of things - JSConf EU 2014

So i started fiddling with screwdriver as these things are glued together

Page 36: Abusing phones to make the internet of things - JSConf EU 2014

Didnt end so well

Page 37: Abusing phones to make the internet of things - JSConf EU 2014

So I figured just detach the touchscreen connector.

Page 38: Abusing phones to make the internet of things - JSConf EU 2014

Didnt work out that well either.

Page 39: Abusing phones to make the internet of things - JSConf EU 2014

Problem: no Wifi... These paper thingies are apparently antenna’s OMG

Page 40: Abusing phones to make the internet of things - JSConf EU 2014

So some tape and all is well.

Page 41: Abusing phones to make the internet of things - JSConf EU 2014

So now we have super cool system on a chip 3/4 of a creditcard.

Page 42: Abusing phones to make the internet of things - JSConf EU 2014

LinuxKernel

Gecko

Has all phone APIs in JS

Now we can run cooler shit on top of it. As I have a big ego I called it JanOS

Page 43: Abusing phones to make the internet of things - JSConf EU 2014

LinuxKernel

Gecko JanOS

Has all phone APIs in JS

Now we can run cooler shit on top of it. As I have a big ego I called it JanOS

Page 44: Abusing phones to make the internet of things - JSConf EU 2014

LinuxKernel

Gecko JanOS

Has all phone APIs in JS

Now we can run cooler shit on top of it. As I have a big ego I called it JanOS

Page 45: Abusing phones to make the internet of things - JSConf EU 2014

JanOSAlternative to Firefox OS

Some batteries included

Need rooted Firefox OS phone with ADB enabled

So it runs on any Firefox OS enabled phone. It comes with some batteries, like autoconnecting 3G, APN detection, Wifi and camera.

Page 46: Abusing phones to make the internet of things - JSConf EU 2014

Booting / !ashing

$ make reset-phone && adb logcatKeep ur casing intact, don’t need to press battery

Page 47: Abusing phones to make the internet of things - JSConf EU 2014

1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta name="viewport" content="width=device-width, user-scalable=no, 5 initial-scale=1"> 6 <meta charset="utf-8"> 7 8 <script src="js/bootstrap.js"></script> 9 <script defer src="js/camera.js"></script> 10 <script defer src="js/security_cam.js"></script> 11 <script defer src="js/doorbell.js"></script> 12 <script defer src="js/bluetooth.js"></script> 13 <script defer src="js/tracker.js"></script> 14 </head> 16 <body> 17 <h1>OMG WELCOME TO JANOS 1.0!</h1> 18 </body> 19 </html>

So when we start Gecko we boot it into a webpage. Easy easy easy

Page 48: Abusing phones to make the internet of things - JSConf EU 2014

about:app-manager

We can now connect the app manager and execute JS and debug shit. Very cool.

Page 49: Abusing phones to make the internet of things - JSConf EU 2014

Security cameraEvery 5 seconds take photo

Save to storage (4GB!) or SD

Sync with cloud

So let’s look at some cool ways of using this thing. We can make a security cam, easy easy.

Page 50: Abusing phones to make the internet of things - JSConf EU 2014

Taking picture to storage

1 window.camera.takePicture('front').then(function(blob) { 2 var storage = navigator.getDeviceStorage('pictures'); 3 var req = storage.addNamed(blob, 'myawesomepicture.jpg'); 4 req.onsuccess = function() { 5 console.log('Saved on internal storage!'); 6 }; 7 });

Page 51: Abusing phones to make the internet of things - JSConf EU 2014

Taking picture to storage

1 window.camera.takePicture('front').then(function(blob) { 2 var storage = navigator.getDeviceStorage('pictures'); 3 var req = storage.addNamed(blob, 'myawesomepicture.jpg'); 4 req.onsuccess = function() { 5 console.log('Saved on internal storage!'); 6 }; 7 });

Page 52: Abusing phones to make the internet of things - JSConf EU 2014

Taking picture to storage

1 window.camera.takePicture('front').then(function(blob) { 2 var storage = navigator.getDeviceStorage('pictures'); 3 var req = storage.addNamed(blob, 'myawesomepicture.jpg'); 4 req.onsuccess = function() { 5 console.log('Saved on internal storage!'); 6 }; 7 });

Page 53: Abusing phones to make the internet of things - JSConf EU 2014

Taking picture to storage

1 window.camera.takePicture('front').then(function(blob) { 2 var storage = navigator.getDeviceStorage('pictures'); 3 var req = storage.addNamed(blob, 'myawesomepicture.jpg'); 4 req.onsuccess = function() { 5 console.log('Saved on internal storage!'); 6 }; 7 });

Page 54: Abusing phones to make the internet of things - JSConf EU 2014

DoorbellProximity sensor

Ring over bluetooth

Live video streamOr a doorbell over bluetooth. That’s rad.

Page 55: Abusing phones to make the internet of things - JSConf EU 2014

Bluetooth doorbell

1 enableBluetoothAudio('00:0C:8A:75:EF:30').then(function() { 2 window.onuserproximity = function(e) { 3 if (e.near) { 4 var audio = new Audio('/sounds/doorbell.ogg'); 5 audio.play(); 6 } 7 }; 8 });

Pair it, play a soud when user is close to proximity. Truly wireless.

Page 56: Abusing phones to make the internet of things - JSConf EU 2014

Bluetooth doorbell

1 enableBluetoothAudio('00:0C:8A:75:EF:30').then(function() { 2 window.onuserproximity = function(e) { 3 if (e.near) { 4 var audio = new Audio('/sounds/doorbell.ogg'); 5 audio.play(); 6 } 7 }; 8 });

Pair it, play a soud when user is close to proximity. Truly wireless.

Page 57: Abusing phones to make the internet of things - JSConf EU 2014

Bluetooth doorbell

1 enableBluetoothAudio('00:0C:8A:75:EF:30').then(function() { 2 window.onuserproximity = function(e) { 3 if (e.near) { 4 var audio = new Audio('/sounds/doorbell.ogg'); 5 audio.play(); 6 } 7 }; 8 });

Pair it, play a soud when user is close to proximity. Truly wireless.

Page 58: Abusing phones to make the internet of things - JSConf EU 2014

Bluetooth doorbell

1 enableBluetoothAudio('00:0C:8A:75:EF:30').then(function() { 2 window.onuserproximity = function(e) { 3 if (e.near) { 4 var audio = new Audio('/sounds/doorbell.ogg'); 5 audio.play(); 6 } 7 }; 8 });

Pair it, play a soud when user is close to proximity. Truly wireless.

Page 59: Abusing phones to make the internet of things - JSConf EU 2014

Another real life usecase. This is Brian, as you can see Brian is quite the wild boy.

Page 60: Abusing phones to make the internet of things - JSConf EU 2014

Brian

Another real life usecase. This is Brian, as you can see Brian is quite the wild boy.

Page 61: Abusing phones to make the internet of things - JSConf EU 2014

Brian has this tendency to get lost VERY often. In Warsaw he had to sleep on a bench outside because he couldn’t find the apartment. He also never has any power in his phone. Solution: the BrianTracker. No screen, so low battery consumption.

Page 62: Abusing phones to make the internet of things - JSConf EU 2014

Brian has this tendency to get lost VERY often. In Warsaw he had to sleep on a bench outside because he couldn’t find the apartment. He also never has any power in his phone. Solution: the BrianTracker. No screen, so low battery consumption.

Page 63: Abusing phones to make the internet of things - JSConf EU 2014

BrianTracker™2G connection

Connected to push server

Geolocation on request

Brian has this tendency to get lost VERY often. In Warsaw he had to sleep on a bench outside because he couldn’t find the apartment. He also never has any power in his phone. Solution: the BrianTracker. No screen, so low battery consumption.

Page 64: Abusing phones to make the internet of things - JSConf EU 2014

And I can press a button and track him down, just from this small device I put in his coat.

Page 65: Abusing phones to make the internet of things - JSConf EU 2014

OK. DEMO TIME!!111

Page 66: Abusing phones to make the internet of things - JSConf EU 2014

Get hacking

Alright, this is cool and low budget, but START HACKING. Only way to really feel the powerz of hardware. Write your own scripts and make stuff. Yay. ZTE Open C is 69$ and can be rooted.

Page 67: Abusing phones to make the internet of things - JSConf EU 2014

Get hackingGrab a rootable FxOS phone

Crack it open

Write your own scripts

PROFIT!

Alright, this is cool and low budget, but START HACKING. Only way to really feel the powerz of hardware. Write your own scripts and make stuff. Yay. ZTE Open C is 69$ and can be rooted.

Page 68: Abusing phones to make the internet of things - JSConf EU 2014

Thank you!http://janjongboom.com

THANKS!