Quickstart
ESP32 / C SDK

ESP32 / C SDK Quickstart

Send telemetry from an ESP32, ESP8266, or Arduino to your Plexus dashboard in 3 lines of C.

Prerequisites

Step 1: Add the SDK to Your Project

Copy src/ and hal/esp32/ from the C SDK repository (opens in a new tab) into your project directory.

your-project/
├── main/
│   ├── main.c
│   └── CMakeLists.txt
├── components/
│   └── plexus/
│       ├── src/
│       │   ├── plexus.h
│       │   ├── plexus.c
│       │   ├── plexus.hpp
│       │   ├── plexus_config.h
│       │   ├── plexus_internal.h
│       │   └── plexus_json.c
│       ├── hal/
│       │   └── esp32/
│       │       ├── plexus_hal_esp32.c
│       │       └── plexus_hal_storage_esp32.c
│       └── CMakeLists.txt

Step 2: Get Your API Key

  1. Go to app.plexus.company (opens in a new tab)
  2. Click Add Device
  3. Copy the API key (starts with plx_)

Step 3: Send Telemetry

Connect to WiFi first, then initialize the Plexus client and start sending data.

ESP-IDF

#include "plexus.h"
 
void app_main(void) {
    // After WiFi is connected:
    plexus_client_t* px = plexus_init("plx_your_api_key", "esp32-001");
 
    plexus_send(px, "temperature", 72.5);
    plexus_send(px, "humidity", 45.0);
    plexus_flush(px);
 
    plexus_free(px);
}

Arduino (ESP32 / ESP8266)

#include <WiFi.h>
#include "plexus.hpp"
 
PlexusClient px("plx_your_api_key", "arduino-001");
 
void setup() {
    WiFi.begin("SSID", "password");
    while (WiFi.status() != WL_CONNECTED) delay(500);
}
 
void loop() {
    px.send("temperature", analogRead(34) * 0.1);
    px.send("humidity", analogRead(35) * 0.2);
    px.tick();    // auto-flushes every 5 seconds
    delay(1000);
}

px.tick() handles auto-flushing on an interval, so you don't need to call plexus_flush() manually in a loop.

Step 4: See Your Data

Open app.plexus.company (opens in a new tab). Your device appears and metrics populate the dashboard in real time.

Memory Footprint

The C SDK is designed for constrained devices. RAM usage depends on your configuration:

ConfigTotal RAM per Client
Default (all features, 32 metrics)~17 KB
Minimal (numbers only, 8 metrics)~1.5 KB

To get the minimal footprint, set these compiler flags:

-DPLEXUS_MAX_METRICS=8
-DPLEXUS_JSON_BUFFER_SIZE=512
-DPLEXUS_ENABLE_TAGS=0
-DPLEXUS_ENABLE_STRING_VALUES=0
-DPLEXUS_ENABLE_BOOL_VALUES=0
-DPLEXUS_MAX_ENDPOINT_LEN=128
-DPLEXUS_MAX_API_KEY_LEN=64

Check exact size for your build:

printf("Client size: %zu bytes\n", sizeof(plexus_client_t));

Next Steps