Quick start
Build and connect a simple ESP32 device with FlovaSDK in a few steps.
This is the fastest path to a working Flova device. You will create an ESP32 template, flash the universal firmware, provision the board, and switch its built-in LED from a published dashboard.
You need an ESP32 board with an LED on GPIO2, a USB data cable, a phone or
computer with Wi-Fi, and either PlatformIO or Arduino IDE. Create a Flova
workspace before you begin.
1. Create a device template
Open Flova Console, create a Device Type, and name
it ESP32 LED. Choose Wi-Fi as its setup method. Add one datastream with these
values:
| Field | Value |
|---|---|
| Name | Internal LED |
| Technical key | LED |
| Value type | Boolean |
| Access | Read/write |
| Behavior | Digital output |
| Hardware pin | GPIO2 |
| Active level | HIGH |
| Default and safe value | Off |
Use LED exactly as the technical key. Publish the Device Type version before
creating a device from it.
2. Install and flash universal firmware
The universal composition owns the setup flow, device connection, hardware mapping, and normal firmware lifecycle. Choose your tool:
Install the ESP32 board package:
- Open Tools > Board > Boards Manager.
- Search for
esp32by Espressif Systems and install it. - Open Tools > Manage Libraries, search for
FlovaSDK, and install it. - Select your ESP32 board under Tools > Board.
- Select its USB serial port under Tools > Port.
Create a new sketch and replace it with:
#include <Arduino.h>
#include <FlovaSDK.h>
FlovaUniversalEsp32 device;
void setup() {
Serial.begin(115200);
device.begin();
}
void loop() {
device.run();
}Click Upload. Arduino IDE builds and flashes the complete image for the selected board.
3. Create and provision the device
In Console's Devices page, open ESP32 LED,
choose Add Device, enter a name, and create the device. Console shows a QR
code and a manual activation code.
Open the Flova web application, sign in, choose Add device, and scan the QR code. Use the manual activation option if the camera is unavailable.
The fresh board starts its setup network with a name like Flova-Setup-*.
While the web application is in setup mode:
- Connect your phone or computer to
Flova-Setup-*. - Return to the web application.
- Enter the usual Wi-Fi name and password.
- Submit the setup form.
- Reconnect your phone or computer to its normal network.
The board stores the setup result, restarts, and connects to Flova. In Console, its status should move from setup and sync to online.
4. Test the LED
Open Studio and create a dashboard for the ESP32 LED template. Add a Toggle, connect it to Internal LED, and publish the
dashboard.
Open the device in the Flova web application and change the Toggle. The LED should follow the command. If it does not:
- Confirm that the Device Type version is published.
- Confirm that the dashboard uses the same
ESP32 LEDtemplate. - Check that the datastream key is exactly
LED. - Check the device status and timeline in Console.
- Keep the browser connected to the setup network while provisioning.
Move to custom firmware
Universal firmware is useful for the first device and for products where Flova
owns the complete device composition. Use FlovaEsp32 when your application
must own Wi-Fi, GPIO, sensors, a web server, or another setup channel.
#include <Arduino.h>
#include <WiFi.h>
#include <FlovaSDK.h>
FlovaEsp32 device;
auto relay = FLOVA_DATASTREAM(device, bool, "relay");
void setRelay(bool enabled) {
digitalWrite(2, enabled ? HIGH : LOW);
}
void setup() {
pinMode(2, OUTPUT);
WiFi.begin("your-wifi", "your-password");
FLOVA_ON_WRITE(relay, setRelay);
device.begin();
}
void loop() {
device.run(WiFi.status() == WL_CONNECTED);
}Continue with Datastreams, Provisioning, and Transports when you are ready to build an application around the SDK.
This sketch shows the datastream and network loop. A custom product must also provide its provisioning handoff; see Provisioning before flashing it to a new device.