Professional Documents
Culture Documents
Esp and Arduino Programming 1 PDF
Esp and Arduino Programming 1 PDF
Tom Tobback
www.cassiopeia.hk
2015
standard Arduino workshop 2014-2015
Materials
small
powerfull
cheap
=> IoT
more on
ESP-12
1. esptool.py
2. NodeMCU - Lua
3. Arduino IDE!
https://github.com/esp8266/Arduino
Vcc = 3V3
GND
UTXD = serial TX
URXD = serial RX
RST = reset
● Vcc = 3V3
● GND
● URXD = serial RX = pin0
● UTXD = serial TX = pin1
AT+RST reset
AT+GMR check firmware version
https://nurdspace.nl/ESP8266
WEB SERVER
serve web pages over existing wifi network
ACCESS POINT
create its own wifi network + web server
WEB CLIENT
communicate with web servers (e.g. thingspeak.com)
over existing wifi network
AT+CIPSEND=0,12
hello world [enter]
AT+CIPCLOSE=0
see browser
AT+CIPSEND= 4
wait for “>”
GET [enter]
check reply
espSerial.println("AT+RST");
ARDUINO LIBRARY
https://github.com/adafruit/DHT-sensor-library
ARDUINO SKETCH
#include <DHT.h>
DHT dht(3, DHT11);
pinMode(3, INPUT); // DHT11
dht.begin();
float h = dht.readHumidity();
float t = dht.readTemperature();
in Thingspeak:
add app ThingTweet
link to twitter account
in sketch:
“GET
/apps/thingtweet/1/statuses/update/api_key=KEY&status=”;
Hardware connections:
pull GPIO0 to GND (programming mode)
connect URXD to TX
connect URXD to RX
power off/on
in IDE:
set Tools / Programmer / esptool
set Tools / Board / generic ESP8266
set Tools / Port / xxx/usb0
#include <ESP8266WiFi.h>
...
WiFiServer server(80);
WiFi.begin(ssid, password);
WiFiClient client = server.available();
...
String req = client.readStringUntil('\r');
...
client.print(s);
www.cassiopeia.hk
Happy tinkering!
standard Arduino workshop 2014-2015