SlideShare uma empresa Scribd logo
1 de 78
Internet of Things
Developments using
NodeMCU and IoT Platform
Jong-Hyun Kim
jhkim@dit.ac.kr
Dept. of Computer & Information
DONG-EUI INSTITUTE OF TECHNOLOGY
Summer Session KINGS 2019
Table of Contents
• Introduction to NodeMCU
• Basic Ardunio Programming on NodeMCU
• Ardunio Digital I/O Functions
• Circuit Wiring
• Simple LED Control
• Reading Humidity & Temperature Sensor Values
• IoT Cloud Platforms
• Ubidots
• Hands-on Lab 01
• IoT based Real Time Humidity & Temperature Monitor
• Hands-on Lab 02
• Smart Switch Controller
• Future Study Topics
IoT Development Toolkits
• Open Source Hardware Platforms
NodeMCU/ ESP8266
• NodeMCU : An open source IoT platform. It includes firmware which runs on
the ESP8266 Wi-Fi SoC from Espressif Systems, and hardware which is based on
the ESP-12 module.
• ESP8266 : a low cost Wi-Fi microchip with full TCP/IP stack and
microcontroller capability produced by Shanghai-based Chinese manufacturer,
Espressif Systems.
NodeMCU Development Kits
• The Development Kit based on ESP8266
• Integrates GPIO, PWM, I2C, 1-Wire and ADC all in one board
• Growth of ESP8266 modules
NodeMCU : Open Source H/W Platform
NodeMCU GOIP
NodeMCU GOIP
• GPIO 0,2,15 : booting mode setting
• GPIO 1,3 : Serial Communication
• GPIO 6~11 : flash memory
• GPIO 16 : sleep mode
• Unrestricted GPIO Pins
- GPIO 4(D2), GPIO 5(D1), GPIO 12~14(D6,D7,D5)
- internal LED : GPIO 2(D4)
NodeMCU Development Environments
• LUA : Script language, Interpreter
NodeMCU Development Environments
• Ardunio IDE : CC++, Compiler
Adruino Programming for NodeMCU
• https://www.ardunio.cc
• Connect USB microcable to PC
• Open Device manager of PC, check Silicon Labs CP201x USB to UART Bridge
• Executing Arduino IDE
• Setting Board Manager URLs
• Preferences -> Additional Board Manager URLs
“http://arduino.esp8266.com/stable/package_esp8266com_index.json”
• Setting Board Manager
• Setting Board Manager : Search “esp8266 by ESP8266
Community”
• Setting Board Manager : Select NodeMCU 1.0(ESP-12E Module)
• Setting serial port
Arduino Programming Basics
Hello World!
void setup() {
// put your setup code here, to
run once:
Serial.begin(115200);
}
void loop() {
// put your main code here, to run
repeatly:
Serial.print("Hello Worldn");
}
Arduino Digital I/O functions
• pinMode(pin, mode)
- Configures the specified pin to behave either as an input or an
output.
• digitalWrite(pin, value)
- Write a HIGH(5V or 3.3V) or a LOW(0V or ground) value to a
digital pin
• delay(ms)
- Pauses the program for the amount of time (in milliseconds) specified as
parameter.
• https://www.arduino.cc/reference/en/
Basic LED Control on NodeMCU
• Preparation materials
Register
220 ΩNodeMCU Jump Cables LED
Internal LED : LED_BUILTIN
Circuit Wiring
• LED_BUILITIN -> D4
Operation of Internal LED : D4 pin
LED Control : D2 pin
LED Control : D2 pin
Operation of LED : D2 pin
Reading Humidity and Temperature
on NodeMCU
• Preparation materials
NodeMCU Jump Cables DHT11 Sensor
16x2 LCD Module
Circuit Wiring
DHT Sensor Library(1)
• Menu -> Sketch -> Include -> Library -> Manage Libraries
Adafruit Unified Sensor Library(2)
• Menu -> Sketch -> Include -> Library -> Manage Libraries
Sketch
16x2 I2C LCD Display
OLED Display
LCD I2C Pin connection
LCD NodeMCU
GND GND
VCC 3.3V
SDA D2
SCL D1
Circuit Wiring
16x2 LCD Cursor Matrix
LiquidCrystal-I2C-library
• Create a new folder called "LiquidCrystal_I2C" under the
folder named "libraries" in your Arduino sketchbook folder.
• Create the folder "libraries" in case it does not exist yet. Place
all the files in the "LiquidCrystal_I2C" folder.
- https://github.com/fdebrabander/Arduino-LiquidCrystal-
I2C-library
Sketch
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <DHT.h>
#define DHTPIN D4
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal_I2C lcd(0x27,16,2);
void setup() {
Serial.begin(115200);
dht.begin();
// lcd init
lcd.begin();
// lcd back light on
lcd.backlight();
//lcd.print("Test");
}
void loop() {
float temp = dht.readTemperature();
float humi = dht.readHumidity();
Serial.print("Temp: ");
Serial.print(temp);
Serial.print(" Humi: ");
Serial.println(humi);
// LCD Display
// LCD Cursor change to (0,0)
lcd.setCursor(0,0);
lcd.print("Temp: ");
lcd.print(temp);
// LCD Cursor change to (0,1)
lcd.setCursor(0,1);
lcd.print("Humi: ");
lcd.print(humi);
delay(1000);
}
IoT Cloud Platform Landscape
• https://www.postscapes.com/internet-of-things-platforms/
Ubidots : IoT Cloud Platform
• Ubidots Education : https://ubidots.com/education/
- Sign Up ->
https://ubidots.com/platform/
Lab 01 : IoT based Real Time
Humidity/ Temperature Monitor
Ubidots Library(1)
• Download the UbidotsMicroESP8266 library
- https://github.com/ubidots/ubidots-esp8266
• Select Download ZIP file
Ubidots Library(2)
• Click on Sketch -> Include Library -> Add .ZIP library
• Select the .ZIP file of UbidotsMicro8266 and the “Accept”
• Close the Ardunio IDE and open it again.
Copy your Ubidots Token
Ubidots Basics: Devices, Variables, Dashboards
https://help.ubidots.com/en/articles/854333-ubidots-basics-devices-variables-dashboards-and-alerts
Chart, Graph...
DEVICES
VARIABLES
ESP8266
Variable 2:
Temperature
Variable 3:
Pressure
Variable 1:
Humidity
DASHBOARDS
Sending DHT11 Sensor Values to Ubidots Cloud
#include <DHT.h>
#include "UbidotsMicroESP8266.h"
#define TOKEN “xxxxx“ // put here your Ubidits token
#define WIFISSID "melon"
#define PASSWORD "deitcs3217"
#define DHTPIN D4
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
Ubidots client(TOKEN);
void setup() {
Serial.begin(115200);
dht.begin();
client.wifiConnection(WIFISSID, PASSWORD);
}
void loop() {
float temp = dht.readTemperature();
float humi = dht.readHumidity();
Serial.print("Temp: ");
Serial.print(temp);
Serial.print(" Humi: ");
Serial.println(humi);
// Temperature, Humidity is variable labels
// of Ubidots
client.add("Temperature", temp);
client.add("Humidity", humi);
client.sendAll(true);
delay(1000);
}
• Sending values using the variable label
• Reference : https://github.com/kings-iot-2019/ubidots-esp8266
Devices Creation : ESP8266
• Wait for the device(ESP8266) to appear
• The library(UbidotsMicroESP8266.h) will create a new Ubidots data source named "ESP8266"
Devices Status(1)
Devices Status(2)
Dashboards Creation : Add new widget
Dashboard Creation : Add Variable
Dashboard Creation: Select a Device, a Varibale
Dashboards : Chart, Table -> Historical Data
Dashboards : Indicator -> Gauge
Lab 02 : Smart Switch Controller
Circuit Wiring
Input Code, Build & upload
#include "UbidotsMicroESP8266.h"
#define DEVICE "smartled" //your Ubidots device label
#define VARIABLE "ledValue" //your Ubidots variable label
// Put here your Ubidots TOKEN
#define TOKEN “xxxx…………"
#define WIFISSID "melon"
#define PASSWORD "deitcs3217"
#define LED_PIN D2
Ubidots client(TOKEN);
void setup() {
Serial.begin(115200);
client.wifiConnection(WIFISSID, PASSWORD);
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, 1);
}
void loop() {
float value = client.getValueWithDevice(DEVICE, VARIABLE);
if (value != ERROR_VALUE){
Serial.print("value obtained: ");
Serial.println(value);
if(value == 1) digitalWrite(LED_PIN, HIGH);
else digitalWrite(LED_PIN, LOW);
}else{
Serial.println("Error getting value");
}
delay(1000);
}
Device Creation
• MyDevices -> My Data Source -> SmartLEDController
Setting Variables
Dashboard : Add widgets
Dashboard : Select a Device, a Variable
Dashboard Creation : Control -> Switch
Dashboard : Smart Switch Controller
Serial Monitor of LED Control
Operation of IoT Devices
Mobile Application : Ubidots Explorer
• https://play.google.com/store/apps/details?id=com.ubidots.ubiapp
Rest API of Ubidots Cloud
• https://ubidots.com/docs/hw/#send-data-to-a-device
Retrieve Data : Multiple Value from Variables
Custom Application Developments
Ubidots
Cloud
Mobile
Applications
Web Applications
3rd party Systems
JSON
JSON
Rest
API
JSON
Future Study Topics
• IoT Communication Protocols
• Ubidots MQTT...
• https://github.com/ubidots/ubidots-mqtt-esp
• https://ubidots.com/blog/temperature-control-with-ubidots/
• Machine Learning
• Prediction, Optimization
• Apply IoT to field areas
• Smart Radiological Monitoring
• http://xn--9h1bl4ppra42jdxj66bd3b.xn--3e0b707e/info_02.html
• Smart Energy :
• Energy-As-A-Service : http://tiny.cc/iigb9y
• Smart Farm
• Smart Home
• Smart Healthcare
• Smart Transportation
• Smart Factory
• Smart City …
Source Codes & Libraries
• GitHub : https://github.com/kings-iot-2019
References
1. https://www.theengineeringprojects.com/2018/10/introduction-to-nodemcu-v3.html
2. http://pdacontrolen.com/tutorial-platform-iot-ubidots-esp8266-sensor-dht11/
3. https://www.hackster.io/ubidots/projects
4. https://ubidots.com/education/
5. https://ubidots.com/docs/

Mais conteúdo relacionado

Mais procurados

IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...
IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...
IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...
David Fowler
 
Home automation-in-the-cloud-with-the-esp8266-and-adafruit-io
Home automation-in-the-cloud-with-the-esp8266-and-adafruit-ioHome automation-in-the-cloud-with-the-esp8266-and-adafruit-io
Home automation-in-the-cloud-with-the-esp8266-and-adafruit-io
Tran Minh Nhut
 

Mais procurados (20)

Esp8266 hack sonoma county 4/8/2015
Esp8266 hack sonoma county 4/8/2015Esp8266 hack sonoma county 4/8/2015
Esp8266 hack sonoma county 4/8/2015
 
NodeMCU with Blynk and Firebase
NodeMCU with Blynk and FirebaseNodeMCU with Blynk and Firebase
NodeMCU with Blynk and Firebase
 
Arduino & NodeMcu
Arduino & NodeMcuArduino & NodeMcu
Arduino & NodeMcu
 
Esp8266 - Intro for dummies
Esp8266 - Intro for dummiesEsp8266 - Intro for dummies
Esp8266 - Intro for dummies
 
Adafruit Huzzah Esp8266 WiFi Board
Adafruit Huzzah Esp8266 WiFi BoardAdafruit Huzzah Esp8266 WiFi Board
Adafruit Huzzah Esp8266 WiFi Board
 
Arduino Meetup with Sonar and 433Mhz Radios
Arduino Meetup with Sonar and 433Mhz RadiosArduino Meetup with Sonar and 433Mhz Radios
Arduino Meetup with Sonar and 433Mhz Radios
 
ESP8266 Wifi Nodemcu
ESP8266 Wifi Nodemcu ESP8266 Wifi Nodemcu
ESP8266 Wifi Nodemcu
 
Espresso Lite v2 - ESP8266 Overview
Espresso Lite v2 - ESP8266 OverviewEspresso Lite v2 - ESP8266 Overview
Espresso Lite v2 - ESP8266 Overview
 
WiFi SoC ESP8266
WiFi SoC ESP8266WiFi SoC ESP8266
WiFi SoC ESP8266
 
IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...
IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...
IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...
 
Home automation-in-the-cloud-with-the-esp8266-and-adafruit-io
Home automation-in-the-cloud-with-the-esp8266-and-adafruit-ioHome automation-in-the-cloud-with-the-esp8266-and-adafruit-io
Home automation-in-the-cloud-with-the-esp8266-and-adafruit-io
 
Programming esp8266
Programming esp8266Programming esp8266
Programming esp8266
 
Esp8266 Workshop
Esp8266 WorkshopEsp8266 Workshop
Esp8266 Workshop
 
ESP8266 and IOT
ESP8266 and IOTESP8266 and IOT
ESP8266 and IOT
 
Esp8266 basics
Esp8266 basicsEsp8266 basics
Esp8266 basics
 
Rdl esp32 development board trainer kit
Rdl esp32 development board trainer kitRdl esp32 development board trainer kit
Rdl esp32 development board trainer kit
 
Build WiFi gadgets using esp8266
Build WiFi gadgets using esp8266Build WiFi gadgets using esp8266
Build WiFi gadgets using esp8266
 
Cassiopeia Ltd - ESP8266+Arduino workshop
Cassiopeia Ltd - ESP8266+Arduino workshopCassiopeia Ltd - ESP8266+Arduino workshop
Cassiopeia Ltd - ESP8266+Arduino workshop
 
IOT Talking to Webserver - how to
IOT Talking to Webserver - how to IOT Talking to Webserver - how to
IOT Talking to Webserver - how to
 
Espressif Introduction
Espressif IntroductionEspressif Introduction
Espressif Introduction
 

Semelhante a IoT Hands-On-Lab, KINGS, 2019

Semelhante a IoT Hands-On-Lab, KINGS, 2019 (20)

Esp8266 v12
Esp8266 v12Esp8266 v12
Esp8266 v12
 
arduinoedit.pptx
arduinoedit.pptxarduinoedit.pptx
arduinoedit.pptx
 
ESP32 WiFi & Bluetooth Module - Getting Started Guide
ESP32 WiFi & Bluetooth Module - Getting Started GuideESP32 WiFi & Bluetooth Module - Getting Started Guide
ESP32 WiFi & Bluetooth Module - Getting Started Guide
 
Arduino by bishal bhattarai IOE, Pashchimanchal Campus Pokhara, Nepal
Arduino by bishal bhattarai  IOE, Pashchimanchal Campus Pokhara, NepalArduino by bishal bhattarai  IOE, Pashchimanchal Campus Pokhara, Nepal
Arduino by bishal bhattarai IOE, Pashchimanchal Campus Pokhara, Nepal
 
RAHUL NASKAR IOT.ppt
RAHUL NASKAR IOT.pptRAHUL NASKAR IOT.ppt
RAHUL NASKAR IOT.ppt
 
Introduction to Node MCU
Introduction to Node MCUIntroduction to Node MCU
Introduction to Node MCU
 
Road to RIoT 2017 Medan
Road to RIoT 2017 MedanRoad to RIoT 2017 Medan
Road to RIoT 2017 Medan
 
Republic of IoT 2018 - ESPectro32 and NB-IoT Workshop
Republic of IoT 2018 - ESPectro32 and NB-IoT WorkshopRepublic of IoT 2018 - ESPectro32 and NB-IoT Workshop
Republic of IoT 2018 - ESPectro32 and NB-IoT Workshop
 
Developing a NodeBot using Intel XDK IoT Edition
Developing a NodeBot using Intel XDK IoT EditionDeveloping a NodeBot using Intel XDK IoT Edition
Developing a NodeBot using Intel XDK IoT Edition
 
Wi-Fi Esp8266 nodemcu
Wi-Fi Esp8266 nodemcu Wi-Fi Esp8266 nodemcu
Wi-Fi Esp8266 nodemcu
 
Introducing the Arduino
Introducing the ArduinoIntroducing the Arduino
Introducing the Arduino
 
IoT with openHAB on pcDuino3B
IoT with openHAB on pcDuino3BIoT with openHAB on pcDuino3B
IoT with openHAB on pcDuino3B
 
Intel galileo
Intel galileoIntel galileo
Intel galileo
 
Introduction of Arduino Uno
Introduction of Arduino UnoIntroduction of Arduino Uno
Introduction of Arduino Uno
 
IoT Getting Started with Intel® IoT Devkit
IoT Getting Started with Intel® IoT DevkitIoT Getting Started with Intel® IoT Devkit
IoT Getting Started with Intel® IoT Devkit
 
Getting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitGetting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer Kit
 
Introduction to FreeRTOS
Introduction to FreeRTOSIntroduction to FreeRTOS
Introduction to FreeRTOS
 
Geek Pic-Nic Master Class
Geek Pic-Nic Master ClassGeek Pic-Nic Master Class
Geek Pic-Nic Master Class
 
NodeMCU 0.9 Manual using Arduino IDE
NodeMCU 0.9 Manual using Arduino IDENodeMCU 0.9 Manual using Arduino IDE
NodeMCU 0.9 Manual using Arduino IDE
 
Начало работы с Intel IoT Dev Kit
Начало работы с Intel IoT Dev KitНачало работы с Intel IoT Dev Kit
Начало работы с Intel IoT Dev Kit
 

Mais de Jong-Hyun Kim

Mais de Jong-Hyun Kim (20)

파이썬 AI 드론 프로그래밍
파이썬 AI 드론 프로그래밍파이썬 AI 드론 프로그래밍
파이썬 AI 드론 프로그래밍
 
Google Teachable machine을 이용한 AI 서비스 만들기
Google Teachable machine을 이용한  AI 서비스 만들기Google Teachable machine을 이용한  AI 서비스 만들기
Google Teachable machine을 이용한 AI 서비스 만들기
 
모두의 AI 교육 : 산 ⦁ 학 ⦁ 관 협력으로 모색해 보는 부산 AI 교육
모두의 AI 교육 : 산 ⦁ 학 ⦁ 관 협력으로 모색해 보는 부산 AI 교육모두의 AI 교육 : 산 ⦁ 학 ⦁ 관 협력으로 모색해 보는 부산 AI 교육
모두의 AI 교육 : 산 ⦁ 학 ⦁ 관 협력으로 모색해 보는 부산 AI 교육
 
고등직업교육에서의 AI 교육 사례 및 방향
고등직업교육에서의 AI 교육 사례 및 방향고등직업교육에서의 AI 교육 사례 및 방향
고등직업교육에서의 AI 교육 사례 및 방향
 
Edge AI 및 학생 프로젝트 소개
Edge AI 및 학생 프로젝트 소개Edge AI 및 학생 프로젝트 소개
Edge AI 및 학생 프로젝트 소개
 
초보 유투버의 IT과목 실시간 온.오프라인 융합 강의 사례
초보 유투버의 IT과목 실시간 온.오프라인 융합 강의 사례초보 유투버의 IT과목 실시간 온.오프라인 융합 강의 사례
초보 유투버의 IT과목 실시간 온.오프라인 융합 강의 사례
 
Busan Citizen Censor : 부산 시민 참여 스마트시티 오픈데이터 플랫폼
Busan Citizen Censor : 부산 시민 참여 스마트시티 오픈데이터 플랫폼 Busan Citizen Censor : 부산 시민 참여 스마트시티 오픈데이터 플랫폼
Busan Citizen Censor : 부산 시민 참여 스마트시티 오픈데이터 플랫폼
 
부산 전기차(EV) 충전소 네비게이션 모바일 앱 개발
부산 전기차(EV) 충전소 네비게이션 모바일 앱 개발 부산 전기차(EV) 충전소 네비게이션 모바일 앱 개발
부산 전기차(EV) 충전소 네비게이션 모바일 앱 개발
 
micro:bit 프로그래밍 기초
micro:bit 프로그래밍 기초 micro:bit 프로그래밍 기초
micro:bit 프로그래밍 기초
 
프로브 차량(Porbe Vehicle)을 이용한 IoT 기반 실시간 환경 모니터링 시스템
프로브 차량(Porbe Vehicle)을 이용한 IoT 기반 실시간 환경 모니터링 시스템프로브 차량(Porbe Vehicle)을 이용한 IoT 기반 실시간 환경 모니터링 시스템
프로브 차량(Porbe Vehicle)을 이용한 IoT 기반 실시간 환경 모니터링 시스템
 
딥러닝을 이용한 컬러 테라피 메디컬 IoT 스마트 미러
딥러닝을 이용한 컬러 테라피 메디컬 IoT 스마트 미러딥러닝을 이용한 컬러 테라피 메디컬 IoT 스마트 미러
딥러닝을 이용한 컬러 테라피 메디컬 IoT 스마트 미러
 
모션 인식을 이용한 스마트 안전 헬맷 개발 및 자전거 사고 빅데이터 분석
모션 인식을 이용한 스마트 안전 헬맷 개발 및 자전거 사고 빅데이터 분석모션 인식을 이용한 스마트 안전 헬맷 개발 및 자전거 사고 빅데이터 분석
모션 인식을 이용한 스마트 안전 헬맷 개발 및 자전거 사고 빅데이터 분석
 
딥러닝을 이용한 지능형 IoT 스마트 홈 미러
딥러닝을 이용한 지능형 IoT 스마트 홈 미러딥러닝을 이용한 지능형 IoT 스마트 홈 미러
딥러닝을 이용한 지능형 IoT 스마트 홈 미러
 
클라우드 기반 지능형 IoT 공기청정기
클라우드 기반 지능형 IoT 공기청정기클라우드 기반 지능형 IoT 공기청정기
클라우드 기반 지능형 IoT 공기청정기
 
스마트 공기 톡톡
스마트 공기 톡톡스마트 공기 톡톡
스마트 공기 톡톡
 
데이터를 통한 지역 시민과의 소통 : 데이터의 공개와 활용
데이터를 통한 지역 시민과의 소통 : 데이터의 공개와 활용데이터를 통한 지역 시민과의 소통 : 데이터의 공개와 활용
데이터를 통한 지역 시민과의 소통 : 데이터의 공개와 활용
 
모두를 위한 소프트웨어 교육 : 초등학교의 프로젝트 기반 창의융합 SW 교육 사례
모두를 위한 소프트웨어 교육 : 초등학교의 프로젝트 기반 창의융합  SW 교육 사례모두를 위한 소프트웨어 교육 : 초등학교의 프로젝트 기반 창의융합  SW 교육 사례
모두를 위한 소프트웨어 교육 : 초등학교의 프로젝트 기반 창의융합 SW 교육 사례
 
동의대학교 산업융합시스템학부 특강
동의대학교 산업융합시스템학부 특강동의대학교 산업융합시스템학부 특강
동의대학교 산업융합시스템학부 특강
 
부산 알로이시오 초등학교 창의융합 SW 교육 사례
부산 알로이시오 초등학교 창의융합 SW 교육 사례부산 알로이시오 초등학교 창의융합 SW 교육 사례
부산 알로이시오 초등학교 창의융합 SW 교육 사례
 
데이터를 통한 시민과의 소통
데이터를 통한 시민과의 소통데이터를 통한 시민과의 소통
데이터를 통한 시민과의 소통
 

Último

Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 

Último (20)

Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 

IoT Hands-On-Lab, KINGS, 2019

  • 1. Internet of Things Developments using NodeMCU and IoT Platform Jong-Hyun Kim jhkim@dit.ac.kr Dept. of Computer & Information DONG-EUI INSTITUTE OF TECHNOLOGY Summer Session KINGS 2019
  • 2.
  • 3. Table of Contents • Introduction to NodeMCU • Basic Ardunio Programming on NodeMCU • Ardunio Digital I/O Functions • Circuit Wiring • Simple LED Control • Reading Humidity & Temperature Sensor Values • IoT Cloud Platforms • Ubidots • Hands-on Lab 01 • IoT based Real Time Humidity & Temperature Monitor • Hands-on Lab 02 • Smart Switch Controller • Future Study Topics
  • 4. IoT Development Toolkits • Open Source Hardware Platforms
  • 5. NodeMCU/ ESP8266 • NodeMCU : An open source IoT platform. It includes firmware which runs on the ESP8266 Wi-Fi SoC from Espressif Systems, and hardware which is based on the ESP-12 module. • ESP8266 : a low cost Wi-Fi microchip with full TCP/IP stack and microcontroller capability produced by Shanghai-based Chinese manufacturer, Espressif Systems.
  • 6. NodeMCU Development Kits • The Development Kit based on ESP8266 • Integrates GPIO, PWM, I2C, 1-Wire and ADC all in one board • Growth of ESP8266 modules
  • 7. NodeMCU : Open Source H/W Platform
  • 9. NodeMCU GOIP • GPIO 0,2,15 : booting mode setting • GPIO 1,3 : Serial Communication • GPIO 6~11 : flash memory • GPIO 16 : sleep mode • Unrestricted GPIO Pins - GPIO 4(D2), GPIO 5(D1), GPIO 12~14(D6,D7,D5) - internal LED : GPIO 2(D4)
  • 10. NodeMCU Development Environments • LUA : Script language, Interpreter
  • 11. NodeMCU Development Environments • Ardunio IDE : CC++, Compiler
  • 12. Adruino Programming for NodeMCU • https://www.ardunio.cc
  • 13. • Connect USB microcable to PC • Open Device manager of PC, check Silicon Labs CP201x USB to UART Bridge
  • 15. • Setting Board Manager URLs • Preferences -> Additional Board Manager URLs “http://arduino.esp8266.com/stable/package_esp8266com_index.json”
  • 16. • Setting Board Manager
  • 17. • Setting Board Manager : Search “esp8266 by ESP8266 Community”
  • 18. • Setting Board Manager : Select NodeMCU 1.0(ESP-12E Module)
  • 21. Hello World! void setup() { // put your setup code here, to run once: Serial.begin(115200); } void loop() { // put your main code here, to run repeatly: Serial.print("Hello Worldn"); }
  • 22. Arduino Digital I/O functions • pinMode(pin, mode) - Configures the specified pin to behave either as an input or an output. • digitalWrite(pin, value) - Write a HIGH(5V or 3.3V) or a LOW(0V or ground) value to a digital pin • delay(ms) - Pauses the program for the amount of time (in milliseconds) specified as parameter. • https://www.arduino.cc/reference/en/
  • 23. Basic LED Control on NodeMCU • Preparation materials Register 220 ΩNodeMCU Jump Cables LED
  • 24. Internal LED : LED_BUILTIN
  • 26. Operation of Internal LED : D4 pin
  • 27. LED Control : D2 pin
  • 28. LED Control : D2 pin
  • 29. Operation of LED : D2 pin
  • 30. Reading Humidity and Temperature on NodeMCU • Preparation materials NodeMCU Jump Cables DHT11 Sensor 16x2 LCD Module
  • 32. DHT Sensor Library(1) • Menu -> Sketch -> Include -> Library -> Manage Libraries
  • 33. Adafruit Unified Sensor Library(2) • Menu -> Sketch -> Include -> Library -> Manage Libraries
  • 35. 16x2 I2C LCD Display
  • 37. LCD I2C Pin connection LCD NodeMCU GND GND VCC 3.3V SDA D2 SCL D1
  • 39. 16x2 LCD Cursor Matrix
  • 40. LiquidCrystal-I2C-library • Create a new folder called "LiquidCrystal_I2C" under the folder named "libraries" in your Arduino sketchbook folder. • Create the folder "libraries" in case it does not exist yet. Place all the files in the "LiquidCrystal_I2C" folder. - https://github.com/fdebrabander/Arduino-LiquidCrystal- I2C-library
  • 41. Sketch #include <Wire.h> #include <LiquidCrystal_I2C.h> #include <DHT.h> #define DHTPIN D4 #define DHTTYPE DHT11 DHT dht(DHTPIN, DHTTYPE); LiquidCrystal_I2C lcd(0x27,16,2); void setup() { Serial.begin(115200); dht.begin(); // lcd init lcd.begin(); // lcd back light on lcd.backlight(); //lcd.print("Test"); } void loop() { float temp = dht.readTemperature(); float humi = dht.readHumidity(); Serial.print("Temp: "); Serial.print(temp); Serial.print(" Humi: "); Serial.println(humi); // LCD Display // LCD Cursor change to (0,0) lcd.setCursor(0,0); lcd.print("Temp: "); lcd.print(temp); // LCD Cursor change to (0,1) lcd.setCursor(0,1); lcd.print("Humi: "); lcd.print(humi); delay(1000); }
  • 42. IoT Cloud Platform Landscape • https://www.postscapes.com/internet-of-things-platforms/
  • 43. Ubidots : IoT Cloud Platform • Ubidots Education : https://ubidots.com/education/ - Sign Up ->
  • 45. Lab 01 : IoT based Real Time Humidity/ Temperature Monitor
  • 46. Ubidots Library(1) • Download the UbidotsMicroESP8266 library - https://github.com/ubidots/ubidots-esp8266 • Select Download ZIP file
  • 47. Ubidots Library(2) • Click on Sketch -> Include Library -> Add .ZIP library • Select the .ZIP file of UbidotsMicro8266 and the “Accept” • Close the Ardunio IDE and open it again.
  • 49. Ubidots Basics: Devices, Variables, Dashboards https://help.ubidots.com/en/articles/854333-ubidots-basics-devices-variables-dashboards-and-alerts Chart, Graph... DEVICES VARIABLES ESP8266 Variable 2: Temperature Variable 3: Pressure Variable 1: Humidity DASHBOARDS
  • 50. Sending DHT11 Sensor Values to Ubidots Cloud #include <DHT.h> #include "UbidotsMicroESP8266.h" #define TOKEN “xxxxx“ // put here your Ubidits token #define WIFISSID "melon" #define PASSWORD "deitcs3217" #define DHTPIN D4 #define DHTTYPE DHT11 DHT dht(DHTPIN, DHTTYPE); Ubidots client(TOKEN); void setup() { Serial.begin(115200); dht.begin(); client.wifiConnection(WIFISSID, PASSWORD); } void loop() { float temp = dht.readTemperature(); float humi = dht.readHumidity(); Serial.print("Temp: "); Serial.print(temp); Serial.print(" Humi: "); Serial.println(humi); // Temperature, Humidity is variable labels // of Ubidots client.add("Temperature", temp); client.add("Humidity", humi); client.sendAll(true); delay(1000); } • Sending values using the variable label • Reference : https://github.com/kings-iot-2019/ubidots-esp8266
  • 51. Devices Creation : ESP8266 • Wait for the device(ESP8266) to appear • The library(UbidotsMicroESP8266.h) will create a new Ubidots data source named "ESP8266"
  • 54. Dashboards Creation : Add new widget
  • 55. Dashboard Creation : Add Variable
  • 56. Dashboard Creation: Select a Device, a Varibale
  • 57. Dashboards : Chart, Table -> Historical Data
  • 59. Lab 02 : Smart Switch Controller
  • 61. Input Code, Build & upload #include "UbidotsMicroESP8266.h" #define DEVICE "smartled" //your Ubidots device label #define VARIABLE "ledValue" //your Ubidots variable label // Put here your Ubidots TOKEN #define TOKEN “xxxx…………" #define WIFISSID "melon" #define PASSWORD "deitcs3217" #define LED_PIN D2 Ubidots client(TOKEN); void setup() { Serial.begin(115200); client.wifiConnection(WIFISSID, PASSWORD); pinMode(LED_PIN, OUTPUT); digitalWrite(LED_PIN, 1); } void loop() { float value = client.getValueWithDevice(DEVICE, VARIABLE); if (value != ERROR_VALUE){ Serial.print("value obtained: "); Serial.println(value); if(value == 1) digitalWrite(LED_PIN, HIGH); else digitalWrite(LED_PIN, LOW); }else{ Serial.println("Error getting value"); } delay(1000); }
  • 62. Device Creation • MyDevices -> My Data Source -> SmartLEDController
  • 64. Dashboard : Add widgets
  • 65. Dashboard : Select a Device, a Variable
  • 66. Dashboard Creation : Control -> Switch
  • 67. Dashboard : Smart Switch Controller
  • 68. Serial Monitor of LED Control
  • 69. Operation of IoT Devices
  • 70. Mobile Application : Ubidots Explorer • https://play.google.com/store/apps/details?id=com.ubidots.ubiapp
  • 71. Rest API of Ubidots Cloud • https://ubidots.com/docs/hw/#send-data-to-a-device
  • 72. Retrieve Data : Multiple Value from Variables
  • 73. Custom Application Developments Ubidots Cloud Mobile Applications Web Applications 3rd party Systems JSON JSON Rest API JSON
  • 74. Future Study Topics • IoT Communication Protocols
  • 75. • Ubidots MQTT... • https://github.com/ubidots/ubidots-mqtt-esp • https://ubidots.com/blog/temperature-control-with-ubidots/
  • 76. • Machine Learning • Prediction, Optimization
  • 77. • Apply IoT to field areas • Smart Radiological Monitoring • http://xn--9h1bl4ppra42jdxj66bd3b.xn--3e0b707e/info_02.html • Smart Energy : • Energy-As-A-Service : http://tiny.cc/iigb9y • Smart Farm • Smart Home • Smart Healthcare • Smart Transportation • Smart Factory • Smart City …
  • 78. Source Codes & Libraries • GitHub : https://github.com/kings-iot-2019 References 1. https://www.theengineeringprojects.com/2018/10/introduction-to-nodemcu-v3.html 2. http://pdacontrolen.com/tutorial-platform-iot-ubidots-esp8266-sensor-dht11/ 3. https://www.hackster.io/ubidots/projects 4. https://ubidots.com/education/ 5. https://ubidots.com/docs/