Slides prepared for the worksop at the Macao Polytechnic Institute on 5th April, 2016.
Please get examples from the following URL:
https://github.com/kotobuki/esp8266_examples
7. IoT Workshop at Macao Polytechnic Institute
What is Internet of Things (IoT)?
• Industrial Internet
http://www.iiconsortium.org/
• Watson Internet of Things
http://www.ibm.com/internet-of-things/
• Target Open House
http://openhouse.target.com/
10. IoT Workshop at Macao Polytechnic Institute
Setting up Your ESP8266 Board
1. Solder headers to your board
2. Turn on the power slide switch
3. Connect a USB (A to Micro B) cable
Source: https://learn.sparkfun.com/tutorials/esp8266-thing-development-board-hookup-guide/hardware-overview
11. IoT Workshop at Macao Polytechnic Institute
Setting up an Environment for ESP8266 #1
1. Install Arduino 1.6.8 from the Arduino website.
2. Start Arduino and open Preferences window (File > Preferences on
Windows, Arduino > Preferences... on Mac OS X).
3. Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json
into Additional Board Manager URLs field.
4. Hit OK. Then navigate to the Board Manager by going to Tools > Boards >
Boards Manager. Look for esp8266. Click on that entry, then select Install.
5. With the Board addon installed, all that’s left to do is select “SparkFun
ESP8266 Thing Dev” from the Tools > Boards menu.
6. Then select your serial port number under the Tools > Port menu.
12.
13.
14.
15. IoT Workshop at Macao Polytechnic Institute
Setting up an Environment for ESP8266 #2
1. Navigate File > Examples > ESP8266 (as a part of Examples from Custom
Libraries) > Blink
2. Hit the button on your Arduino IDE to start uploading
3. If you see the onboard LED is blinking, that means you finished setting up
successfully
16.
17. IoT Workshop at Macao Polytechnic Institute
Setting up an Environment for ESP8266 #3
1. Navigate to Library Manager by going Sketch > Include Library > Manage
Libraries...
2. Look for PubSubClient and install
3. Look for ArduinoJson and install
4. Grab examples from the Dropbox folder and copy to your Arduino folder
5. Open a Serial Monitor by going Tools > Serial Monitor
6. Change the baud rate from 9600 bps (default) to 115200 bps
18.
19. IoT Workshop at Macao Polytechnic Institute
How Different from Arduino Uno?
• A Wi-Fi (802.11 b/g/n) wireless modem is integrated
• The processor is faster and has much memory space
• 3.3V, instead of 5V
• Limited number of pins
• Some pins (i.e. D0) are used for special functions
• The on-board LED is connected to D5, instead of D13
• Only one analog input (i.e. A0) and range is 0 - 1V, instead of 0 - 5V
20. GND GND
Vin Vin
5 D5 LED
0 D0
Used in
reset
4 D4
13 D13 MOSI
12 D12 MISO
16 D16 XPD
ADC A0 10-bit 1V
15 D15
GNDGND
3V33.3V
2D2SDA
14D14SCL/SCLK
RSTReset
TXD7TX
RXD8RX
5VV_USB
NCNot Connected
GNDGND
ESP8266 Thing Dev Board (WRL-13711)Arduino add-on available
80MHz
MicroB USB
3.7-6V
Power connector
Powerswitch
u. antenna connector
Not Connected
To use swap the solder jumper
PCB Antenna
Power (ESP8266 Thing)
Vin: 3.7V-6V
VUSB: 5V
VCC:3.3V @500mA
Max 12mA per I/O pin
Typical Power (ESP8266 module)
Transmit 135-215mA
Receive 60-62mA
Standby 0.9mA
Deep sleep 10uA
LEDs
Power: Red
User (pin 5): Blue
RX: Yellow
TX: Green
Wi-Fi
802.11 b/g/n
Wi-Fi Direct (P2P) soft AP
GPIO0
On bootup will run program if high and bootloader if low
Tied to DTR to run bootloader when reset
Jumpers on back
PWR-LED - cut to disconnect power LED
SLEEP-EN - Connect RST to XPD to enable sleep (disables programming)
Name
Power
GND
Control
Arduino
ADC
Serial
Misc
_
21. IoT Workshop at Macao Polytechnic Institute
IFTTT Primer
1. Point your web browser to https://ifttt.com/ and create an account
2. Install an application for your smart phone (if available)
3. Create a recipe to get familiar with IFTTT terms (e.g. recipes, channels,
triggers, actions and so on)
22. IoT Workshop at Macao Polytechnic Institute
Available Triggers for the Instagram Channel
• Any new photo/video by you
• New photo/video by you with specific hashtag
• New photo by you in area
• You like a photo/video
• New photo/video by specific user
• New photo by anyone in area
• New photo/video by anyone with specific hashtag
23. IoT Workshop at Macao Polytechnic Institute
Example of ESP8266 as a Trigger Device
1. Point your web browser to https://ifttt.com/maker to connect the Maker
channel to your account
2. Copy your key and paste it to your notebook
3. Create a recipe; choose the Maker channel for the trigger and choose
something (e.g. IF Notifications) for the action
4. Connect a button and a resistor to the D4 pin of your board
5. Open IFTTT_Trigger
6. Navigate to a tab named 'config.h' and replace the SSID, password and key
with your's
7. Upload the example to the board, hit the button and see what happens
24.
25. IoT Workshop at Macao Polytechnic Institute
Example of ESP8266 as an Action Device
1. Point your web browser to https://beebotte.com/ and create an account
2. Create a Channel (e.g. ifttt) and a Resource (e.g. action)
3. Copy the Channel Token and paste it to your notebook
4. Create a recipe; choose something (e.g. Instagram) as the trigger and
choose the Maker channel for the action
URL: https://api.beebotte.com/v1/data/write/ifttt/action?token=**********
5. Open IFTTT_Action_Beebotte
6. Navigate to a tab named 'config.h' and replace the SSID, password and key
7. Upload the example to the board
8. Provoke the trigger and see what happens
26.
27.
28.
29.
30. IoT Workshop at Macao Polytechnic Institute
Let’s Try!
1. Create an example to fire a trigger when your indoor brightness changes
(e.g. from bright to dark); How might we convert the voltage range from 0 -
3.3V to 0 - 1V, to fit the range of the analog input pin of your board?
2. Write a code to move a servo motor when something happened (e.g. a
person posted a Tweet); How might we connect a servo motor to your board
and control it?
31. IoT Workshop at Macao Polytechnic Institute
Resources
• ESP8266 Thing Development Board Hookup Guide
https://learn.sparkfun.com/tutorials/esp8266-thing-development-board-
hookup-guide
• Examples
https://github.com/kotobuki/esp8266_examples
• MQTT (MQ Telemetry Transport)
http://mqtt.org/
• Arduino Client for MQTT
http://pubsubclient.knolleary.net/
32. IoT Workshop at Macao Polytechnic Institute
Related Toolkits
• Blynk
http://www.blynk.cc/
• Node-RED
http://nodered.org/