Arduino Setup for ESP8266 :
- Install the Arduino IDE 1.6.4 or greater from : https://www.arduino.cc/en/Main/Software
- To Install the ESP8266 Board Package, go to : File->Preferences from menu.
- Add http://arduino.esp8266.com/stable/package_esp8266com_index.json to Additional Boards Manager URLs.
- Go to Boards Manager from Tools->Board->Boards Manager.
- Search for esp8266 and install.
- Now you are able to select esp8266 as a board from Tools->Board.
- Select "Generic ESP8266 Board" as board, 80 MHz as CPU Frequency, 4M (1M SPIFFS) as Flash Size.
- To be able to write SW on device and get traces, select a proper device path from Port section.
- For linux users, add your user to the group of dialout to enable serial comm.
Required Arduino Libraries :
- To install arduino libraries use Sketch->Include Libraries->Library Manager or Add .ZIP Library.
- ArduinoJson : https://github.com/bblanchon/ArduinoJson
- ArduinoWebSocket : https://github.com/Links2004/arduinoWebSockets
- PubSubClient : https://github.com/knolleary/pubsubclient/
- OneWire : https://github.com/PaulStoffregen/OneWire
- DallasTemperature: https://github.com/milesburton/Arduino-Temperature-Control-Library
WiFi Setup Methods :
- Dummy Setup : Write your WiFi credentials under Credentials.h file. To enable, define SETUP_DUMMY_CONFIG from Credentials.h.
- SmartConfig : ESP has a protocol called ESP-TOUCH which floads sub-IP packets via its radio for ease of WiFi setup. With this method, WiFi credentials are easily sending to ESP8266 without falling back to AP mode. Until getting our own Android App, this app would be used initially : https://play.google.com/store/apps/details?id=com.cmmakerclub.iot.esptouch&hl=tr You can compile from source : https://github.com/EspressifApp/EsptouchForAndroid To enable, define SETUP_SMART_CONFIG from Credentials.h.
- WebServer Setup : Device gets in AP mode and starts a WebServer on a given IP. Handles POSTed Wifi credential and user data and process them. To enable, define SETUP_WEBSERVER_AP from Credentials.h.
- When connection gets succeeded, they all will be stored on the filesystem.
Using Postman to send WiFi credentials to device's WebServer in AP mode (Demo purpose):
- Postman is a cool Chrome browser plugin to make HTTP request. It is for demo purpose until we have a user client.
- We will POST JSON data to the ESP8266 device to handle requests.
- In AP mode, we have IP address of 192.168.99.1.
- You need to send below JSON data to set WiFi credentials on board.
- {type:"APInfo", ssid:YOUR_SSID, pass:YOUR_PASS}
- Device requires a reboot to left AP mode and connect to WiFi. So send the data below.
- {type:"APDone"}
Data Communication Methods :
- Our base supports both MQTT and WebSocket for cloud comm. Contact Cihan Begburs for server credentials.
- For MQTT, enable PROTOCOL_MQTT define from Global.h.
- For WebSocket, enable PROTOCOL_WEBSOCKET define from Global.h.
Hardware :
- Initial DS18B20 OneWire digital sensor implementaiton was added thru the library. OneWire needs a 4.7K pull-up resistor. Check for the schematics.
- Relays are able to be controlled via GPIOs 16 & 5.
Factory Reset:
- A button (currently connected to GPIO 0) was programmed to clear user data such as Wifi Credentials.
- Need to press more than 3 seconds to fallback in setup mode.
- A led indicatior will be added to feedback the status.