Esp and Arduino Programming
Esp and Arduino Programming
Tom Tobback
www.cassiopeia.hk
2015
standard Arduino workshop 2014-2015
Materials
Todays setup
more on
ESP-12
Todays setup
Downloads
http://www.dimsumlabs.com/
click on ESP8266 event
DHT library zipped
zip file with:
esp8266-thingspeak-dht11-test
esp8266-thingspeak-dht11-v3
esp8266-dht11-webserver
WiFiWebServer-dht11-led
ESP8266 pinout
Vcc = 3V3
GND
UTXD = serial TX
URXD = serial RX
RST = reset
CH_PD = pull up 4.6kOhm
GPIO0 = input/output
GPIO2 = input/output
ESP8266 test
Communicate with ESP8266 using Serial converter on our
Arduino board
Vcc = 3V3
GND
URXD = serial RX = pin0
UTXD = serial TX = pin1
ESP8266 test
Communicate with ESP8266 using Serial converter on our
Arduino board (RX, TX)
Upload any sketch not using Serial e.g. blink
Connect ESP module
Open IDE Serial Monitor
Baud rate = 9600
Setting = Both NL & CR
ESP8266 test
AT commands of standard firmware
AT+RST
AT+GMR
reset
check firmware version
AT+CWMODE=3
AT+CWLAP
AT+CWJAP=ssid,password
AT+CIOBAUD?
AT+CIOBAUD=9600
https://nurdspace.nl/ESP8266
ESP8266+Arduino workshop 2015
ESP8266 setup
ESP8266 can act as:
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
reset
configure as node
list access points
connect to your wifi
show ip address
allow multiple connects
start server on port 80
thingspeak.com
create an account on thingspeak.com
create a channel
make public
enter description
field 1: temperature
field 2: humidity
save
get API Write Key
test in browser http://api.thingspeak.com/update?
key=APIKEY&field1=23.66
DHT11 setup
CONNECTIONS:
5V
GND
SIGNAL with pull-up resistor
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();
ESP8266-thingspeak-dht11-test sketch
22.00degC 59.00%
reset ESP8266..
#T%Ca l!chKFgP |c
[Vendor:www.ai-thinker.com Version:0.9.2.4]
ready
AT+CWMODE=1
no change
AT+CWJAP="tobback","xxxx"
OK
AT+CIPMUX=0
OK
AT+CIPSTART="TCP","184.106.153.149",80
OK [or Error]
Linked
AT+CIPSEND=60
> GET /update?key=RD9SEODFNKIBZ11M&field1=22.00&field2=59.00
wrong syntax
ERROR
SEND OK
+IPD,4:2107
OK
ESP8266-thingspeak-dht11-v3 sketch
check espSerial feedback to know if commands are working
send status over Serial for debugging
DHT11 sensor sending data to THINGSPEAK.COM by ESP8266
sample interval (s): 5
22.00degC 57.00% reset ESP8266..module ready..connected to wifi..>send
thingspeak.com OK.. receive OK!
22.00degC 59.00% reset ESP8266..module ready..cannot connect to wifi
cannot connect to wifi
connected to wifi..>send thingspeak.com OK.. receive OK!
22.00degC 58.00% reset ESP8266..module ready..cannot connect to wifi
connected to wifi..>send thingspeak.com OK.. receive OK!
ESP8266-twitter-dht11-v3 sketch
twitter via thingspeak.com: tweet from your Arduino
in Thingspeak:
add app ThingTweet
link to twitter account
in sketch:
GET
/apps/thingtweet/1/statuses/update/api_key=KEY&status=;
Thank you
www.cassiopeia.hk
Happy tinkering!
standard Arduino workshop 2014-2015