esp8266 - intro for dummies
TRANSCRIPT
![Page 1: Esp8266 - Intro for dummies](https://reader036.vdocuments.site/reader036/viewer/2022081420/5871abd71a28abda6a8b5979/html5/thumbnails/1.jpg)
ESP8266“Designed for the needs of an increasingly connected
world”
Pavlos Isaris
![Page 2: Esp8266 - Intro for dummies](https://reader036.vdocuments.site/reader036/viewer/2022081420/5871abd71a28abda6a8b5979/html5/thumbnails/2.jpg)
IntroductionThe ESP8266 WiFi Module is a self contained SOC (system on a chip) with integrated TCP/IP protocol stack that can give any microcontroller access to a WiFi network.
![Page 3: Esp8266 - Intro for dummies](https://reader036.vdocuments.site/reader036/viewer/2022081420/5871abd71a28abda6a8b5979/html5/thumbnails/3.jpg)
FeaturesVery low cost ( 3-5$ )Pre-programmed with an AT command set firmwareGrowing communityEnough on-board processing power to deal with
sensors through GPIOOperating at 3.3VCan draw up to 170 mA of currentNot breadboard-friendly :-(
![Page 4: Esp8266 - Intro for dummies](https://reader036.vdocuments.site/reader036/viewer/2022081420/5871abd71a28abda6a8b5979/html5/thumbnails/4.jpg)
Βreadboard friendly version (ESP-12)
![Page 5: Esp8266 - Intro for dummies](https://reader036.vdocuments.site/reader036/viewer/2022081420/5871abd71a28abda6a8b5979/html5/thumbnails/5.jpg)
![Page 6: Esp8266 - Intro for dummies](https://reader036.vdocuments.site/reader036/viewer/2022081420/5871abd71a28abda6a8b5979/html5/thumbnails/6.jpg)
Why do we need a Voltage regulator?The ESP8266 may require more than the 35mA supplied by the Arduino 3.3V pin
![Page 7: Esp8266 - Intro for dummies](https://reader036.vdocuments.site/reader036/viewer/2022081420/5871abd71a28abda6a8b5979/html5/thumbnails/7.jpg)
Baud rate problemThe ESP-8266 comes in various firmware versions, varying also in the operating baud rate (older operate at 115200 bauds).My ESP8266 operates in 115200 bauds/second. This means that we can only use hardware serial to communicate with it (Arduino Software serial pins handle only 9600 bauds/second)In such occasion, it is possible to use an Arduino MEGA (4x Hardware serial couple-pins)
![Page 8: Esp8266 - Intro for dummies](https://reader036.vdocuments.site/reader036/viewer/2022081420/5871abd71a28abda6a8b5979/html5/thumbnails/8.jpg)
Alternative - Update firmware versionYou can also use an FTDI adapter (like the FT232rl) or FTDI cable, to communicate via USB with ESP8266There are plenty of tutorials about how to update the firmware versionAfter you have updated the firmware version you can change the baud rate
![Page 9: Esp8266 - Intro for dummies](https://reader036.vdocuments.site/reader036/viewer/2022081420/5871abd71a28abda6a8b5979/html5/thumbnails/9.jpg)
Multiple variations
![Page 10: Esp8266 - Intro for dummies](https://reader036.vdocuments.site/reader036/viewer/2022081420/5871abd71a28abda6a8b5979/html5/thumbnails/10.jpg)
Module GPIO Notes
ESP-01 GPIO0/2/16 Most common module.
ESP-02 GPIO0/2/15
ESP-03 GPIO0/2/12/13/14/15/16 Most popular in esp8266.com poll
ESP-04 GPIO0/2/12/13/14/15/16
ESP-05 None
ESP-06 GPIO0/2/12/13/14/15/16
ESP-07 GPIO0/2/4/5/12/13/14/15/16
ESP-08 GPIO0/2/12/13/14/15/16
ESP-09 GPIO0/2/12/13/14/15 1MB Flash memory
ESP-10 None
ESP-11 GPIO0/1
ESP-12 ADC + GPIO0/2/4/5/12/13/14/15/16
Recently adopted by many due to many GPIOs
![Page 11: Esp8266 - Intro for dummies](https://reader036.vdocuments.site/reader036/viewer/2022081420/5871abd71a28abda6a8b5979/html5/thumbnails/11.jpg)
Using Arduino IDE Serial Monitor#include <SoftwareSerial.h>SoftwareSerial ESPserial(2, 3); // RX | TX void setup() { Serial.begin(115200); // communication with the host computer ESPserial.begin(115200); Serial.println(""); Serial.println("Remember to to set Both NL & CR in the serial monitor."); Serial.println("Ready"); Serial.println(""); }
![Page 12: Esp8266 - Intro for dummies](https://reader036.vdocuments.site/reader036/viewer/2022081420/5871abd71a28abda6a8b5979/html5/thumbnails/12.jpg)
Using Arduino IDE Serial Monitorvoid loop() { // listen for communication from the ESP8266 and then write it to the serial monitor if ( ESPserial.available() ) { Serial.write( ESPserial.read() ); } // listen for user input and send it to the ESP8266 if ( Serial.available()) { ESPserial.write( Serial.read() ); }}
![Page 13: Esp8266 - Intro for dummies](https://reader036.vdocuments.site/reader036/viewer/2022081420/5871abd71a28abda6a8b5979/html5/thumbnails/13.jpg)
Basic AT commands
![Page 14: Esp8266 - Intro for dummies](https://reader036.vdocuments.site/reader036/viewer/2022081420/5871abd71a28abda6a8b5979/html5/thumbnails/14.jpg)
Checking for available WiFi networks
![Page 15: Esp8266 - Intro for dummies](https://reader036.vdocuments.site/reader036/viewer/2022081420/5871abd71a28abda6a8b5979/html5/thumbnails/15.jpg)
Connect to Network
![Page 16: Esp8266 - Intro for dummies](https://reader036.vdocuments.site/reader036/viewer/2022081420/5871abd71a28abda6a8b5979/html5/thumbnails/16.jpg)
See details
![Page 17: Esp8266 - Intro for dummies](https://reader036.vdocuments.site/reader036/viewer/2022081420/5871abd71a28abda6a8b5979/html5/thumbnails/17.jpg)
Send a requestAllow multiple connections
Start connection
Specify bytes to be sentIn this case it is “GET / HTTP/1.0\r\n\r\n”
![Page 18: Esp8266 - Intro for dummies](https://reader036.vdocuments.site/reader036/viewer/2022081420/5871abd71a28abda6a8b5979/html5/thumbnails/18.jpg)
Get the response back
![Page 19: Esp8266 - Intro for dummies](https://reader036.vdocuments.site/reader036/viewer/2022081420/5871abd71a28abda6a8b5979/html5/thumbnails/19.jpg)
Acting as TCP Server
![Page 20: Esp8266 - Intro for dummies](https://reader036.vdocuments.site/reader036/viewer/2022081420/5871abd71a28abda6a8b5979/html5/thumbnails/20.jpg)
Acting as a Wifi Access point
![Page 21: Esp8266 - Intro for dummies](https://reader036.vdocuments.site/reader036/viewer/2022081420/5871abd71a28abda6a8b5979/html5/thumbnails/21.jpg)
ESP8266 core-library#include <Adafruit_ESP8266.h>
#include <SoftwareSerial.h>
#define ARD_RX_ESP_TX 2
#define ARD_TX_ESP_RX 3
#define ESP_RST 4
SoftwareSerial softser(ARD_RX_ESP_TX, ARD_TX_ESP_RX);
Adafruit_ESP8266 wifi(&softser, &Serial, ESP_RST);
#define ESP_SSID "SSIDNAME" // Your network name here
#define ESP_PASS "PASSWORD" // Your network password here
#define HOST "www.adafruit.com" // Host to contact
#define PAGE "/testwifi/index.html" // Web page to request
#define PORT 80 // 80 = HTTP default port
![Page 22: Esp8266 - Intro for dummies](https://reader036.vdocuments.site/reader036/viewer/2022081420/5871abd71a28abda6a8b5979/html5/thumbnails/22.jpg)
ESP8266 core-librarysoftser.begin(9600); // Soft serial connection to ESP8266Serial.begin(57600); while(!Serial); // UART serial debugwifi.connectToAP(F(ESP_SSID), F(ESP_PASS))
Serial.print(F("OK\nRequesting page..."));
if(wifi.requestURL(F(PAGE))) { Serial.println("OK\nSearching for string..."); if(wifi.find(F("working"), true)) { Serial.println(F("found!")); } else { Serial.println(F("not found.")); }} else { // URL request failed Serial.println(F("error")); }wifi.closeTCP();
![Page 23: Esp8266 - Intro for dummies](https://reader036.vdocuments.site/reader036/viewer/2022081420/5871abd71a28abda6a8b5979/html5/thumbnails/23.jpg)
Espert - Development board
http://www.espert.co/ (v2.0 To be released by April 2016.)