ESP8266
The following examples show how to connect GUI-O application with ESP8266 in various communication modes. Tutorial for automatic device pairing also shows how to connect GUI-O application with ESP8266 in MQTT (IoT) mode.
ESP8266 & Arduino & GUI-O basic examples
The following examples show basic interaction between GUI-O application and ESP8266 module in various communication modes.
ESP8266 Ethernet
Prerequisites:
Download Arduino IDE
Download BasicEthernet.ino sketch
Step 1: Add ESP8266 board support
Open Arduino IDE
Select "File -> Preferences" and under Additional Boards Manager URLs enter: https://arduino.esp8266.com/stable/package_esp8266com_index.json
Select "Tools -> Board -> Boards manager..."
Search and install "esp8266" by ESP8266 Community
After installation select "Tools -> Board -> ESP8266 Boards -> Generic ESP8266 Module"
Step 2: Upload the code
Select "File -> Open"
Select BasicEthernet.ino and confirm
Set your router name (ssid) and password (ssid)
Make sure that ESP8266 board is connected to your PC
Make sure that the correct port is selected
Press upload button to start code upload (IMPORTANT NOTE: on some ESP8266 boards, the GPIO0 pin must be held to GND during the board reset, which enables code upload)
Reset ESP8266 board after code upload
ESP8266 & Arduino & GUI-O automatic pairing
The following example shows how to automatically pair GUI-O application with ESP8266 in MQTT (IoT) mode. Although the example uses ESP8266 Wemos D1 R1, it should be compatible with any other ESP8266 board.
The procedure is in principle identical to the ESP32 pairing (check the video tutorials under the ESP32 pairing section for additional information). There are some slight differences between ESP32 and ESP8266 pairing procedure - notably when setting up the board and required libraries. Step-by-step procedure is described in the sections below.
VERY IMPORTANT NOTE: The ESP8266 board acts as a bridge. All commands received from the MQTT broker are transmitted over the ESP8266 serial port (Tx). Analogously, all commands that need to be sent to the MQTT broker must be transmitted over the ESP8266 serial port (Rx). This requires an external microcontroller to handle the incoming commands (sent by the GUI-O application) and outgoing commands (received by the GUI-O application).
After programming the ESP8266 with the pairing code, it can be used, for example, to replace an existing USB Serial Bluetooth module to achieve WiFi connectivity. Furthermore, since the ESP8266 works as a standalone board that communicates with the GUI-O application, it can also be used in any other non-Arduino projects.
Prerequisites
Download Arduino IDE
Download ESP8266_GUI-O_pairing_libs.zip and extract the archive
Download ESP8266_GUI-O_pairing_source.zip and extract the archive
Step 1: Add ESP8266 board support
Open Arduino IDE
Select "File -> Preferences" and under Additional Boards Manager URLs enter: https://arduino.esp8266.com/stable/package_esp8266com_index.json
Select "Tools -> Board -> Boards manager..."
Search and install "esp8266" by ESP8266 Community
After installation select "Tools -> Board -> ESP8266 Boards -> Wemos D1 R1" (if you choose a different board, you might need to adjust the program settings in "config.h" header within the extracted ESP8266_GUI-O_pairing_source folder)
Step 2: Include necessary libraries
Select "Sketch -> Include library -> Add .ZIP library..."
Navigate to location, where ESP8266_GUI-O_pairing_libs.zip archive was extracted
Select .zip library and confirm (repeat procedure until all .zip libraries are included)
Step 3: Upload the code
Select "File -> Open"
Navigate to location, where ESP8266_GUI-O_pairing_source.zip archive was extracted
Select PairingMQTT.ino and confirm
IMPORTANT NOTE: ESP8266 can output debug messages during operation - to enable this feature, open the "config.h" header and uncomment "#define _GUIO_DEBUG"
Make sure that ESP8266 board is connected to your PC
Make sure that the correct port is selected
Press upload button to start code upload (IMPORTANT NOTE: on some ESP8266 boards, the GPIO0 pin must be held to GND during the board reset, which enables code upload)
Reset ESP8266 board after code upload
Step 4: Pair GUI-O application with ESP8266 board
The pairing procedure is fully guided within GUI-O application. The important parts are described below.
Open GUI-O application and navigate to settings
Make sure that IoT connection is active (select "Connections -> IoT")
From main settings menu select "Quick pair -> Direct device pairing"
Name your ESP8266 device (setting your user name is optional) and confirm
Wait while surrounding WiFi networks are scanned then select your (router) WiFi network and input your password
Put the ESP8266 device into pairing mode then search and connect to guio_ device (input password 12345678 when prompted)
IMPORTANT NOTE: Do not switch network if prompted by Android (keep connection to guio_ device)
Press "back button" and wait for pairing procedure to complete successfully
Select your (router) WiFi network and press "back button" to start the connection test
Important notes
ESP8266 operates in two WiFi modes: AP (access point - used for pairing) and STA (stationary - used for normal operation)
After first pairing, ESP8266 stores the pairing data into its EEPROM and always boots to STA mode when powered on
To clear the pairing data and boot to AP mode, send the following command to ESP8266 over the serial port: "!CLEAR_PARAMS\r\n" (see "serialInputHandler()" method in "program_base.cpp" source)
Implement custom handling of GUI-O messages within "mqttReceiveCallback(...)" method in "program_sta.cpp" source
Connect . Create . Control