ESPRESSIF ESP32
Last updated
Last updated
ESP32 is a series of low-cost, low-power system on a chip microcontrollers with integrated Wi-Fi and dual-mode Bluetooth. There are multiple modules based on this microcontroller that includes different kinds of antennas, pinouts and memory extensions. It is the successor to the ESP8266 microcontroller and is designed to be one of the most relevant IoT impulsor during the next years and there is a great diversity of variants that exploit its capacities together with other peripherals, integrating LoRa communication, audio amplifiers, LCD screens, etc.
This device can be programmed directly from the Arduino IDE by including the ESP32 core libraries with Arduino Boards Manager. For this step, you will need first to include https://dl.espressif.com/dl/package_esp32_index.json into Additional Board Manager URLs
field in the Arduino preferences.
Next, go to the Boards manager to install the ESP32 package. Search for the esp32
and install the package esp32 by Espressif Systems
After this process you should be able to select this board on your Arduino IDE and start creating your IoT projects with Thinger.io.
The following example will allow connecting your device to the cloud platform in a few lines via WiFi interface. Just modify the arduino_secrets.h
file with your own information.
It is possible to configure all parameters required for connection via a web Interface (captive portal). The device will create an access point where the user can connect to establish required information, like username, device identifier, credentials, and access point to connect.
Once this sketch is loaded in the device, it is possible to follow the next steps to connect it to the platform:
Connect to Thinger-Device WiFi with your computer or phone, using thinger.io
as WiFi password
Wait for the configuration window, or navigate to http://192.168.4.1 if it does not appear
Configure the wifi where the ESP32 will be connected, and your thinger.io device credentials
Your device should be now connected to the platform.
The WebConfig interface includes different methods to control the captive portal:
clean_credentials: It clean all credentials from the device (WiFi/user parameters). This way, the next time the device is booted will create the captive portal again to request the WiFi configuration. It can be executed after a long press on a button.
set_user: Initializes the default user for connecting the device to the platform (if set, this parameter is not requested to the user in the captive portal).
set_device: Initializes the default device for connecting the device to the platform (if set, this parameter is not requested to the user in the captive portal).
set_password: Initializes the default device password for connecting the device to the platform (if set, this parameter is not requested to the user in the captive portal).
add_setup_parameter: Add additional parameters to be requested in the captive portal, for example, any other configuration required for the execution: sampling intervals, meta-data, thresholds, etc.
set_on_config_callback: Set a callback to receive configuration provided by the user in the captive portal, i.e., user, device, password, or any additional parameter configured.
set_on_wifi_config: Set a callback to receive the result of the WiFi configuration. If the connection did not succeed, it can be used to clean credentials, so, the captive portal runs again.
set_on_captive_portal_run: Set a callback to receive the WiFiManager instance before the captive portal is shown. It can be used to add any other customization over the WebConfig interface.
Coming soon