Difference between revisions of "Esp8266"
Line 13: | Line 13: | ||
https://www.bountysource.com/issues/28368887-compatibility-with-arduino-and-esp8266 | https://www.bountysource.com/issues/28368887-compatibility-with-arduino-and-esp8266 | ||
http://superuser.com/questions/882638/sslciphersuite-settings-in-apache-for-supporting-tls-1-0-1-1-and-1-2 | |||
*http://iot-playground.com/2-uncategorised/40-esp8266-wifi-relay-switch-arduino-ide | *http://iot-playground.com/2-uncategorised/40-esp8266-wifi-relay-switch-arduino-ide |
Revision as of 03:47, 19 January 2017
notes on esp8266
Hi Mitul,
My best esp8266 code is in https://github.com/mckennatim/demiot. A couple of notes on it.
You can always get it online by hard coding your SSID info ala...
#include <ESP8266WiFi.h> #include <ESP8266WebServer.h> const char *ssid = "street_no_vale2"; const char *pwd = "jjjjjjjj"; ESP8266WebServer server(80); void handleRoot() { server.send(200, "text/html", "h1 root of espAPsb AP server /h1"); } void getOnline(){ WiFi.begin(ssid, pwd); int tries =0; int success=1; while (WiFi.status() != WL_CONNECTED ) { delay(500); Serial.print("."); tries++; if (tries==15){ success=0; scan(); setupAP(); break; } } if (success){ Serial.println(""); Serial.println("WiFi connected"); Serial.print("IP address: "); Serial.println(WiFi.localIP()); } }
void setup(){ Serial.begin(115200); Serial.println(); Serial.println("--------------------------"); Serial.println("ESP8266 webconfig"); Serial.println("--------------------------"); getOnline(); }
void loop(){ server.handleClient(); }
but that is not at all interesting for a couple of reasons
- you shouldn't have to be reconnect and upload over USB every time you move to a new SSID
- this sets you up as a server instead of client. There are lots of downsides to that. (your customers have to open ports on their routers ala xbox, an outside server&clients needs to keep track of its IP...)
So you need to be able to webconfig the thing and then run it as a client.
In denmiot/essp8266/mqttall I broke out webconfig in `#include "config.h"` (excuse the `extern` globals).
setup calls getOnline() which reads a config from the EEPROM and connects but if that fails it jumps into webconfig mode, turning itself into and access point server with an SSID of `espAPsb` and an ip of 192.168.4.1 where you can send it a get string like
http://192.168.4.1/config?ssid=street_no_vale2&pwd=jjjjjjjj&devid=CYURD001&ip=10.0.1.100&port=3332
once you send it that it reboots itself (sometimes you need to hit the reset or powerdown) as a client on your local wifi.
mqtt
mqtt is a very cool pu/sub/ protocol. For some reason though it won't automatically reconnect when you do a webconfig. You have to power down first
esp8266
tls on esp8266
{"pid":5768,"hostname":"tim-hp","name":"mosca","level":40,"time":1484804098536,"msg":"101057795:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:openssl\\ssl\\s3_pkt.c:1472:SSL alert number 40\n","type":"Error","stack":"Error: 101057795:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:openssl\\ssl\\s3_pkt.c:1472:SSL alert number 40\n\n at Error (native)","client":"ESP8266Client-e1e","v":1}
openssl s_client -connect sslvh.tm:8883 -tls1
https://www.bountysource.com/issues/28368887-compatibility-with-arduino-and-esp8266
- http://iot-playground.com/2-uncategorised/40-esp8266-wifi-relay-switch-arduino-ide
- web based configuration
debug
sparkfun thing dev
http://frightanic.com/iot/comparison-of-esp8266-nodemcu-development-boards/
- :back to breakout boards
wifi breakout board
wiring
http://www.forward.com.au/pfod/ESP8266/GPIOpins/index.html
https://github.com/esp8266/Arduino/issues/1243
current sensing
http://www.esp8266-projects.com/2015/06/mailbag-arrival-acs712-current-sensor.html