Postlad/Guides/Arduino data logger online: send readings to a live chart

Arduino data logger online: send readings to a live chart

An online Arduino data logger sends each reading over WiFi instead of saving it to an SD card. The server adds the timestamp, keeps the history, draws the chart and gives you a link you can open from another device.

UNO R4 WiFi potentiometer wiringA potentiometer connects to 5 volts, analogue input A0 and ground on an Arduino UNO R4 WiFi.UNO R4 WiFi10 kΩ potentiometer5VA0GND
The outer potentiometer pins go to 5V and GND. The centre wiper goes to A0.

This guide uses an Arduino UNO R4 WiFi and its analogue input, so you can test the whole path with a potentiometer or even a loose jumper wire before choosing a sensor.

Reviewed, but not yet bench-tested on this exact board. Check the serial response on your own UNO R4 WiFi before leaving it unattended.

What you need

  • Arduino UNO R4 WiFi
  • USB-C cable
  • Arduino IDE 2.x
  • ArduinoHttpClient, installed from Library Manager
  • A free Postlad account and write key
  • Optional: a 10 kΩ potentiometer for a changing test value

The UNO R4 Minima and the classic UNO R3 do not have WiFi. They need an Ethernet or WiFi shield, or a second networked board. The sketch below is specifically for the UNO R4 WiFi.

Wiring a test value

Connect a potentiometer as follows:

Potentiometer pinUNO R4 WiFi
One outside pin5V
Centre pinA0
Other outside pinGND

Turning the knob changes the voltage on A0. If you have no potentiometer, leave A0 unconnected and treat the noisy value as test data only.

Complete UNO R4 WiFi sketch

Replace the three YOUR_... values, upload the sketch, then open Serial Monitor at 115200 baud.

cpp
#include <WiFiS3.h>
#include <ArduinoHttpClient.h>

const char* WIFI_SSID     = "YOUR_WIFI_SSID";
const char* WIFI_PASSWORD = "YOUR_WIFI_PASSWORD";
const char* WRITE_KEY     = "YOUR_KEY";

const char* POSTLAD_HOST = "api.postlad.com";
const int POSTLAD_PORT = 80;
const unsigned long SEND_INTERVAL_MS = 30000;

WiFiClient network;
HttpClient http(network, POSTLAD_HOST, POSTLAD_PORT);

void connectWiFi() {
  Serial.print("Connecting to WiFi");
  while (WiFi.begin(WIFI_SSID, WIFI_PASSWORD) != WL_CONNECTED) {
    Serial.print('.');
    delay(1000);
  }
  Serial.print("\nConnected. IP: ");
  Serial.println(WiFi.localIP());
}

void setup() {
  Serial.begin(115200);
  delay(500);
  connectWiFi();
}

void loop() {
  if (WiFi.status() != WL_CONNECTED) {
    WiFi.disconnect();
    connectWiFi();
  }

  int raw = analogRead(A0);
  float percent = raw * 100.0 / 1023.0;

  String path = String("/u?k=") + WRITE_KEY
              + "&f1=" + String(raw)
              + "&f2=" + String(percent, 1);

  http.get(path);
  int status = http.responseStatusCode();
  String body = http.responseBody();

  Serial.print("A0=");
  Serial.print(raw);
  Serial.print("  ");
  Serial.print(percent, 1);
  Serial.print("%  HTTP ");
  Serial.print(status);
  Serial.print("  ");
  Serial.println(body);

  http.stop();
  delay(SEND_INTERVAL_MS);
}

A stored reading answers with HTTP 200 and a body such as:

text
ok 37

The number is the account's stored-reading count for the current month. A non-200 response includes a short sentence explaining what needs changing. Print both the status and body while you build; hiding either makes a five-minute wiring problem feel like a server mystery.

Name the fields

Open the stream in Postlad and name:

  • f1A0 raw
  • f2Position
  • Unit for f2%

You can later replace analogRead(A0) with a light sensor, pressure transducer, soil probe or any other numeric reading. Keep the field meaning stable after real data begins. Changing f1 from voltage to temperature does not change the old rows, so one chart would then contain two unrelated measurements.

Why an online logger does not need an RTC

Postlad timestamps the reading when it arrives. For a WiFi-connected device that sends immediately, that removes an RTC module, its battery and its clock-setting code.

If the device must survive a network outage without losing samples, it needs local buffering and timestamps. That is a different build: sample locally, retain the original time, then send a batch after WiFi returns. Do not queue values without their timestamps or they will all appear at the reconnect time.

Online logging or an SD card?

NeedOnline chartSD card
Check the reading from another placeYesNo, not without another device
Share a live graphYesNo
Keep working with no networkOnly with a local bufferYes
Remove the card to retrieve dataNoUsually
Record very fast signalsPoor fitBetter fit
Add a trustworthy timestampServer does itNeeds an RTC or later processing

For a weather station, greenhouse or classroom experiment, an online chart is usually the useful output. For vibration, audio or millisecond sampling, store or aggregate locally and upload a slower summary.

Sending several sensors together

One Postlad reading can carry up to 16 numeric fields. Put measurements from the same device into one request so they share a timestamp and use one quota slot:

cpp
String path = String("/u?k=") + WRITE_KEY
            + "&f1=" + String(temperature, 2)
            + "&f2=" + String(humidity, 1)
            + "&f3=" + String(lightLevel)
            + "&f4=" + String(batteryVoltage, 2);

The Free plan accepts one reading every 5 seconds with a small burst allowance and stores 100,000 readings per account each month. Sending four fields together counts as one reading, not four.

Troubleshooting

It stays on “Connecting to WiFi”

Check the network name and password first. Update the UNO R4 WiFi connectivity firmware using Arduino IDE if the board ships with an old version. Test with a phone hotspot to separate a sketch problem from a router problem.

The server says bad_key

Copy the stream's write key again and keep it out of screenshots and public repositories. A share URL is not a write key, and replacing one with the other is a common mistake.

The server says rate_limited

The sketch is sending more often than the plan allows. Respect the Retry-After header or use an interval longer than 5 seconds. A 30-second interval is a sensible starting point for environmental sensors.

Why does this example use plain HTTP?

Postlad supports plain HTTP on the device endpoint deliberately. It works on boards with limited TLS stacks and avoids certificate maintenance. The trade-off is that somebody who can observe the network can see the write key and reading. Use HTTPS or a trusted private network when that matters.

Can I use a classic Arduino UNO R3?

Not by itself. The UNO R3 has no network interface. Add an Ethernet Shield, a supported WiFi shield, or let an ESP8266/ESP32 handle networking. Do not buy an RTC and SD shield if the job you actually want is a remote chart.

What Postlad keeps

The Free plan includes two streams and 100,000 stored readings per month. Every reading is kept at full detail for 30 days. After that it becomes an hourly minimum, maximum and average, kept for 12 months. Older than that is deleted.

The minimum and maximum matter for sensor work. A five-minute temperature spike should remain visible in a year view instead of being flattened into one hourly average.

FAQ

How do I view Arduino sensor data online?

Give the Arduino a network connection, send each reading to an ingest endpoint, and open the stream's chart URL. The sketch above does that with one HTTP GET request per reading.

Can Arduino send data to a website without MQTT?

Yes. HTTP is enough when the device sends occasional readings and does not need broker features. MQTT becomes useful for bidirectional messaging, many topics or unreliable links; it is not required for a temperature chart.

Can I log Arduino data without an SD card?

Yes. Send it to a server as it is measured. Add a small local buffer if losing a reading during a WiFi outage would be unacceptable.

How often should an Arduino data logger send?

Match the physical process, not the fastest rate the board can produce. Rooms and tanks often need 30–60 seconds. Fast processes should be sampled locally and summarised before upload.

What happens if Postlad shuts down?

CSV export is available from the stream page. Keep exports for irreplaceable experiments, and keep the device code simple enough that changing the destination is one constant rather than a firmware rewrite.

Create the stream

Create a free account, copy the write key from the stream page and paste it into the sketch. No password or credit card is required.

Create your free account →

Sources and verification