Internet of Things (IoT) - workshop with wifi chip

Page 1

Internet of Things(IoT) workshop through wifi chip

FACULTY OF INFORMATICS MAHASARAKHAM UNIVERSITY 17 February 2017

บริษัท เรียลไอที จำกัด

roiet.io 1

Mr. Pairoch Julrat


Agenda Apply Workshop Impact What is IoT

roiet.io

2


What is Internet of Things

Source: OpenSAP

Internet of Things (IoT) or Internet of Everything (IoE) refers to devices or objects that are connected to the Internet, like your smartwatch, lamp, or even your refrigerator. These devices are able to collect and transmit data via the Internet, contributing to our big data world.

roiet.io

3


Evolution of IoT

roiet.io

4


Trend

Source: OpenSAP

roiet.io

Source: Gartner

5


Note: Gartner Hype Cycle 2

5 4 1

roiet.io

3

Source: thailibrary.in.th

6


How Big is the IoT? Some analysts estimate the number of connected devices by 2020. Gartner — 20 billion Cisco — 50 billion Intel — 200 billion

World Population: 7.5 Billion (2017)

roiet.io

7


Economic Impact

roiet.io

McKinsey believes that the market for IoT could reach $11.1 trillion by 2025 8


IP Address Needs •

IPv4, handle a maximum 4.3 billion 
 unique IP addresses

IPv6, expands from 32 bits (IPv4) to 128 bits

IPv6, we will have 340,282,366,920,938,463,463,374,607,431,768,211,456 unique IP addresses. Source: Cisco

roiet.io

9


Make things connected Wireless

roiet.io

Wire

10


Make things connected Wireless

roiet.io

Wire

11


Make things connected

Wifi Chip 10101101

roiet.io

12


Wifi chip ESP

roiet.io

Photon

13


Wifi chip ESP

roiet.io

Photon

14


ESP8266 wifi chip Hardware: 1. CPU 1

2. Memory (RAM/ROM) 3. General Purpose I/O (GPIO)

2 3 ESP-01

roiet.io

15


ESP8266 Models

roiet.io

16


ESP8266 Models Flash = 512KB

Flash = 4MB

roiet.io

17


ESP-01 Pinout

roiet.io

18


ESP-01 GPIO

roiet.io

19


ESP-01 How to program/flashing that chip.

roiet.io

20


ESP-01 Breakout Board

roiet.io

21


ESP-12 Pinout

roiet.io

22


ESP-12 GPIO

roiet.io

23


ESP-12 Breakout Board

EspressoLite

NodeMCU

(ESP-WROOM-02)

roiet.io

24

WeMos


Programing Platform

AT command

roiet.io

Arduino (C)

25

MicroPython


Work Shop!

26


Set Environment Download then Install ArduinoIDE (www.arduino.cc) Start Arduino and open Preferences window. •

Enter http://arduino.esp8266.com/stable/ package_esp8266com_index.json into Additional Board Manager URLs field.

Open Board Manager from Tools > Board > Board Manager and then install esp8266 by ESP8266 Community

roiet.io

27


Set Environment Install dependency libraries •

Open Library Manager (menu Sketch > Include Library > Manage Libraries…) then install libraries you want. DHT sensor library by Adafruit Adafruit GFX Library by Adafruit ESP8266 Oled Driver for SSD1306 display by Daniel Eichborn HttpClient by Adrian McEwen PubSubClient by Nick O'Leary

roiet.io

28


Set Environment USB-Serial communication

RS-232

Sending 0b01010101

TTL / UART

Most microcontrollers these days have built in UARTs (universally asynchronous receiver/transmitter) that can be used to receive and transmit data serially. UARTs transmit one bit at a time at a specified data rate (i.e. 9600bps, 115200bps, etc.). This method of serial communication is sometimes referred to as TTL serial (transistor-transistor logic). Serial communication at a TTL level will always remain between the limits of 0V and Vcc, which is often 5V or 3.3V. The RS-232 standard a logic high ('1') is represented by a negative voltage from -3 to -25V, while a logic low ('0') transmits a positive voltage that can be anywhere from +3 to +25V. On most PCs these signals swing from -13 to +13V. Source: sparkfun.com

roiet.io

29


Set Environment USB-TTL chip (ie. FTDI, CH340, CP2102 )

roiet.io

30


Set Environment Install driver for USB-TTL chip Mac / Linux: Download: http://www.realitlimited.com/training/ msu/2017-02-17/IoT101/CH340_Mac.zip

roiet.io

31


Set Environment Install driver for USB-TTL chip Windows: 
 
 Download: http://www.realitlimited.com/training/ msu/2017-02-17/IoT101/CH34x_Windows.zip
 or http://www.wch.cn/download/CH341SER_EXE.html

roiet.io

32


Flashing Firmware 1. Download Firmware (.bin) www.realitlimited.com/training/msu/2017-02-17/ IoT101/Firmware.zip

roiet.io

33


Flashing Firmware 2. Download Flasher
 2.1 Mac / Linux: #pull the source code from git repository $git clone https://github.com/themadinventor/ esptool.git $cd esptool $sudo python setup.py install 2.2 Windows: www.realitlimited.com/training/msu/2017-02-17/ IoT101/Flasher.zip or https://github.com/nodemcu/nodemcu-flasher roiet.io

34


Flashing Firmware 3. Upload Firmware into Chip 3.1 Mac / Linux: esptool.py -b [baud-rate] -p [device] write_flash [address] [firmware-file-name] Example: esptool.py -p /dev/ttyUSB0 erase_flash esptool.py -b 115200 -p /dev/ttyUSB0 write_flash 0x00000 Officialv1.3.0.2_AT_Firmware.bin

roiet.io

35


Flashing Firmware 3. Upload Firmware into Chip 3.2 Windows:

roiet.io

36


First Test Open Arduino IDE. Select Board & Port

roiet.io

37


First Test Select Baud Rate (Upload Speed): 115200

roiet.io

38


Talking with Chip Serial Monitor

roiet.io

39


Talking with Chip AT Command AT
 
 AT+GMR (version firmware)
 
 AT+CWMODE? (Check mode)
 1=Client
 2=Server(AP)
 3=AP+Client
 
 AT+CWMODE=1
 
 AT+CWLAP (list the Access Point nearly)
 
 AT+CWJAP=“ชื่อ AP”,”ระบุ password”
 
 AT+CIFSR (list the obtained IP & Mac address)

roiet.io

40


Lab1: Hello World 1.1 Coding Structure

roiet.io

41


Lab1: Hello World 1.1 Wiring

LED

Resister

Breadboard

roiet.io

42


Pin Identification WeMos Pin Mapping with Arduino / MicroPython

>Digital pins 6—11 are not shown on this diagram because they are used to connect flash memory chip on most modules. Trying to use these pins as IOs will likely cause the program to crash. >Note that some boards and modules (ESP-12ED, NodeMCU 1.0) also break out pins 9 and 11. These may be used as IO if flash chip works in DIO mode (as opposed to QIO, which is the default one).
 >Pin interrupts are supported through attachInterrupt, detachInterrupt functions. Interrupts may be attached to any GPIO pin, except GPIO16. Standard Arduino interrupt types are supported: CHANGE, RISING, FALLING.

roiet.io

43


Lab2: Analog 2.1 Analog read

roiet.io

44


Lab2: Analog 2.1 Wiring

LED Joy Stick

Resister

Breadboard

roiet.io

45


Lab2: Analog 2.2 Analog read condition to turn on LED

roiet.io

46


Lab2: Analog 2.3 Analog Write to dimming LED

roiet.io

47


Lab3: Arduino 3.1 Hello World same as Lab1

roiet.io

48


Lab3: Hello Arduino 3.1 Hello World same as lab01-Blink

roiet.io

49


Lab4: I2C I2C Wiring Master and Slave

roiet.io

50


Pin Identification Arduino Nano Pin Mapping

roiet.io

51


Pin Identification Arduino UNO Pin Mapping

roiet.io

52


Lab4: I2C 4.1 OLED (lab04.1-OLED-I2C-Polygon) 4.2 OLED (lab04.2-OLED-My-Name)

roiet.io

53


Lab5: Go Internet 5.1 Connect to internet as Wifi Client. (lab05.1-Go-Internet)

roiet.io

54


Lab6: Blynk http://www.blynk.cc/getting-started Blynk is an Internet of Things platform with a drag-n-drop mobile application builder that allows to visualize sensor data and control electronics remotely.

roiet.io

55


Lab6: Blynk Authentication by Token.

roiet.io

56


Lab6: Blynk 6.1 Wiring

LED

Resister

Breadboard

roiet.io

57


Lab6: Blynk 6.1 Wiring Enhance with Relay

LED

Resister

Breadboard

roiet.io

58

Relay


Lab6: Blynk 6.1 Wiring Enhance with Relay

roiet.io

59


Lab7: DHT Temperature & Humidity Sensor

LED DTH11/22

Resister

Breadboard

roiet.io

60


Lab8: Thingspeak 8.1 Send DHT data to Thingspeak

roiet.io

61


MQTT •

A machine-to-machine (M2M)/ IoT protocol.

Lightweight publish/subscribe messaging.

Small sensors and mobile devices.

mqtt.org

roiet.io

62


IFTTT

roiet.io

Source: IFTTT.COM 63


Real World Applications Wireless Emergency Whistle

roiet.io

64


Real World Applications Smart Socks for Diabetics

roiet.io

65


End

ATMs are considered some of the first IoT objects, and went online as far back as 1974. roiet.io

66


THANK YOU

roiet.io

pairoch.julrat

realitlimited.com

pairoch.julrat@gmail.com

095-931-4050

67


68


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.