+ All Categories
Home > Technology > Firebase - realtime backend for mobile app and IoT

Firebase - realtime backend for mobile app and IoT

Date post: 15-Apr-2017
Category:
Upload: andri-yadi
View: 1,684 times
Download: 0 times
Share this document with a friend
55
Transcript
Page 1: Firebase - realtime backend for mobile app and IoT

Game DevFest 2015Jakarta Oct 17 2015 | Surabaya Oct 18 2015

FirebaseRealtime backend for mobile app and IoT

Andri Yadiandri_yadi | a at dycode dot com

httpandriyadime | googlecom+AndriYadi

CEO of

Been coding in awesome languagesFrameworks for 18 years

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

NET QtQML Java MEEESE Android SDK iOS SDK Nodejs Arduino

Who am I around Firebase

How dare I am talking herehellip

Irsquom the user of firebase long before Firebase has order amp Limit feature

Irsquove been using it since Jan 2014

Disclaimer

30 minutes wonrsquot be enough to show how cool Firebase is

What is Firebase

Letrsquos see a Real-World demo

Rather than theoritise about it

Take a photo with DevFest2015

Shared photo will be automatically shown here httpstoryjepretinJepretgdgdevfest2015

Firebase delivers that photo object to browser in realtime

Jepret Cloud Jepret Allegra Jepret Story

Firebase Firebase

Nodejs + MongoDBDeployed on Microsoft Azure

Architecture

Firebase

Realtime Gallery Allegra Machine Jepret Story app

Jepret Cloud

More about Jeprethttpjepretin

Letrsquos see another demo

Typical Firebase Demo

Letrsquos Try something different

todayhellip

Letrsquos Get Physical

todayhellip

Letrsquos light up the LED

My Setup

Circuit

Code

var wpi = require(wiring-pi) wpisetup(gpio)

var ledPin = 26 26 is GPIO pin to LED

wpipinMode(ledPin wpiOUTPUT)

Turn offon the LED directly var ledValue = 1 0 to switch off wpidigitalWrite(ledPin ledValue)

Letrsquos light up the LED via browser

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 2: Firebase - realtime backend for mobile app and IoT

Andri Yadiandri_yadi | a at dycode dot com

httpandriyadime | googlecom+AndriYadi

CEO of

Been coding in awesome languagesFrameworks for 18 years

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

NET QtQML Java MEEESE Android SDK iOS SDK Nodejs Arduino

Who am I around Firebase

How dare I am talking herehellip

Irsquom the user of firebase long before Firebase has order amp Limit feature

Irsquove been using it since Jan 2014

Disclaimer

30 minutes wonrsquot be enough to show how cool Firebase is

What is Firebase

Letrsquos see a Real-World demo

Rather than theoritise about it

Take a photo with DevFest2015

Shared photo will be automatically shown here httpstoryjepretinJepretgdgdevfest2015

Firebase delivers that photo object to browser in realtime

Jepret Cloud Jepret Allegra Jepret Story

Firebase Firebase

Nodejs + MongoDBDeployed on Microsoft Azure

Architecture

Firebase

Realtime Gallery Allegra Machine Jepret Story app

Jepret Cloud

More about Jeprethttpjepretin

Letrsquos see another demo

Typical Firebase Demo

Letrsquos Try something different

todayhellip

Letrsquos Get Physical

todayhellip

Letrsquos light up the LED

My Setup

Circuit

Code

var wpi = require(wiring-pi) wpisetup(gpio)

var ledPin = 26 26 is GPIO pin to LED

wpipinMode(ledPin wpiOUTPUT)

Turn offon the LED directly var ledValue = 1 0 to switch off wpidigitalWrite(ledPin ledValue)

Letrsquos light up the LED via browser

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 3: Firebase - realtime backend for mobile app and IoT

CEO of

Been coding in awesome languagesFrameworks for 18 years

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

NET QtQML Java MEEESE Android SDK iOS SDK Nodejs Arduino

Who am I around Firebase

How dare I am talking herehellip

Irsquom the user of firebase long before Firebase has order amp Limit feature

Irsquove been using it since Jan 2014

Disclaimer

30 minutes wonrsquot be enough to show how cool Firebase is

What is Firebase

Letrsquos see a Real-World demo

Rather than theoritise about it

Take a photo with DevFest2015

Shared photo will be automatically shown here httpstoryjepretinJepretgdgdevfest2015

Firebase delivers that photo object to browser in realtime

Jepret Cloud Jepret Allegra Jepret Story

Firebase Firebase

Nodejs + MongoDBDeployed on Microsoft Azure

Architecture

Firebase

Realtime Gallery Allegra Machine Jepret Story app

Jepret Cloud

More about Jeprethttpjepretin

Letrsquos see another demo

Typical Firebase Demo

Letrsquos Try something different

todayhellip

Letrsquos Get Physical

todayhellip

Letrsquos light up the LED

My Setup

Circuit

Code

var wpi = require(wiring-pi) wpisetup(gpio)

var ledPin = 26 26 is GPIO pin to LED

wpipinMode(ledPin wpiOUTPUT)

Turn offon the LED directly var ledValue = 1 0 to switch off wpidigitalWrite(ledPin ledValue)

Letrsquos light up the LED via browser

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 4: Firebase - realtime backend for mobile app and IoT

Been coding in awesome languagesFrameworks for 18 years

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

NET QtQML Java MEEESE Android SDK iOS SDK Nodejs Arduino

Who am I around Firebase

How dare I am talking herehellip

Irsquom the user of firebase long before Firebase has order amp Limit feature

Irsquove been using it since Jan 2014

Disclaimer

30 minutes wonrsquot be enough to show how cool Firebase is

What is Firebase

Letrsquos see a Real-World demo

Rather than theoritise about it

Take a photo with DevFest2015

Shared photo will be automatically shown here httpstoryjepretinJepretgdgdevfest2015

Firebase delivers that photo object to browser in realtime

Jepret Cloud Jepret Allegra Jepret Story

Firebase Firebase

Nodejs + MongoDBDeployed on Microsoft Azure

Architecture

Firebase

Realtime Gallery Allegra Machine Jepret Story app

Jepret Cloud

More about Jeprethttpjepretin

Letrsquos see another demo

Typical Firebase Demo

Letrsquos Try something different

todayhellip

Letrsquos Get Physical

todayhellip

Letrsquos light up the LED

My Setup

Circuit

Code

var wpi = require(wiring-pi) wpisetup(gpio)

var ledPin = 26 26 is GPIO pin to LED

wpipinMode(ledPin wpiOUTPUT)

Turn offon the LED directly var ledValue = 1 0 to switch off wpidigitalWrite(ledPin ledValue)

Letrsquos light up the LED via browser

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 5: Firebase - realtime backend for mobile app and IoT

Who am I around Firebase

How dare I am talking herehellip

Irsquom the user of firebase long before Firebase has order amp Limit feature

Irsquove been using it since Jan 2014

Disclaimer

30 minutes wonrsquot be enough to show how cool Firebase is

What is Firebase

Letrsquos see a Real-World demo

Rather than theoritise about it

Take a photo with DevFest2015

Shared photo will be automatically shown here httpstoryjepretinJepretgdgdevfest2015

Firebase delivers that photo object to browser in realtime

Jepret Cloud Jepret Allegra Jepret Story

Firebase Firebase

Nodejs + MongoDBDeployed on Microsoft Azure

Architecture

Firebase

Realtime Gallery Allegra Machine Jepret Story app

Jepret Cloud

More about Jeprethttpjepretin

Letrsquos see another demo

Typical Firebase Demo

Letrsquos Try something different

todayhellip

Letrsquos Get Physical

todayhellip

Letrsquos light up the LED

My Setup

Circuit

Code

var wpi = require(wiring-pi) wpisetup(gpio)

var ledPin = 26 26 is GPIO pin to LED

wpipinMode(ledPin wpiOUTPUT)

Turn offon the LED directly var ledValue = 1 0 to switch off wpidigitalWrite(ledPin ledValue)

Letrsquos light up the LED via browser

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 6: Firebase - realtime backend for mobile app and IoT

Irsquom the user of firebase long before Firebase has order amp Limit feature

Irsquove been using it since Jan 2014

Disclaimer

30 minutes wonrsquot be enough to show how cool Firebase is

What is Firebase

Letrsquos see a Real-World demo

Rather than theoritise about it

Take a photo with DevFest2015

Shared photo will be automatically shown here httpstoryjepretinJepretgdgdevfest2015

Firebase delivers that photo object to browser in realtime

Jepret Cloud Jepret Allegra Jepret Story

Firebase Firebase

Nodejs + MongoDBDeployed on Microsoft Azure

Architecture

Firebase

Realtime Gallery Allegra Machine Jepret Story app

Jepret Cloud

More about Jeprethttpjepretin

Letrsquos see another demo

Typical Firebase Demo

Letrsquos Try something different

todayhellip

Letrsquos Get Physical

todayhellip

Letrsquos light up the LED

My Setup

Circuit

Code

var wpi = require(wiring-pi) wpisetup(gpio)

var ledPin = 26 26 is GPIO pin to LED

wpipinMode(ledPin wpiOUTPUT)

Turn offon the LED directly var ledValue = 1 0 to switch off wpidigitalWrite(ledPin ledValue)

Letrsquos light up the LED via browser

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 7: Firebase - realtime backend for mobile app and IoT

Disclaimer

30 minutes wonrsquot be enough to show how cool Firebase is

What is Firebase

Letrsquos see a Real-World demo

Rather than theoritise about it

Take a photo with DevFest2015

Shared photo will be automatically shown here httpstoryjepretinJepretgdgdevfest2015

Firebase delivers that photo object to browser in realtime

Jepret Cloud Jepret Allegra Jepret Story

Firebase Firebase

Nodejs + MongoDBDeployed on Microsoft Azure

Architecture

Firebase

Realtime Gallery Allegra Machine Jepret Story app

Jepret Cloud

More about Jeprethttpjepretin

Letrsquos see another demo

Typical Firebase Demo

Letrsquos Try something different

todayhellip

Letrsquos Get Physical

todayhellip

Letrsquos light up the LED

My Setup

Circuit

Code

var wpi = require(wiring-pi) wpisetup(gpio)

var ledPin = 26 26 is GPIO pin to LED

wpipinMode(ledPin wpiOUTPUT)

Turn offon the LED directly var ledValue = 1 0 to switch off wpidigitalWrite(ledPin ledValue)

Letrsquos light up the LED via browser

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 8: Firebase - realtime backend for mobile app and IoT

What is Firebase

Letrsquos see a Real-World demo

Rather than theoritise about it

Take a photo with DevFest2015

Shared photo will be automatically shown here httpstoryjepretinJepretgdgdevfest2015

Firebase delivers that photo object to browser in realtime

Jepret Cloud Jepret Allegra Jepret Story

Firebase Firebase

Nodejs + MongoDBDeployed on Microsoft Azure

Architecture

Firebase

Realtime Gallery Allegra Machine Jepret Story app

Jepret Cloud

More about Jeprethttpjepretin

Letrsquos see another demo

Typical Firebase Demo

Letrsquos Try something different

todayhellip

Letrsquos Get Physical

todayhellip

Letrsquos light up the LED

My Setup

Circuit

Code

var wpi = require(wiring-pi) wpisetup(gpio)

var ledPin = 26 26 is GPIO pin to LED

wpipinMode(ledPin wpiOUTPUT)

Turn offon the LED directly var ledValue = 1 0 to switch off wpidigitalWrite(ledPin ledValue)

Letrsquos light up the LED via browser

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 9: Firebase - realtime backend for mobile app and IoT

Letrsquos see a Real-World demo

Rather than theoritise about it

Take a photo with DevFest2015

Shared photo will be automatically shown here httpstoryjepretinJepretgdgdevfest2015

Firebase delivers that photo object to browser in realtime

Jepret Cloud Jepret Allegra Jepret Story

Firebase Firebase

Nodejs + MongoDBDeployed on Microsoft Azure

Architecture

Firebase

Realtime Gallery Allegra Machine Jepret Story app

Jepret Cloud

More about Jeprethttpjepretin

Letrsquos see another demo

Typical Firebase Demo

Letrsquos Try something different

todayhellip

Letrsquos Get Physical

todayhellip

Letrsquos light up the LED

My Setup

Circuit

Code

var wpi = require(wiring-pi) wpisetup(gpio)

var ledPin = 26 26 is GPIO pin to LED

wpipinMode(ledPin wpiOUTPUT)

Turn offon the LED directly var ledValue = 1 0 to switch off wpidigitalWrite(ledPin ledValue)

Letrsquos light up the LED via browser

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 10: Firebase - realtime backend for mobile app and IoT

Take a photo with DevFest2015

Shared photo will be automatically shown here httpstoryjepretinJepretgdgdevfest2015

Firebase delivers that photo object to browser in realtime

Jepret Cloud Jepret Allegra Jepret Story

Firebase Firebase

Nodejs + MongoDBDeployed on Microsoft Azure

Architecture

Firebase

Realtime Gallery Allegra Machine Jepret Story app

Jepret Cloud

More about Jeprethttpjepretin

Letrsquos see another demo

Typical Firebase Demo

Letrsquos Try something different

todayhellip

Letrsquos Get Physical

todayhellip

Letrsquos light up the LED

My Setup

Circuit

Code

var wpi = require(wiring-pi) wpisetup(gpio)

var ledPin = 26 26 is GPIO pin to LED

wpipinMode(ledPin wpiOUTPUT)

Turn offon the LED directly var ledValue = 1 0 to switch off wpidigitalWrite(ledPin ledValue)

Letrsquos light up the LED via browser

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 11: Firebase - realtime backend for mobile app and IoT

Shared photo will be automatically shown here httpstoryjepretinJepretgdgdevfest2015

Firebase delivers that photo object to browser in realtime

Jepret Cloud Jepret Allegra Jepret Story

Firebase Firebase

Nodejs + MongoDBDeployed on Microsoft Azure

Architecture

Firebase

Realtime Gallery Allegra Machine Jepret Story app

Jepret Cloud

More about Jeprethttpjepretin

Letrsquos see another demo

Typical Firebase Demo

Letrsquos Try something different

todayhellip

Letrsquos Get Physical

todayhellip

Letrsquos light up the LED

My Setup

Circuit

Code

var wpi = require(wiring-pi) wpisetup(gpio)

var ledPin = 26 26 is GPIO pin to LED

wpipinMode(ledPin wpiOUTPUT)

Turn offon the LED directly var ledValue = 1 0 to switch off wpidigitalWrite(ledPin ledValue)

Letrsquos light up the LED via browser

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 12: Firebase - realtime backend for mobile app and IoT

Firebase delivers that photo object to browser in realtime

Jepret Cloud Jepret Allegra Jepret Story

Firebase Firebase

Nodejs + MongoDBDeployed on Microsoft Azure

Architecture

Firebase

Realtime Gallery Allegra Machine Jepret Story app

Jepret Cloud

More about Jeprethttpjepretin

Letrsquos see another demo

Typical Firebase Demo

Letrsquos Try something different

todayhellip

Letrsquos Get Physical

todayhellip

Letrsquos light up the LED

My Setup

Circuit

Code

var wpi = require(wiring-pi) wpisetup(gpio)

var ledPin = 26 26 is GPIO pin to LED

wpipinMode(ledPin wpiOUTPUT)

Turn offon the LED directly var ledValue = 1 0 to switch off wpidigitalWrite(ledPin ledValue)

Letrsquos light up the LED via browser

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 13: Firebase - realtime backend for mobile app and IoT

Jepret Cloud Jepret Allegra Jepret Story

Firebase Firebase

Nodejs + MongoDBDeployed on Microsoft Azure

Architecture

Firebase

Realtime Gallery Allegra Machine Jepret Story app

Jepret Cloud

More about Jeprethttpjepretin

Letrsquos see another demo

Typical Firebase Demo

Letrsquos Try something different

todayhellip

Letrsquos Get Physical

todayhellip

Letrsquos light up the LED

My Setup

Circuit

Code

var wpi = require(wiring-pi) wpisetup(gpio)

var ledPin = 26 26 is GPIO pin to LED

wpipinMode(ledPin wpiOUTPUT)

Turn offon the LED directly var ledValue = 1 0 to switch off wpidigitalWrite(ledPin ledValue)

Letrsquos light up the LED via browser

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 14: Firebase - realtime backend for mobile app and IoT

Firebase Firebase

Nodejs + MongoDBDeployed on Microsoft Azure

Architecture

Firebase

Realtime Gallery Allegra Machine Jepret Story app

Jepret Cloud

More about Jeprethttpjepretin

Letrsquos see another demo

Typical Firebase Demo

Letrsquos Try something different

todayhellip

Letrsquos Get Physical

todayhellip

Letrsquos light up the LED

My Setup

Circuit

Code

var wpi = require(wiring-pi) wpisetup(gpio)

var ledPin = 26 26 is GPIO pin to LED

wpipinMode(ledPin wpiOUTPUT)

Turn offon the LED directly var ledValue = 1 0 to switch off wpidigitalWrite(ledPin ledValue)

Letrsquos light up the LED via browser

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 15: Firebase - realtime backend for mobile app and IoT

More about Jeprethttpjepretin

Letrsquos see another demo

Typical Firebase Demo

Letrsquos Try something different

todayhellip

Letrsquos Get Physical

todayhellip

Letrsquos light up the LED

My Setup

Circuit

Code

var wpi = require(wiring-pi) wpisetup(gpio)

var ledPin = 26 26 is GPIO pin to LED

wpipinMode(ledPin wpiOUTPUT)

Turn offon the LED directly var ledValue = 1 0 to switch off wpidigitalWrite(ledPin ledValue)

Letrsquos light up the LED via browser

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 16: Firebase - realtime backend for mobile app and IoT

Letrsquos see another demo

Typical Firebase Demo

Letrsquos Try something different

todayhellip

Letrsquos Get Physical

todayhellip

Letrsquos light up the LED

My Setup

Circuit

Code

var wpi = require(wiring-pi) wpisetup(gpio)

var ledPin = 26 26 is GPIO pin to LED

wpipinMode(ledPin wpiOUTPUT)

Turn offon the LED directly var ledValue = 1 0 to switch off wpidigitalWrite(ledPin ledValue)

Letrsquos light up the LED via browser

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 17: Firebase - realtime backend for mobile app and IoT

Typical Firebase Demo

Letrsquos Try something different

todayhellip

Letrsquos Get Physical

todayhellip

Letrsquos light up the LED

My Setup

Circuit

Code

var wpi = require(wiring-pi) wpisetup(gpio)

var ledPin = 26 26 is GPIO pin to LED

wpipinMode(ledPin wpiOUTPUT)

Turn offon the LED directly var ledValue = 1 0 to switch off wpidigitalWrite(ledPin ledValue)

Letrsquos light up the LED via browser

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 18: Firebase - realtime backend for mobile app and IoT

Letrsquos Try something different

todayhellip

Letrsquos Get Physical

todayhellip

Letrsquos light up the LED

My Setup

Circuit

Code

var wpi = require(wiring-pi) wpisetup(gpio)

var ledPin = 26 26 is GPIO pin to LED

wpipinMode(ledPin wpiOUTPUT)

Turn offon the LED directly var ledValue = 1 0 to switch off wpidigitalWrite(ledPin ledValue)

Letrsquos light up the LED via browser

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 19: Firebase - realtime backend for mobile app and IoT

Letrsquos Get Physical

todayhellip

Letrsquos light up the LED

My Setup

Circuit

Code

var wpi = require(wiring-pi) wpisetup(gpio)

var ledPin = 26 26 is GPIO pin to LED

wpipinMode(ledPin wpiOUTPUT)

Turn offon the LED directly var ledValue = 1 0 to switch off wpidigitalWrite(ledPin ledValue)

Letrsquos light up the LED via browser

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 20: Firebase - realtime backend for mobile app and IoT

Letrsquos light up the LED

My Setup

Circuit

Code

var wpi = require(wiring-pi) wpisetup(gpio)

var ledPin = 26 26 is GPIO pin to LED

wpipinMode(ledPin wpiOUTPUT)

Turn offon the LED directly var ledValue = 1 0 to switch off wpidigitalWrite(ledPin ledValue)

Letrsquos light up the LED via browser

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 21: Firebase - realtime backend for mobile app and IoT

My Setup

Circuit

Code

var wpi = require(wiring-pi) wpisetup(gpio)

var ledPin = 26 26 is GPIO pin to LED

wpipinMode(ledPin wpiOUTPUT)

Turn offon the LED directly var ledValue = 1 0 to switch off wpidigitalWrite(ledPin ledValue)

Letrsquos light up the LED via browser

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 22: Firebase - realtime backend for mobile app and IoT

Circuit

Code

var wpi = require(wiring-pi) wpisetup(gpio)

var ledPin = 26 26 is GPIO pin to LED

wpipinMode(ledPin wpiOUTPUT)

Turn offon the LED directly var ledValue = 1 0 to switch off wpidigitalWrite(ledPin ledValue)

Letrsquos light up the LED via browser

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 23: Firebase - realtime backend for mobile app and IoT

Code

var wpi = require(wiring-pi) wpisetup(gpio)

var ledPin = 26 26 is GPIO pin to LED

wpipinMode(ledPin wpiOUTPUT)

Turn offon the LED directly var ledValue = 1 0 to switch off wpidigitalWrite(ledPin ledValue)

Letrsquos light up the LED via browser

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 24: Firebase - realtime backend for mobile app and IoT

Letrsquos light up the LED via browser

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 25: Firebase - realtime backend for mobile app and IoT

Architecture

Raspberry Pi 2 Web app

HTTP(LAN)

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 26: Firebase - realtime backend for mobile app and IoT

Light up the LED via Firebase

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 27: Firebase - realtime backend for mobile app and IoT

Architecture

Raspberry Pi 2Web app

Internet

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 28: Firebase - realtime backend for mobile app and IoT

Firebase data

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 29: Firebase - realtime backend for mobile app and IoT

The trick

Raspberry Pi 2

Firebase

ifstate==truewrite1ifstate==falsewrite0

wpidigitalWrite(LED_PIN1)

Firebase

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 30: Firebase - realtime backend for mobile app and IoT

Codefunction setState(state) ledValue = +state convert truefalse to appropriate integer wpidigitalWrite(ledPin ledValue)

var deviceId = smartlamp1 var myFirebaseRef = new Firebase(ldquohttps[YOUR_FIREBASE]firebaseiocomdevicesrdquo) var deviceRef = myFirebaseRefchild(deviceId)

var myDevParamsRef = deviceRefchild(parameters)myDevParamsRefon(child_changed function(snapshot) consolelog(snapshotkey()) consolelog(snapshotval()) if (snapshotkey() == state) setState(snapshotval()) )

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 31: Firebase - realtime backend for mobile app and IoT

Now we can turn on the Led from Marshellipor from anywhere connected to internet

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 32: Firebase - realtime backend for mobile app and IoT

Let there be a lightUsing the same principle now we can turn onoff an AC light bulb

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 33: Firebase - realtime backend for mobile app and IoT

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

AC solid state switch

To RPi2 GPIO 5

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 34: Firebase - realtime backend for mobile app and IoT

My Setup

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 35: Firebase - realtime backend for mobile app and IoT

Let there be a light from App

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 36: Firebase - realtime backend for mobile app and IoT

Architecture

Raspberry Pi 2Web app Mobile app

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 37: Firebase - realtime backend for mobile app and IoT

Sending Telemetry

what abouthellip

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 38: Firebase - realtime backend for mobile app and IoT

Complete Circuit

1 2 3 4

A

B

C

D

4321

D

C

B

A Title

Number RevisionSizeA4

Date 7-Oct-2015 Sheet ofFile DDYCODELayout PCBDemoddb Drawn By

Q1TRIAC

U1

OPTOTRIAC_1

R2

1K

R1

470

LAMP

AC PLUG

GPIO

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 39: Firebase - realtime backend for mobile app and IoT

Architecture

Raspberry Pi 2 Mobile app

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 40: Firebase - realtime backend for mobile app and IoT

Bonus AutomationTurn on light bulb automatically using a LDR

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 41: Firebase - realtime backend for mobile app and IoT

httpsgithubcomandriyadiFireSmartLamp

All code is here

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 42: Firebase - realtime backend for mobile app and IoT

as Summaryhellip

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 43: Firebase - realtime backend for mobile app and IoT

WELL DOCUMENTED

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 44: Firebase - realtime backend for mobile app and IoT

Education

httpedudycodecoid | edudycodecom

a bit of adshellip

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 45: Firebase - realtime backend for mobile app and IoT

We contributeEducation

100+ seminars workshops trainings delivered

Delivered to 20+ communities organisations

campuses

Next could be yourshellip Just drop us a message

httpedudycodecoid | edudycodecom

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 46: Firebase - realtime backend for mobile app and IoT

We teach

+ + [Obj-C]

+

Education

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 47: Firebase - realtime backend for mobile app and IoT

Opening soonhellipEducation

+

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 48: Firebase - realtime backend for mobile app and IoT

httpsgithubcomandriyadiFireSmartLamp

Again all code is here

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks

Page 49: Firebase - realtime backend for mobile app and IoT

DyCode wwwdycodecom

office at dycode dot com | dycode

Thanks


Recommended