Box IO

Self-hosted IoT for Arduino and ESP32.

Graph

A line graph of one or more virtual pins. The server stores the readings, and the graph can show live data or a past day, week, or month.

Sample pin: V4 and V5

Set it up on the server

  1. Sign in to the Box IO dashboard and open the project that uses this device key.
  2. Turn on Edit.
  3. In Edit, add Graph.
  4. Assign the project device key, or set Device on this widget.
  5. Use Add pin for each virtual pin you want on the chart. Each row is a pin number, a name, and a color. Remove drops one pin. The graph holds up to 16 pins.
  6. Set Store a reading to one per second, one per minute, or one per hour. One per second is kept 31 days. One per minute is kept 400 days. One per hour is kept 5 years. A new reading in the same period replaces the earlier one.
  7. Set Live view to the window shown while Live is selected: 1 minute, 15 minutes, 1 hour, 6 hours, 1 day, 1 week, or 1 month.
  8. Save the layout. Until you save, the server does not store these pins.
  9. Open Live. Live follows the window you chose. Day shows 24 hours from the date and time you pick. Week shows the Monday-to-Monday week of that date. Month shows that calendar month. Prev and Next move the date.
  10. Flash the sketch below with the same device key, host, and port 5923. Keep BoxIO.run() in loop().

Properties

Sketch values are always strings, including numbers: BoxIO.setProperty(V2, "max", "200").

PropertyWhere to set itFormatExampleEffect
sampleEveryDashboardsecond, minute, or hourminuteHow often a reading is stored for every pin on this graph.
liveSpanDashboardminute, 15m, hour, 6h, day, week, or monthhourHow far back the Live button looks.
graphSeriesDashboardPin, name, and color rowsV4 Temp, V5 HumThe virtual pins drawn on the chart. Each pin is stored on the device key for this widget.
labelDashboard or sketchPlain textPumpCaption above the widget. On a round or oval button this is the caption, not the word on the button face.
hideLabelDashboardOn or offcheckedHides the caption. Button face text, meter numbers, and label text stay visible.
fontSizeDashboardWhole number 8 to 160, or blank for automatic size28Text size in pixels inside the widget.
opacityDashboard10% to 100%70%Lets an overlapping widget show through. 100% is solid.

Formatting

Sketch

Paste the device key over bx_paste_your_device_key_here. Wi-Fi boards include BoxIOEsp32.h. Ethernet boards use the same calls with an EthernetClient.

#define BOXIO_AUTH "bx_paste_your_device_key_here"
#define WIFI_SSID  "your-ssid"
#define WIFI_PASS  "your-password"
#define BOXIO_HOST "localhost"
#define BOXIO_PORT 5923

#include <BoxIOEsp32.h>

void setup() {
  BoxIO.begin(BOXIO_AUTH, WIFI_SSID, WIFI_PASS, BOXIO_HOST, BOXIO_PORT);
BoxIO.setTimer(1000, sendTemp);
  BoxIO.setTimer(1000, sendHum);
}

void loop() {
  BoxIO.run();

}

void sendTemp() {
  BoxIO.virtualWrite(V4, analogRead(34));
}

void sendHum() {
  BoxIO.virtualWrite(V5, analogRead(35));
}

What you should see

After you save the layout, each virtualWrite on those pins leaves one reading at the rate you set. Live shows the recent window. Day, Week, and Month show the stored readings for the date you pick.