0% found this document useful (0 votes)
36 views

Arduino OK OK

This document discusses using Arduino and ESP8266 microcontrollers for IoT applications. It provides an overview of the Arduino platform and programming and then describes the ESP8266 chip, which has WiFi capabilities. Examples are presented that show reading data from sensors, controlling actuators, and pushing data to an online platform called ThingSpeak. Finally, the document proposes building an autonomous wireless sensor network using multiple ESP8266 chips that can self-organize if one fails.

Uploaded by

DynoCr
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

Arduino OK OK

This document discusses using Arduino and ESP8266 microcontrollers for IoT applications. It provides an overview of the Arduino platform and programming and then describes the ESP8266 chip, which has WiFi capabilities. Examples are presented that show reading data from sensors, controlling actuators, and pushing data to an online platform called ThingSpeak. Finally, the document proposes building an autonomous wireless sensor network using multiple ESP8266 chips that can self-organize if one fails.

Uploaded by

DynoCr
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

Arduino and ESP8266

Luca Bedogni
[email protected]
Sistemi Mobili 2016
Outline

Arduino: a primer

ESP8266

Serial Monitor

Reading From a Sensor and using Actuators

Pushing data to ThingSpeak

Autonomous network
What is Arduino

•  Open source prototyping platform


•  Own C-Like language
•  Cheap
•  Cross Platform
Arduino UNO
Arduino DUE
Lilypad
How to program it?
C-like syntax

Two methods:
-  void setup()
-  void loop()

One editor for all platforms

Library extensible

Single compile-upload button

Integrated Serial monitor


Community
ESP8266

•  System on Chip (SoC)


•  Low cost
•  Full TCP/IP stack (!!!!)
•  Can be flashed with different firmwares
•  Can also be programmed with Arduino IDE
•  Many models
… but how many?
ESP8266-01
•  802.11 b/g/n
•  Input power: 3.3V
•  I/O voltage tolerance: 3.6V Max
•  Regular operation current draw: ~70mA
•  Peak operating current draw: ~300mA
•  Power down leakage current: <10µA
•  +19.5dBm output in 802.11b mode
•  Flash Memory Size: 1MB (8Mbit)
•  WiFi security modes: WPA, WPA2
•  Module's dimensions: 24.75mm x 14.5mm
ESP8266-12

•  802.11 b/g/n
•  Input power: 3.3V
•  Integrated 10-bit ADC
•  Deep sleep power <10uA
•  Power down leakage current < 5uA
•  Wake up and transmit packets in < 2ms
•  Standby power consumption of < 1.0mW
(DTIM3)
•  +20 dBm output power in 802.11b mode
Wiring (ESP8266-01)
RX

VCC

GPIO_0
RST

GPIO_2

CH_PD
GND

TX

ESP8266-01 USB-SERIAL
RX TX
TX RX
CH_PD 3.3 V
VCC 3.3 V
GND GND
GPIO_0 GND (when flashing)
A first example

•  Serial interface to arduino


•  void setup() is executed once
•  void loop() is executed repeatedly
•  Serial.println() prints a messages
•  delay() sleeps for the given amount of time
Code
Sensors

•  Each sensor has its own methods


Actuators
Shields
Breadboards
A second example

•  We read from a sensor (light)


•  We print the value
•  We dim the led light according to the
sensed light
Code
What is ThingSpeak

•  Platform for IoT applications


•  Real-time data collection
•  Visualize data in charts
•  Private and Public channels
•  Register and create your first channel
ThingSpeak channels
ThingSpeak channels
Temperature+Humidity device

•  We use the DHT22


sensor
•  1-wire BUS
•  We push humidity,
temperature and heat
index to ThingSpeak
every 10 seconds
•  With an ESP8266-01
Let’s create the channel
Code
Code
Code
Code
WiFi Scanner

•  Let’s put up a webserver on the port 80


•  Serve a webpage with a list of nearby AP
Autonomous network
•  Multiple ESP8266
Internet
•  The first one will serve as
access point and send data to
ThingSpeak
•  Others will connect to the first
ESP8266 and send data to him
•  The first one will also display a
page showing the devices
connected
•  If the first one dies, another one
will replace it
Luca Bedogni
DISI@UNIBO

[email protected]
http://www.cs.unibo.it/~lbedogni/

www.unibo.it

You might also like