Tuna

Blog · 13 October 2026 · 8 min read

Build an IoT sensor dashboard with an ESP32 and a managed gateway

A sensor dashboard is a good first IoT project, and a good way to see how the pieces fit. The idea is simple: many cheap microcontrollers measure things, one small Linux computer collects the readings and shows them, and you can still update the whole thing remotely when you want to change it.

The layout

The ESP32 does not run the Tuna agent, since it is a microcontroller and not a Linux machine. It does not need to. It only has to be able to send a small message to the gateway.

Step 1: the ESP32 sketch

Each board posts its reading to the gateway as a small JSON message over HTTP. In Arduino style:

#include <WiFi.h>
#include <HTTPClient.h>

void loop() {
  float t = readTemperature();         // your sensor code
  HTTPClient http;
  http.begin("http://gateway.local:3000/readings");
  http.addHeader("content-type", "application/json");
  http.POST(String("{\"sensor\":\"esp32-kitchen\",\"temp\":") + t + "}");
  http.end();
  delay(60000);
}

Step 2: the gateway services

On the Raspberry Pi, two services do the work: a small collector that accepts the readings and keeps them in a database file, and a web page that draws the charts. Describe them in tuna.json:

{"services": {
  "collector": {"command": "./collector/run.sh", "port": 3000, "healthPath": "/health", "cwd": "volume"},
  "dashboard": {"command": "./dashboard/run.sh", "port": 8080, "healthPath": "/health",
                "dependsOn": ["collector"], "expose": true}}}

The collector keeps its data on the volume, so updating the dashboard never loses a reading. The service marked expose is the one shown at the gateway's public address.

Step 3: put it on the gateway

Add a device in the hub and run the one-line install command it shows on the Raspberry Pi. The gateway appears in your fleet within a minute. Then publish from your project folder:

tuna login --hub https://tunalicious.io
tuna push iot-dashboard --notes "first version"

Step 4: open the dashboard anywhere

Turn on the gateway's public address and your dashboard is reachable from your phone, even behind a home router, without opening ports. Keep the name hard to guess, since anyone with the link can open it.

Mixing in other devices

Because the gateway is just a Linux machine, you can add more of them: a second site, a kiosk screen showing the dashboard, a mini PC doing heavier analysis. Put them in the same fleet and a single push updates them all. Sensors that do not run Linux, like the ESP32, simply keep reporting to whichever gateway is nearest.

Keeping it healthy

Give the collector a health path so a bad release is rolled back by itself, and use the fleet view to see if the gateway stops checking in. Because the gateway keeps working offline and catches up when the network returns, short outages do not lose data.

Try it with your own devices.
The first 10 devices are free, no card needed.
Get started

More to read