EXAMPLES
The following tutorials show how to use GUI-O application with ESP32 boards in various configuration and communication modes. Tutorial for automatic device pairing also shows how to include SSL/TLS for secure IoT connection.
The same principle of operation can be applied to any other board or device - check out how GUI-O works. To see more examples, visit our forum.
Page contents
ESP32 & Arduino basic examples
The following examples show basic interaction between GUI-O app and ESP32 module in various communication modes.
ESP32 Bluetooth
Download BasicBluetooth.ino sketch
Follow Basic Bluetooth video tutorial
Additional Boards Manager URLs: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
ESP32 Bluetooth LE
Download BasicBLE.ino sketch (or BasicBLE_NUS.ino for Nordic UART service)
Follow Basic BLE video tutorial
Additional Boards Manager URLs: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
ESP32 MQTT (IoT)
Download BasicMQTT.ino sketch
Follow Basic MQTT video tutorial
Additional Boards Manager URLs: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
ESP32 USB
Download BasicUSB.ino sketch
Follow Basic USB video tutorial
Additional Boards Manager URLs: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
ESP32 Ethernet
Download BasicEthernet.ino sketch
Follow Basic Ethernet video tutorial
Additional Boards Manager URLs: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
ESP32 & Arduino & GUI-O automatic pairing (supports SSL/TLS)
The following example shows how to automatically pair GUI-O app with ESP32 in MQTT (IoT) mode. Although the example uses ESP32-WROOM-32 board, it is compatible with any other ESP32 board.
GUI-O app always uses SSL/TLS for secure (encrypted) communication. In order to also establish a secure connection from the ESP32 side, use ESP32_GUI-O_pairing_source_SSL_TLS.zip. To establish an unencrypted connection, use ESP32_GUI-O_pairing_source.zip instead (see "Prerequisites" section below).
Prerequisites
Download Arduino IDE
Download ESP32_GUI-O_pairing_libs.zip and extract the archive
Download ESP32_GUI-O_pairing_source.zip or ESP32_GUI-O_pairing_source_SSL_TLS.zip (for secure connection) and extract the archive
Step 1: Add ESP32 board support
Open Arduino IDE
Select "File -> Preferences" and under Additional Boards Manager URLs enter: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
Select "Tools -> Board -> Boards manager..."
Search and install "esp32" by Espressif Systems
After installation select "Tools -> Board -> ESP32 Arduino -> ESP32 Dev Module"
Step 2: Include necessary libraries
Select "Sketch -> Include library -> Add .ZIP library..."
Navigate to location, where ESP32_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 ESP32_GUI-O_pairing_source.zip archive was extracted
Select PairingMQTT.ino and confirm
Make sure that ESP32 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 ESP32 boards, the BOOT button must be pressed when the upload starts)
Reset ESP32 board after code upload
Check out the video tutorial below!
Video tutorial of Step 1 - 3
Step 4: Pair GUI-O app with ESP32 board
Open GUI-O app and navigate to settings
Make sure that IoT connection is active (select "Connections -> IoT")
From main settings menu select "Quick pair -> Direct device pairing"
Enter device name (required) and user name (optional) and confirm
Make sure that mobile data plan is disabled and WiFi is enabled
Search and select the WiFi network of the ESP32 (starts with guio_************)
Input password 12345678 (can be changed in "program_ap.cpp" source)
IMPORTANT NOTE: Wait for your device to report that no internet is available and keep WiFi connection to ESP32!
Return to GUI-O app and wait for WiFi network scan
Select your WiFi access point / router and input password
Wait for the pairing procedure to complete and press "Connect"
Wait for successful IoT connection and press the GUI-O initialize button from the home screen
Check out the video tutorial below!
Video tutorial of Step 4
Important notes
ESP32 operates in two WiFi modes: AP (access point - used for pairing) and STA (stationary - used for normal operation)
After first pairing, ESP32 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 ESP32 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