Connect an ESP32 in five minutes

You need a project that already connects to WiFi or Ethernet, and a Pinscope account. ESP-IDF 5.x or 6.x, Arduino (Arduino-ESP32 2.x or 3.x) or PlatformIO; any ESP32 with WiFi: ESP32, S2, S3, C2, C3, C5, C6 or C61. The steps below are for ESP-IDF; Arduino and PlatformIO follow them.

With an AI assistant. Copy the instructions and paste them into Claude, Cursor, Copilot or ChatGPT in your project: it adds Pinscope the way this page says, and asks you for the project key instead of writing it into your code. Or give it the link: esp-idf.md · arduino.md.

Video: connecting an ESP32 to Pinscope in ESP-IDF and VS Code This guide on videoYouTube · 2:31

1. Connect

Add the component

From your project's folder. The build downloads it from the ESP Component Registry the next time it runs.

idf.py add-dependency "pinscope/pinscope^0.2.15"

The source is yours to read and to change. Its licence allows use with the Pinscope service only.

Enter your project key

In the dashboard, open your project and the tab Connect a device and copy the project key. Enter it in idf.py menuconfig under Pinscope. The same key goes into every device of the project; each device registers itself.

Start it

#include "pinscope.h"

void app_main(void)
{
    /* your WiFi and web server setup */

    pinscope_start(NULL);
}

Call it once, any time after esp_netif_init() and esp_event_loop_create_default(). It does not need the network to be up yet and it reconnects by itself. The device needs to reach connect.pinscope.dev on TCP port 443, outbound only. Flash the firmware and the device appears under Devices.

Arduino and PlatformIO

Arduino IDE: Tools → Manage Libraries, search for Pinscope, Install. (Or Sketch → Include Library → Add .ZIP Library with pinscope-esp-0.2.15.zip.) File → Examples → Pinscope → RemoteWebServer is a complete sketch. PublicSensor, next to it, serves a sensor reading and its last ten minutes on a page anyone can open (see Public page).

PlatformIO, with the Arduino or the ESP-IDF framework, in platformio.ini:

lib_deps = pinscope/pinscope@^0.2.15

There is no menuconfig there, so the key goes in the code:

#include <pinscope.h>

pinscope_config_t config = {};
config.project_key = "psk_...";
config.firmware_version = "1.0.0";   // shown in the dashboard
pinscope_start(&config);   // in setup(), after WiFi.begin()

Crash reports need Arduino-ESP32 3.x (or the ESP-IDF framework); everything else also works on 2.x. Firmware updates need a partition scheme with two app slots, which the default one has. Arduino builds carry no version of their own, so set firmware_version: it is what the dashboard shows for the device, its crashes and its updates. Text passed to pinscope_log() reaches the Logs tab; Serial.print() stays on the cable.

2. Reach the device

Whatever listens on port 80 of the device is now served at the device's own HTTPS address, shown on its page in the dashboard. Open web UI takes you there. Pages, JSON APIs and WebSockets pass through unchanged, including headers, cookies and HTTP Basic authentication of your own server.

Public page

On paid plans, Make public on the device's page opens its web UI to everyone, with no account and no expiry, until you press Make private. Visitors can use its buttons too, so refuse what guests should not do with request rules for share links; they apply to the public page as well. If the plan ends, the page stops being public.

A public page and a share link can take many visitors at once, because the device does not answer each of them. Pinscope keeps the last answer to each address for two seconds and gives it to everyone who asks meanwhile, so the device sees about one request per address every two seconds, however many people are watching. If the device is slow to answer, visitors get the last good answer, up to a minute old. To make the most of it:

Traffic between the device and Pinscope counts toward the monthly limit; answers given from the kept copy do not.

Visits to the link on the device's page counts how often guests opened it, through a share link or the public page: views and visitors for today, the last 7 and 30 days, and views since the first one. Your own visits from the dashboard, API calls, images and scripts, and bots are not counted. The device is told the same numbers: every request it gets through Pinscope carries the header X-Pinscope-Visits: today=12;today_visitors=5;7d=226;30d=562;total=1840, so its own page can show them. The RemoteWebServer and PublicSensor examples and the ESP-IDF example do.

3. Logs and metrics

Output written with ESP_LOG is forwarded automatically. In the Logs tab you can follow it live, jump to a date and time, load older lines and search everything that is stored.

These are reported with no code, once a minute:

MetricMeaning
heap_free, heap_min, heap_largestFree heap now, the lowest it has been, the largest free block
cpu_load, cpu/<task>Overall CPU load and the share of each task (switch on PINSCOPE_METRIC_TASK_CPU)
stack_min, stack/<task>Least free stack of any task, and of each task
rssi, wifi_disconnectsWiFi signal and how often the connection dropped
chip_temp_c, uptime_sChip temperature (where there is a sensor) and time since boot

Send your own from any task:

pinscope_metric("water_level_cm", 42.5);

4. Crashes

When the firmware panics, the reason, the task and the backtrace are kept in RTC memory across the reboot and sent on the next connection. They appear in the Crashes tab.

To read function names and line numbers instead of addresses, upload build/<project>.elf of that build under the project's Firmware tab. Builds are matched by the ELF hash the device reports, so a crash is only decoded with the ELF it came from. Without the ELF the dashboard shows the addresses and the addr2line command to decode them yourself, or paste them into the exception decoder, which runs in the browser.

5. Firmware updates

The partition table needs two OTA application slots. For 4 MB of flash, a partitions.csv like this one, chosen in menuconfig under Partition Table:

# Name,   Type, SubType, Offset,   Size
nvs,      data, nvs,     0x9000,   0x6000
otadata,  data, ota,     0xf000,   0x2000
phy_init, data, phy,     0x11000,  0x1000
ota_0,    app,  ota_0,   0x20000,  0x1E0000
ota_1,    app,  ota_1,   0x200000, 0x1E0000

Then upload build/<project>.bin under Firmware and press Update firmware on a device. The image travels over the existing connection, is written to the spare slot with esp_ota, verified and booted.

With CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE, the new image is confirmed when it reaches the server. An image that has not reached the server after five minutes restarts the device, and the bootloader goes back to the previous one. A crash in the new image is reported under that image, not the one that took over. Images built for a different chip are refused.

Arduino and PlatformIO

The same two-slot update as with esp_ota or ArduinoOTA, only sent through Pinscope: build the new firmware, upload its .bin under Firmware, and press Update firmware on the device. The new firmware has to start Pinscope too, or the device cannot be reached afterwards.

The Arduino core accepts every new firmware as soon as it boots. To have the device go back to the previous one when a new one cannot reach Pinscope (a wrong WiFi password, a crash at start), add this line to the sketch, as the PublicSensor example does:

extern "C" bool verifyRollbackLater() { return true; }

The new firmware then stays on trial until it connects, and the device restarts into the previous one after five minutes if it has not.

Security and the CRA

The project's Security tab keeps the SBOM of a build, checks the packages in it against the NVD every day, lists the known vulnerabilities in it and emails you when a new one appears. On the free plan it checks one build; the paid plans check every build, show the devices that run an affected one, keep your decision on each vulnerability and the support period, and write the report. It is made for the EU Cyber Resilience Act, which asks device makers for an SBOM, for vulnerabilities to be handled through security updates, and for a support period: what the Act asks and what Pinscope covers.

Attach an SBOM

SPDX (tag-value, JSON or 3.0) or CycloneDX, the files the build tools write:

# ESP-IDF (pip install esp-idf-sbom)
idf.py sbom-create          # writes build/<project>.spdx

# Zephyr
west spdx --init -d build
west build ... -- -DCONFIG_BUILD_OUTPUT_META=y
west spdx -d build          # writes build/spdx/*.spdx

Upload the firmware image under Firmware as usual, then attach its SBOM in Security with Attach SBOM. From CI, both at once: ci.sh build/app.bin --sbom build/app.spdx, or the GitHub Action's sbom input. An API token with the deploy scope may attach SBOMs.

What is checked

Only packages linked into the application, with a CPE, against the NVD, with the matching esp-idf-sbom uses: its vendor aliases (mbed TLS is published under more than one), version ranges, and for ESP-IDF the vulnerabilities Espressif has excluded, with its reasons. A package's own cve-exclude-list (SPDX) or a CycloneDX VEX analysis in the SBOM is respected too. On ESP-IDF 5.5.3 the result is the list idf.py sbom-check prints.

Decisions, alerts and the report

Give each vulnerability a status (affected, not affected, fixed) and a note; the activity log keeps who and when. A vulnerability that appears in the NVD for something you ship arrives by email and webhook, where the project's alerts go, unless you switch that off under Settings in the Security tab. There too, set the end of the support period. Report (JSON) and CSV download all of it.

6. Alerts

Under the project's Alerts tab, choose to be told when a device stays offline longer than a set time (and when it returns) and when it crashes. Alerts go to your email, to a webhook, or both. The webhook receives a JSON POST:

{
  "event": "offline",
  "title": "pump-station-07 is offline",
  "detail": "It has not been connected for 10 minutes.",
  "at": "2026-10-10T14:21:07.000Z",
  "project": { "id": 1, "name": "Pumps" },
  "device": { "id": 7, "name": "pump-station-07", "hardwareId": "84f703d9f0bc", "url": "https://..." }
}

event is offline, online, crash or test.

7. Scripts and rules

A script or a backend reaches a device with an API token from the project's API tokens tab:

curl -H "Authorization: Bearer pst_..." https://<device address>/api/status

The token is removed before the request reaches the device. If your device's own API needs the Authorization header, send the token as X-Pinscope-Token instead.

Request rules refuse chosen requests on the server, for everyone or only for share links or API tokens. For example: block POST /update for share links, so a guest can look but not flash.

8. Fleets: tags and rollouts

Tags group devices: beta, building-2, customer-x. Give a device tags on its page, or select several in the device list and tag them at once; the list filters by tag and searches names, IDs, firmware versions and tags.

A rollout sends one image to many devices, in waves. Start one from Firmware (Roll out…), from the device list with devices selected, or from the Rollouts tab, and choose:

A wave starts only when every device of the one before is updated or failed. A device fails when it refuses the image, comes back on the old firmware (the bootloader rolled it back), does not come back within 15 minutes, or crashes while it is watched. Too many failures stop the rollout: devices not yet reached keep their firmware, and the owner gets an email. Offline devices are skipped after half an hour; they get the image in a later rollout. Pause, resume or stop a rollout at any time.

9. From CI, and Prometheus

Make an API token that may upload firmware and start updates, keep it as a secret of your CI, and after the build:

curl -fsSL https://pinscope.dev/ci.sh | sh -s -- --token "$PINSCOPE_TOKEN" --project <number> \
  build/app.bin build/app.elf --rollout --tag beta --wait

The project number is in its dashboard address. --rollout starts a rollout of the uploaded image with the default waves (--waves 25,100 to change them, --failures 1 to allow one failure), --wait waits for it to end and fails the job if it stopped. Uploading the same file again is harmless: it is the one already there. On GitHub, the pinscope-dev/deploy-action action does the same:

- uses: pinscope-dev/deploy-action@v1
  with:
    token: ${{ secrets.PINSCOPE_TOKEN }}
    project: 12
    files: build/app.bin build/app.elf
    rollout: true
    wait: true

A token that may read metrics lets Prometheus (or Grafana Agent) scrape /api/projects/<number>/metrics: whether each device is connected, when it was last seen, its restarts by reason, and the latest value of every metric it reports, labelled with the device's name, ID, firmware, chip and tags.

- job_name: pinscope
  scheme: https
  metrics_path: /api/projects/12/metrics
  authorization: { credentials: pst_... }
  static_configs: [{ targets: ['pinscope.dev'] }]

A token does only what it was made for. The three kinds are separate: one that opens device pages cannot upload firmware, and one that uploads firmware cannot open device pages. No token can change the project's settings or see its key.

10. Teams

Under People, invite colleagues by email to a project, with a role:

RoleCan
ViewerSee devices, logs, metrics, crashes and rollouts; open device pages with the rules for share links
MemberAlso update firmware, start rollouts, share devices, tag and rename them; sees the project key to flash devices
AdminAlso alerts, request rules, API tokens and people (only the owner can make admins)
OwnerEverything, including deleting the project; the devices count against the owner's plan

The invitation works for seven days, for the address it was sent to. Someone removed from a project loses it at once, including device pages they had open. Activity shows who did what in the project for 180 days. The free plan allows one person besides the owner, Maker three, Team ten, and Business any number. Only the owner pays: people invited use their own accounts, free ones included, and the project's devices count against the owner's plan.

Memory

The component needs 9.4 KB of RAM in total while connected, and 18 KB of flash. The sizes are fixed; there is nothing to tune. It brings no TLS library: the connection to Pinscope uses the Noise protocol (X25519, ChaCha20-Poly1305) on port 443. Measured on an ESP32-S2, as the free heap of the same application built with and without Pinscope:

Bytes
Frame buffers (1 KB out, 512 B in) and the log and metric queue (2 KB)3,625
Rest of the state, and code it places in IRAM1,343
Task stack3,072
Task, lock and the socket to Pinscope1,544
Total9,584

Opening the device's page adds no buffers of Pinscope's own. The device serves two tunnelled connections at a time; when a page asks for more, the rest wait on the server, so nothing fails. Each uses one lwIP socket, the one your web server accepts.

Options

Everything is under Pinscope in menuconfig, and every kind of reported data has its own switch under Reported data: device info, log capture, crash reports, and each group of metrics. The same choices can be made in code, where every field is optional:

pinscope_config_t cfg = {
    .ports = { 80, 8080 },
    .metrics = PINSCOPE_M_HEAP | PINSCOPE_M_RSSI,
    .log_capture = PINSCOPE_OFF,
};
pinscope_start(&cfg);

CPU usage per task is off by default: it switches on FreeRTOS run-time statistics for the whole firmware, which read a timer on every context switch. Crash capture wraps esp_panic_handler; switch it off if your application wraps that function itself.

Functions

All in pinscope.h. Only the first is needed.

FunctionWhat it does
pinscope_start(cfg)Starts Pinscope in a task of its own. NULL uses the menuconfig settings. Returns 0 on success
pinscope_metric(name, value)Reports a number of your own. From any task; never waits for the network
pinscope_log(text, len)Sends text to the log that did not go through ESP_LOG
pinscope_state()PINSCOPE_CONNECTING, PINSCOPE_ONLINE, PINSCOPE_REJECTED or PINSCOPE_STOPPED
pinscope_url()The device's own address, empty until it has connected once
pinscope_kick()Reconnects now instead of waiting, for example right after the network came back
pinscope_stop()Closes the connection and ends the task

If it does not work

Pinscope writes to the serial log under the tag pinscope. A device that connected says online at https://….

What you seeWhat to check
the project key is missingEnter the key in idf.py menuconfig under Pinscope and build again
The build stops: Pinscope: the project key in menuconfig …The key was pasted twice or cut short. Copy it again from Connect a device; it is psk_ and 24 more characters
credentials refusedThe key is not the one shown in the dashboard; or your email address is not confirmed yet; or your plan's number of devices is used up; or the project is locked and this device lost its credential (reset it on the device's page)
No online at line, no errorThe device has no network yet, or the network does not let it reach connect.pinscope.dev on TCP port 443. It keeps trying by itself
The device is online, its address shows an error pageNothing is listening on the exposed port. The default is 80; change Local port to expose if your server uses another
Pages load, but each request takes a quarter of a secondSet TCP_NODELAY on your server's connections (see Reach the device)
There is no Update firmware buttonThe partition table has no second OTA slot, or updates are switched off in menuconfig
An update goes back to the old firmwareThe new image did not reach Pinscope within five minutes: wrong WiFi settings or project key in that build, or it crashes at start (look under Crashes)

Still stuck? Write to support@pinscope.dev with the lines the device logs under pinscope.

Background