Upload
pairoch-julrat
View
30
Download
1
Embed Size (px)
Citation preview
Internet of Things(IoT)
workshop through wifi chip
บริษัท เรียลไอที จำกัด Mr. Pairoch Julratroiet.io
FACULTY OF INFORMATICSMAHASARAKHAM UNIVERSITY
17 February 2017
1
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.io3
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.io7
Economic Impact
McKinsey believes that the market for IoT could reach
$11.1 trillion by 2025roiet.io8
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.io9
ESP8266 wifi chip
Hardware:
1. CPU
2. Memory (RAM/ROM)
3. General Purpose I/O (GPIO)
1 2
3ESP-01
roiet.io15
Set EnvironmentDownload 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.io27
Set EnvironmentInstall 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.io28
Set EnvironmentUSB-Serial communication
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
TTL / UART
RS-232
Sending 0b01010101
roiet.io29
Set EnvironmentInstall driver for USB-TTL chip
Mac / Linux:
Download: http://www.realitlimited.com/training/msu/2017-02-17/IoT101/CH340_Mac.zip
roiet.io31
Set EnvironmentInstall 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.io32
Flashing Firmware1. Download Firmware (.bin)
www.realitlimited.com/training/msu/2017-02-17/IoT101/Firmware.zip
roiet.io33
Flashing Firmware2. 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.io34
Flashing Firmware3. 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 Official-v1.3.0.2_AT_Firmware.bin
roiet.io35
AT Command
Talking with Chip
roiet.io
ATAT+GMR (version firmware)AT+CWMODE? (Check mode) 1=Client 2=Server(AP) 3=AP+ClientAT+CWMODE=1 AT+CWLAP (list the Access Point nearly) AT+CWJAP=“ชื่อ AP”,”ระบุ password”AT+CIFSR (list the obtained IP & Mac address)
40
Pin IdentificationWeMos Pin Mapping with Arduino / MicroPython
roiet.io
>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.
43
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.
Lab6: Blynk
roiet.io55
• A machine-to-machine (M2M)/ IoT protocol.
• Lightweight publish/subscribe messaging.
• Small sensors and mobile devices.
• mqtt.org
roiet.io
MQTT
62
End
ATMs are considered some of the first IoT objects, and went online as far back as 1974.
roiet.io66