SlideShare une entreprise Scribd logo
1  sur  18
On Raspberry Pi & Arduino
With Node.JS
June. 2014
Home Temperature & Humidity Monitor
Node.JS on Arduino + Raspberry Pi
Features (based on v. 0.1)
– mobile web app on
jQuery Mobile
– show current temperature
– show the trend of temp.
– open API for using google chart
TO-DOs
– add humidity
– add hypermedia API
Arduino Nano + Raspberry Pi + Wi-Fi
LAN
Uses DHT11 sensor
Resistance is
required
Node.JS on Raspberry Pi in 5 min.
– http://joshondesign.com/2013/10/23/noderpi
Update raspbian
Node & NPM
Set environment
sudo apt-get upgrade;
sudo apt-get update
wget http://nodejs.org/dist/v0.10.2/node-v0.10.2-linux-arm-pi.tar.gz
tar -xvzf node-v0.10.2-linux-arm-pi.tar.gz node-v0.10.2-linux-arm-
pi/bin/node --version
NODE_JS_HOME=/home/pi/node-v0.10.2-linux-arm-pi
PATH=$PATH:$NODE_JS_HOME/bin
Install MySQL server
Install node-mysql
Create table
sudo apt-get install mysql-server
npm install mysql
mysql -u root -p
Enter password:
mysql> CREATE DB temps
mysql> USE temps
Create schema
Retrieving DB on Node.JS
– http://iamapark89.wordpress.com/2013/12/1
4/node-js-2-db-%EC%97%B0%EA%B2%B0/
CREATE TABLE tempData (
tempId int(11) AUTO_INCREMENT NOT NULL,
tempDate datetime NOT NULL,
tempCelsius decimal(4,2) NOT NULL,
humidity decimal(4,2) NOT NULL,
constraint tempData_PK primary key (tempId)
);
Flushing binary with Arduino IDE
– http://playground.arduino.cc/main/DHT11Lib
Install node-serialport
– https://github.com/voodootikigod/node-serialport
wget http://nodejs.org/dist/v0.10.12/node-v0.10.12-linux-arm-
pi.tar.gz
tar xvfz node-v0.10.12-linux-arm-pi.tar.gz
sudo mv node-v0.10.12-linux-arm-pi /opt/node/
echo 'export PATH="$PATH:/opt/node/bin"' >> ~/.bashrc
source ~/.bashrc
npm install serialport
Programming server with JavaScript
– JavaScript is also famous for front-end (client)
Simple & Short Code
– No type declaration & implicit type conversion
– No multi-threading control
Various open source libraries on NPM
– Just type ‘npm install {library name}’ to use it
Awesome playgrounds
– Cloud IDE such as Cloud9 and web itself.
RequireJS
– De facto JavaScript modularization
• http://webofthink.tistory.com/12
Evented I/O asynchronous operation
var http=require(‘http’);
http.createServer(function
(request, response) {
// invoked asynchronously
});
Web Application Server
– sudo npm install express routes
var express = require('express') , routes = require('./routes') , user =
require('./routes/user') , temperatures =
require('./routes/temperature') , http = require('http') , path =
require('path');
var app = express();
// … omitted …
app.get('/', routes.index);
app.get('/users', user.list);
app.get('/temperatures', temperatures.list);
Handles GET /users
Handles GET
/temperatures
Jade Template Engine for Express
– sudo node install jade
Simplified HTML tag hierarchy
doctype 5
html
head
title
meta(name='viewport', content='width=device-width,
initial-scale=1')
body
div(data-role='page', data-theme='a')
h1
hr
a
Responsive web design
– Uses jQuery Mobile for free
• See the demo:
– http://demos.jquerymobile.com/
1.3.0-beta.1/docs/demos/
Using Google Charts
– https://developers.google.com/chart/
HTTP command, URI & representation
– HTTP command: GET, PUT, POST, DELETE, …
– URI: non-verb resources & it’s hierarchy
– Representation : XML, JSON, …
AJAX operation
var xhr = new XMLHttpRequest();
xhr.open('get', '/temperatures');
xhr.onreadystatechange = function() {
// code the event handler here
}
xhr.send(null);
JavaScript Everywhere
– Consider 1st class citizen of web for all Internet
of Things.
Develop more APIs then Apps
– App is opened to use but closed to create.
– API gives the chance to mash things up.
Data is just nothing without visualization
– Imagine how the context can be found in data.
Design hypermedia API
– Achieve the level 3 at Richardson Maturity Level
• http://webofthink.tistory.com/2
Design REST to JavaScript API for better
development
– Make the mash-up and maintenance better
– Provide user’s guide with Web IDL
Multi-screen web application
– Design the process how to develop N-Screen Apps.

Contenu connexe

Tendances

Kraken js at paypal
Kraken js at paypalKraken js at paypal
Kraken js at paypalLenny Markus
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansibleMukul Malhotra
 
Ansible
AnsibleAnsible
Ansiblegnosek
 
Ansible basics workshop
Ansible basics workshopAnsible basics workshop
Ansible basics workshopDavid Karban
 
Reactive Programming by UniRx for Asynchronous & Event Processing
Reactive Programming by UniRx for Asynchronous & Event ProcessingReactive Programming by UniRx for Asynchronous & Event Processing
Reactive Programming by UniRx for Asynchronous & Event ProcessingYoshifumi Kawai
 
How to speed up your (API client) modules
How to speed up your (API client) modulesHow to speed up your (API client) modules
How to speed up your (API client) modulesGonéri Le Bouder
 
OSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshopOSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshopleffen
 
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.Idan Tohami
 
Best Deep Learning Post from LinkedIn Group
Best Deep Learning Post from LinkedIn Group Best Deep Learning Post from LinkedIn Group
Best Deep Learning Post from LinkedIn Group Farshid Pirahansiah
 
The Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session IThe Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session IOded Sagir
 
Modern Infrastructure from Scratch with Puppet
Modern Infrastructure from Scratch with PuppetModern Infrastructure from Scratch with Puppet
Modern Infrastructure from Scratch with PuppetPuppet
 
Epoll - from the kernel side
Epoll -  from the kernel sideEpoll -  from the kernel side
Epoll - from the kernel sidellj098
 
Deploying Prometheus stacks with Juju
Deploying Prometheus stacks with JujuDeploying Prometheus stacks with Juju
Deploying Prometheus stacks with JujuJ.J. Ciarlante
 
[MeetUp][2nd] 컭on턺
[MeetUp][2nd] 컭on턺[MeetUp][2nd] 컭on턺
[MeetUp][2nd] 컭on턺InfraEngineer
 
Continuous Integration & Continuous Delivery with GCP
Continuous Integration & Continuous Delivery with GCPContinuous Integration & Continuous Delivery with GCP
Continuous Integration & Continuous Delivery with GCPKAI CHU CHUNG
 
function* - ES6, generators, and all that (JSRomandie meetup, February 2014)
function* - ES6, generators, and all that (JSRomandie meetup, February 2014)function* - ES6, generators, and all that (JSRomandie meetup, February 2014)
function* - ES6, generators, and all that (JSRomandie meetup, February 2014)Igalia
 

Tendances (20)

Kraken js at paypal
Kraken js at paypalKraken js at paypal
Kraken js at paypal
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
 
Ansible
AnsibleAnsible
Ansible
 
Fabric: A Capistrano Alternative
Fabric:  A Capistrano AlternativeFabric:  A Capistrano Alternative
Fabric: A Capistrano Alternative
 
Ansible basics workshop
Ansible basics workshopAnsible basics workshop
Ansible basics workshop
 
Reactive Programming by UniRx for Asynchronous & Event Processing
Reactive Programming by UniRx for Asynchronous & Event ProcessingReactive Programming by UniRx for Asynchronous & Event Processing
Reactive Programming by UniRx for Asynchronous & Event Processing
 
How to speed up your (API client) modules
How to speed up your (API client) modulesHow to speed up your (API client) modules
How to speed up your (API client) modules
 
OSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshopOSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshop
 
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
 
Best Deep Learning Post from LinkedIn Group
Best Deep Learning Post from LinkedIn Group Best Deep Learning Post from LinkedIn Group
Best Deep Learning Post from LinkedIn Group
 
The Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session IThe Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session I
 
Modern Infrastructure from Scratch with Puppet
Modern Infrastructure from Scratch with PuppetModern Infrastructure from Scratch with Puppet
Modern Infrastructure from Scratch with Puppet
 
Epoll - from the kernel side
Epoll -  from the kernel sideEpoll -  from the kernel side
Epoll - from the kernel side
 
Heroku pycon
Heroku pyconHeroku pycon
Heroku pycon
 
Deploying Prometheus stacks with Juju
Deploying Prometheus stacks with JujuDeploying Prometheus stacks with Juju
Deploying Prometheus stacks with Juju
 
[MeetUp][2nd] 컭on턺
[MeetUp][2nd] 컭on턺[MeetUp][2nd] 컭on턺
[MeetUp][2nd] 컭on턺
 
Continuous Integration & Continuous Delivery with GCP
Continuous Integration & Continuous Delivery with GCPContinuous Integration & Continuous Delivery with GCP
Continuous Integration & Continuous Delivery with GCP
 
AsyncIO To Speed Up Your Crawler
AsyncIO To Speed Up Your CrawlerAsyncIO To Speed Up Your Crawler
AsyncIO To Speed Up Your Crawler
 
function* - ES6, generators, and all that (JSRomandie meetup, February 2014)
function* - ES6, generators, and all that (JSRomandie meetup, February 2014)function* - ES6, generators, and all that (JSRomandie meetup, February 2014)
function* - ES6, generators, and all that (JSRomandie meetup, February 2014)
 
Puppet and Openshift
Puppet and OpenshiftPuppet and Openshift
Puppet and Openshift
 

En vedette

IoT Web App - 수집된 정보의 가공, 처리, 융합
IoT Web App - 수집된 정보의 가공, 처리, 융합IoT Web App - 수집된 정보의 가공, 처리, 융합
IoT Web App - 수집된 정보의 가공, 처리, 융합Hyunghun Cho
 
[1C6]오픈소스 하드웨어 플랫폼과 Node.js로 구현하는 IoT 플랫폼
[1C6]오픈소스 하드웨어 플랫폼과 Node.js로 구현하는 IoT 플랫폼[1C6]오픈소스 하드웨어 플랫폼과 Node.js로 구현하는 IoT 플랫폼
[1C6]오픈소스 하드웨어 플랫폼과 Node.js로 구현하는 IoT 플랫폼NAVER D2
 
Intuitive Understanding of Arduino for IoT
Intuitive Understanding of Arduino for IoTIntuitive Understanding of Arduino for IoT
Intuitive Understanding of Arduino for IoT영광 송
 
Do IoT Yourself 3rd : Open API - revision 3
Do IoT Yourself 3rd : Open API - revision 3Do IoT Yourself 3rd : Open API - revision 3
Do IoT Yourself 3rd : Open API - revision 3Hyunghun Cho
 
MQTT on Raspberry Pi with node.js
MQTT on Raspberry Pi with node.jsMQTT on Raspberry Pi with node.js
MQTT on Raspberry Pi with node.jsPaul Tanner
 
IoT with Raspberry Pi + Node JS - Chapter 2
IoT with Raspberry Pi + Node JS - Chapter 2IoT with Raspberry Pi + Node JS - Chapter 2
IoT with Raspberry Pi + Node JS - Chapter 2Park Jonggun
 
04강 라즈베리-개발환경구축-실습
04강 라즈베리-개발환경구축-실습04강 라즈베리-개발환경구축-실습
04강 라즈베리-개발환경구축-실습봉조 김
 
라즈베리파이로 보일러 제어하기
라즈베리파이로 보일러 제어하기라즈베리파이로 보일러 제어하기
라즈베리파이로 보일러 제어하기Tai Hoon KIM
 
라즈베리파이로 시작하는 Iot세상
라즈베리파이로 시작하는 Iot세상라즈베리파이로 시작하는 Iot세상
라즈베리파이로 시작하는 Iot세상Jin-Hyun Park
 
자바, 미안하다! 파이썬 한국어 NLP
자바, 미안하다! 파이썬 한국어 NLP자바, 미안하다! 파이썬 한국어 NLP
자바, 미안하다! 파이썬 한국어 NLPEunjeong (Lucy) Park
 
Device to Intelligence, IOT and Big Data in Oracle
Device to Intelligence, IOT and Big Data in OracleDevice to Intelligence, IOT and Big Data in Oracle
Device to Intelligence, IOT and Big Data in OracleJunSeok Seo
 
IoT, 기술의 혁신과 미래 그리고 통찰
IoT, 기술의 혁신과 미래 그리고 통찰IoT, 기술의 혁신과 미래 그리고 통찰
IoT, 기술의 혁신과 미래 그리고 통찰Hyunghun Cho
 
Raspberry pi - Node js - Drupal
Raspberry pi - Node js - DrupalRaspberry pi - Node js - Drupal
Raspberry pi - Node js - DrupalMark Corben
 

En vedette (13)

IoT Web App - 수집된 정보의 가공, 처리, 융합
IoT Web App - 수집된 정보의 가공, 처리, 융합IoT Web App - 수집된 정보의 가공, 처리, 융합
IoT Web App - 수집된 정보의 가공, 처리, 융합
 
[1C6]오픈소스 하드웨어 플랫폼과 Node.js로 구현하는 IoT 플랫폼
[1C6]오픈소스 하드웨어 플랫폼과 Node.js로 구현하는 IoT 플랫폼[1C6]오픈소스 하드웨어 플랫폼과 Node.js로 구현하는 IoT 플랫폼
[1C6]오픈소스 하드웨어 플랫폼과 Node.js로 구현하는 IoT 플랫폼
 
Intuitive Understanding of Arduino for IoT
Intuitive Understanding of Arduino for IoTIntuitive Understanding of Arduino for IoT
Intuitive Understanding of Arduino for IoT
 
Do IoT Yourself 3rd : Open API - revision 3
Do IoT Yourself 3rd : Open API - revision 3Do IoT Yourself 3rd : Open API - revision 3
Do IoT Yourself 3rd : Open API - revision 3
 
MQTT on Raspberry Pi with node.js
MQTT on Raspberry Pi with node.jsMQTT on Raspberry Pi with node.js
MQTT on Raspberry Pi with node.js
 
IoT with Raspberry Pi + Node JS - Chapter 2
IoT with Raspberry Pi + Node JS - Chapter 2IoT with Raspberry Pi + Node JS - Chapter 2
IoT with Raspberry Pi + Node JS - Chapter 2
 
04강 라즈베리-개발환경구축-실습
04강 라즈베리-개발환경구축-실습04강 라즈베리-개발환경구축-실습
04강 라즈베리-개발환경구축-실습
 
라즈베리파이로 보일러 제어하기
라즈베리파이로 보일러 제어하기라즈베리파이로 보일러 제어하기
라즈베리파이로 보일러 제어하기
 
라즈베리파이로 시작하는 Iot세상
라즈베리파이로 시작하는 Iot세상라즈베리파이로 시작하는 Iot세상
라즈베리파이로 시작하는 Iot세상
 
자바, 미안하다! 파이썬 한국어 NLP
자바, 미안하다! 파이썬 한국어 NLP자바, 미안하다! 파이썬 한국어 NLP
자바, 미안하다! 파이썬 한국어 NLP
 
Device to Intelligence, IOT and Big Data in Oracle
Device to Intelligence, IOT and Big Data in OracleDevice to Intelligence, IOT and Big Data in Oracle
Device to Intelligence, IOT and Big Data in Oracle
 
IoT, 기술의 혁신과 미래 그리고 통찰
IoT, 기술의 혁신과 미래 그리고 통찰IoT, 기술의 혁신과 미래 그리고 통찰
IoT, 기술의 혁신과 미래 그리고 통찰
 
Raspberry pi - Node js - Drupal
Raspberry pi - Node js - DrupalRaspberry pi - Node js - Drupal
Raspberry pi - Node js - Drupal
 

Similaire à Home sensor prototype on Arduino & Raspberry Pi with Node.JS

ДМИТРО БУДИМ «Mobile Automation Infrastructure from scratch» Online QADay 202...
ДМИТРО БУДИМ «Mobile Automation Infrastructure from scratch» Online QADay 202...ДМИТРО БУДИМ «Mobile Automation Infrastructure from scratch» Online QADay 202...
ДМИТРО БУДИМ «Mobile Automation Infrastructure from scratch» Online QADay 202...GoQA
 
Building Web Apps with Express
Building Web Apps with ExpressBuilding Web Apps with Express
Building Web Apps with ExpressAaron Stannard
 
"13 ways to run web applications on the Internet" Andrii Shumada
"13 ways to run web applications on the Internet" Andrii Shumada"13 ways to run web applications on the Internet" Andrii Shumada
"13 ways to run web applications on the Internet" Andrii ShumadaFwdays
 
Reactive application using meteor
Reactive application using meteorReactive application using meteor
Reactive application using meteorSapna Upreti
 
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)Eric D. Schabell
 
Tutorial 1: Your First Science App - Araport Developer Workshop
Tutorial 1: Your First Science App - Araport Developer WorkshopTutorial 1: Your First Science App - Araport Developer Workshop
Tutorial 1: Your First Science App - Araport Developer WorkshopVivek Krishnakumar
 
Grunt & Front-end Workflow
Grunt & Front-end WorkflowGrunt & Front-end Workflow
Grunt & Front-end WorkflowPagepro
 
Using the new WordPress REST API
Using the new WordPress REST APIUsing the new WordPress REST API
Using the new WordPress REST APICaldera Labs
 
Mobile development in 2020
Mobile development in 2020 Mobile development in 2020
Mobile development in 2020 Bogusz Jelinski
 
Haibu: dev deployment is fast and easy again
Haibu: dev deployment is fast and easy againHaibu: dev deployment is fast and easy again
Haibu: dev deployment is fast and easy againFrank Rousseau
 
JDD 2017: 7 things which you should care about before release your code to pr...
JDD 2017: 7 things which you should care about before release your code to pr...JDD 2017: 7 things which you should care about before release your code to pr...
JDD 2017: 7 things which you should care about before release your code to pr...PROIDEA
 
Building websites with Node.ACS
Building websites with Node.ACSBuilding websites with Node.ACS
Building websites with Node.ACSralcocer
 
Building websites with Node.ACS
Building websites with Node.ACSBuilding websites with Node.ACS
Building websites with Node.ACSRicardo Alcocer
 
Appium workship, Mobile Web+Dev Conference
Appium workship,  Mobile Web+Dev ConferenceAppium workship,  Mobile Web+Dev Conference
Appium workship, Mobile Web+Dev ConferenceIsaac Murchie
 
Appium mobile web+dev conference
Appium   mobile web+dev conferenceAppium   mobile web+dev conference
Appium mobile web+dev conferenceIsaac Murchie
 
Nodejs Intro - Part2 Introduction to Web Applications
Nodejs Intro - Part2 Introduction to Web ApplicationsNodejs Intro - Part2 Introduction to Web Applications
Nodejs Intro - Part2 Introduction to Web ApplicationsBudh Ram Gurung
 
Introduction to node.js By Ahmed Assaf
Introduction to node.js  By Ahmed AssafIntroduction to node.js  By Ahmed Assaf
Introduction to node.js By Ahmed AssafAhmed Assaf
 
DevFest 2022 - GitHub Actions를 활용한 Flutter 배포 자동화하기
DevFest 2022 - GitHub Actions를 활용한 Flutter 배포 자동화하기DevFest 2022 - GitHub Actions를 활용한 Flutter 배포 자동화하기
DevFest 2022 - GitHub Actions를 활용한 Flutter 배포 자동화하기SuJang Yang
 
Exploring Async PHP (SF Live Berlin 2019)
Exploring Async PHP (SF Live Berlin 2019)Exploring Async PHP (SF Live Berlin 2019)
Exploring Async PHP (SF Live Berlin 2019)dantleech
 

Similaire à Home sensor prototype on Arduino & Raspberry Pi with Node.JS (20)

ДМИТРО БУДИМ «Mobile Automation Infrastructure from scratch» Online QADay 202...
ДМИТРО БУДИМ «Mobile Automation Infrastructure from scratch» Online QADay 202...ДМИТРО БУДИМ «Mobile Automation Infrastructure from scratch» Online QADay 202...
ДМИТРО БУДИМ «Mobile Automation Infrastructure from scratch» Online QADay 202...
 
Building Web Apps with Express
Building Web Apps with ExpressBuilding Web Apps with Express
Building Web Apps with Express
 
"13 ways to run web applications on the Internet" Andrii Shumada
"13 ways to run web applications on the Internet" Andrii Shumada"13 ways to run web applications on the Internet" Andrii Shumada
"13 ways to run web applications on the Internet" Andrii Shumada
 
Reactive application using meteor
Reactive application using meteorReactive application using meteor
Reactive application using meteor
 
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
 
Tutorial 1: Your First Science App - Araport Developer Workshop
Tutorial 1: Your First Science App - Araport Developer WorkshopTutorial 1: Your First Science App - Araport Developer Workshop
Tutorial 1: Your First Science App - Araport Developer Workshop
 
Grunt & Front-end Workflow
Grunt & Front-end WorkflowGrunt & Front-end Workflow
Grunt & Front-end Workflow
 
Using the new WordPress REST API
Using the new WordPress REST APIUsing the new WordPress REST API
Using the new WordPress REST API
 
Nodejs in Production
Nodejs in ProductionNodejs in Production
Nodejs in Production
 
Mobile development in 2020
Mobile development in 2020 Mobile development in 2020
Mobile development in 2020
 
Haibu: dev deployment is fast and easy again
Haibu: dev deployment is fast and easy againHaibu: dev deployment is fast and easy again
Haibu: dev deployment is fast and easy again
 
JDD 2017: 7 things which you should care about before release your code to pr...
JDD 2017: 7 things which you should care about before release your code to pr...JDD 2017: 7 things which you should care about before release your code to pr...
JDD 2017: 7 things which you should care about before release your code to pr...
 
Building websites with Node.ACS
Building websites with Node.ACSBuilding websites with Node.ACS
Building websites with Node.ACS
 
Building websites with Node.ACS
Building websites with Node.ACSBuilding websites with Node.ACS
Building websites with Node.ACS
 
Appium workship, Mobile Web+Dev Conference
Appium workship,  Mobile Web+Dev ConferenceAppium workship,  Mobile Web+Dev Conference
Appium workship, Mobile Web+Dev Conference
 
Appium mobile web+dev conference
Appium   mobile web+dev conferenceAppium   mobile web+dev conference
Appium mobile web+dev conference
 
Nodejs Intro - Part2 Introduction to Web Applications
Nodejs Intro - Part2 Introduction to Web ApplicationsNodejs Intro - Part2 Introduction to Web Applications
Nodejs Intro - Part2 Introduction to Web Applications
 
Introduction to node.js By Ahmed Assaf
Introduction to node.js  By Ahmed AssafIntroduction to node.js  By Ahmed Assaf
Introduction to node.js By Ahmed Assaf
 
DevFest 2022 - GitHub Actions를 활용한 Flutter 배포 자동화하기
DevFest 2022 - GitHub Actions를 활용한 Flutter 배포 자동화하기DevFest 2022 - GitHub Actions를 활용한 Flutter 배포 자동화하기
DevFest 2022 - GitHub Actions를 활용한 Flutter 배포 자동화하기
 
Exploring Async PHP (SF Live Berlin 2019)
Exploring Async PHP (SF Live Berlin 2019)Exploring Async PHP (SF Live Berlin 2019)
Exploring Async PHP (SF Live Berlin 2019)
 

Plus de Hyunghun Cho

2018 소프트웨어에 물들다 - 기계는 어떻게 생각할까?
2018 소프트웨어에 물들다 - 기계는 어떻게 생각할까?2018 소프트웨어에 물들다 - 기계는 어떻게 생각할까?
2018 소프트웨어에 물들다 - 기계는 어떻게 생각할까?Hyunghun Cho
 
Somul 2017 소프트웨어, 사람과 사물의 소통을 향하여
Somul 2017 소프트웨어, 사람과 사물의 소통을 향하여Somul 2017 소프트웨어, 사람과 사물의 소통을 향하여
Somul 2017 소프트웨어, 사람과 사물의 소통을 향하여Hyunghun Cho
 
Tensorflow internal
Tensorflow internalTensorflow internal
Tensorflow internalHyunghun Cho
 
Do IoT Yourself! - 사물 간의 연결을 위한 Open API
Do IoT Yourself! - 사물 간의 연결을 위한 Open APIDo IoT Yourself! - 사물 간의 연결을 위한 Open API
Do IoT Yourself! - 사물 간의 연결을 위한 Open APIHyunghun Cho
 
GameTube app-swing-introduction
GameTube app-swing-introductionGameTube app-swing-introduction
GameTube app-swing-introductionHyunghun Cho
 
REST to JavaScript for Better Client-side Development
REST to JavaScript for Better Client-side DevelopmentREST to JavaScript for Better Client-side Development
REST to JavaScript for Better Client-side DevelopmentHyunghun Cho
 

Plus de Hyunghun Cho (6)

2018 소프트웨어에 물들다 - 기계는 어떻게 생각할까?
2018 소프트웨어에 물들다 - 기계는 어떻게 생각할까?2018 소프트웨어에 물들다 - 기계는 어떻게 생각할까?
2018 소프트웨어에 물들다 - 기계는 어떻게 생각할까?
 
Somul 2017 소프트웨어, 사람과 사물의 소통을 향하여
Somul 2017 소프트웨어, 사람과 사물의 소통을 향하여Somul 2017 소프트웨어, 사람과 사물의 소통을 향하여
Somul 2017 소프트웨어, 사람과 사물의 소통을 향하여
 
Tensorflow internal
Tensorflow internalTensorflow internal
Tensorflow internal
 
Do IoT Yourself! - 사물 간의 연결을 위한 Open API
Do IoT Yourself! - 사물 간의 연결을 위한 Open APIDo IoT Yourself! - 사물 간의 연결을 위한 Open API
Do IoT Yourself! - 사물 간의 연결을 위한 Open API
 
GameTube app-swing-introduction
GameTube app-swing-introductionGameTube app-swing-introduction
GameTube app-swing-introduction
 
REST to JavaScript for Better Client-side Development
REST to JavaScript for Better Client-side DevelopmentREST to JavaScript for Better Client-side Development
REST to JavaScript for Better Client-side Development
 

Dernier

Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 

Dernier (20)

Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 

Home sensor prototype on Arduino & Raspberry Pi with Node.JS

  • 1. On Raspberry Pi & Arduino With Node.JS June. 2014
  • 2. Home Temperature & Humidity Monitor Node.JS on Arduino + Raspberry Pi
  • 3. Features (based on v. 0.1) – mobile web app on jQuery Mobile – show current temperature – show the trend of temp. – open API for using google chart TO-DOs – add humidity – add hypermedia API
  • 4. Arduino Nano + Raspberry Pi + Wi-Fi LAN
  • 6. Node.JS on Raspberry Pi in 5 min. – http://joshondesign.com/2013/10/23/noderpi Update raspbian Node & NPM Set environment sudo apt-get upgrade; sudo apt-get update wget http://nodejs.org/dist/v0.10.2/node-v0.10.2-linux-arm-pi.tar.gz tar -xvzf node-v0.10.2-linux-arm-pi.tar.gz node-v0.10.2-linux-arm- pi/bin/node --version NODE_JS_HOME=/home/pi/node-v0.10.2-linux-arm-pi PATH=$PATH:$NODE_JS_HOME/bin
  • 7. Install MySQL server Install node-mysql Create table sudo apt-get install mysql-server npm install mysql mysql -u root -p Enter password: mysql> CREATE DB temps mysql> USE temps
  • 8. Create schema Retrieving DB on Node.JS – http://iamapark89.wordpress.com/2013/12/1 4/node-js-2-db-%EC%97%B0%EA%B2%B0/ CREATE TABLE tempData ( tempId int(11) AUTO_INCREMENT NOT NULL, tempDate datetime NOT NULL, tempCelsius decimal(4,2) NOT NULL, humidity decimal(4,2) NOT NULL, constraint tempData_PK primary key (tempId) );
  • 9. Flushing binary with Arduino IDE – http://playground.arduino.cc/main/DHT11Lib Install node-serialport – https://github.com/voodootikigod/node-serialport wget http://nodejs.org/dist/v0.10.12/node-v0.10.12-linux-arm- pi.tar.gz tar xvfz node-v0.10.12-linux-arm-pi.tar.gz sudo mv node-v0.10.12-linux-arm-pi /opt/node/ echo 'export PATH="$PATH:/opt/node/bin"' >> ~/.bashrc source ~/.bashrc npm install serialport
  • 10. Programming server with JavaScript – JavaScript is also famous for front-end (client) Simple & Short Code – No type declaration & implicit type conversion – No multi-threading control Various open source libraries on NPM – Just type ‘npm install {library name}’ to use it Awesome playgrounds – Cloud IDE such as Cloud9 and web itself.
  • 11. RequireJS – De facto JavaScript modularization • http://webofthink.tistory.com/12 Evented I/O asynchronous operation var http=require(‘http’); http.createServer(function (request, response) { // invoked asynchronously });
  • 12. Web Application Server – sudo npm install express routes var express = require('express') , routes = require('./routes') , user = require('./routes/user') , temperatures = require('./routes/temperature') , http = require('http') , path = require('path'); var app = express(); // … omitted … app.get('/', routes.index); app.get('/users', user.list); app.get('/temperatures', temperatures.list); Handles GET /users Handles GET /temperatures
  • 13. Jade Template Engine for Express – sudo node install jade Simplified HTML tag hierarchy doctype 5 html head title meta(name='viewport', content='width=device-width, initial-scale=1') body div(data-role='page', data-theme='a') h1 hr a
  • 14. Responsive web design – Uses jQuery Mobile for free • See the demo: – http://demos.jquerymobile.com/ 1.3.0-beta.1/docs/demos/
  • 15. Using Google Charts – https://developers.google.com/chart/
  • 16. HTTP command, URI & representation – HTTP command: GET, PUT, POST, DELETE, … – URI: non-verb resources & it’s hierarchy – Representation : XML, JSON, … AJAX operation var xhr = new XMLHttpRequest(); xhr.open('get', '/temperatures'); xhr.onreadystatechange = function() { // code the event handler here } xhr.send(null);
  • 17. JavaScript Everywhere – Consider 1st class citizen of web for all Internet of Things. Develop more APIs then Apps – App is opened to use but closed to create. – API gives the chance to mash things up. Data is just nothing without visualization – Imagine how the context can be found in data.
  • 18. Design hypermedia API – Achieve the level 3 at Richardson Maturity Level • http://webofthink.tistory.com/2 Design REST to JavaScript API for better development – Make the mash-up and maintenance better – Provide user’s guide with Web IDL Multi-screen web application – Design the process how to develop N-Screen Apps.