1. Install “Unofficial Development Kit for Espressif ESP8266”
Download & install the free gcc toolchain for ESP8266: github.com/CHERTS/esp8266-devkit (source) or http://programs74.ru/udkew-en.html (installer)
The kit includes the compiler, firmware libraries, documentation and some extra tools for e.g. flashing the firmware. A real “one in all” package to get started with the esp8266 under windows. For linux take a look here: https://github.com/pfalcon/esp-open-sdk
2. Check Espressif SDK Version V1.51
This Demo has been tested against “ESP8266 Non-OS SDK（ESP8266_NONOS_SDK_V1.5.1_16_01_08）” -> SDK V1.51
If it’s not present in folder c:EspressifESP8266_SDK after install of the development kit above please download V1.51 from Espressif Forum and copy the zip file contents manually to c:EspressifESP8266_SDK (rename “esp_iot_sdk_v1.5.1” to “ESP8266_SDK”).
3. Install integrated development environment (IDE)
4. Download CoAP demo eclipse project
Clone via: git clone –recursive https://github.com/Lobaro/lobaro-coap-on-esp8266
5. Build + Flash firmware via serial bootloader
The development kit includes a binary version of “ESPTOOL” which is used to download the firmware binaries to the esp8266.
- Follow the instructions in section “Protocol” of its Github page to connect your esp8266 board: github.com/themadinventor/esptool
- Set the com-port of your pcs serial port connected to the esp inside the “Makefile”: ESPPORT ?= COMx
- Double-click on “flash” inside eclipse “Make Target” Tab
6. Install Copper-CU Firefox Plugin as CoAP Client
To test the CoAP server use the firefox plugin “Copper (CU)” which can be found here: Firefox Add-ON Download Page
7. Setup WIFI ssid + password
This demo firmware tries to connect to the predefined wifi access point which ssid and password are stored inside the flash memory of your esp8266. Since it’s not configured yet this attemp will fail before you configure the credentials of your local wifi network. After three failed connection attempts the firmware opens its own wifi network. You can use this network to configure your wifi ssid and password via CoAP:
- Power on your ESP8266 and wait for the network in step 2 to appear (max. 1 minute)
- Connect to wifi network “Lobaro-CoAP (ESP8266)” (password is “lobaro!!“)
- Open Firefox with installed Copper-CU Plugin (see step 5 above)
- Open a firefox tab at coap://192.168.4.1:5683 , the CoAP “control panel” should show up.
- Click on “Ping”, it should show up “Pong: Remote responds to CoAP”
- Update the address to: coap://192.168.4.1:5683/wifi/config?key=123&ssid=YOUR-SSID&pw=YOUR-PW
- Click on “PUT” button, it should show up “updated”
- Update the address to: coap://192.168.4.1:5683/wifi/ipconfig
- Click on “GET” button, it should show up the IP the esp8266 got from your access point
- From now on access the ESP8266 directly via “Station” IP got in step 9
- After power on reset the softAP will only started again if connect to external AP fails 3 times
Try out the existing resources on your native esp8266 CoAP server or create your own ones!
Take a look inside the projects “resources” directory to see how simple it is with lobaro-coap to create a resource!