capteur-nuage.ino
TLS on an Arduino Wi-Fi module is the real trial: WiFiSSLClient + ArduinoJson publish a JSON measurement to any HTTPS API. The skeleton of every cloud dashboard.
Hardware required
An Arduino GIGA R1 WiFi (STM32H747, 1DX radio module: Wi-Fi b/g/n + BLE, u.FL antenna included), powered over USB-C. A reachable HTTPS API (httpbin-style test endpoint, or your server).
Wiring
No wiring; u.FL antenna fitted. The root certificate must be known to the core — otherwise TLS error.
How it works
WiFiSSLClient performs the TLS handshake through the module; ArduinoJson serializes without fragile concatenation. Content-Length computed from the document size. In the Arduino IDE, « Arduino Zephyr-based Boards » platform, « Arduino Giga R1 » board; fit the u.FL antenna before using the radio, then Upload.
Going further
Add exponential retry and a measurement queue in flash for network outages.
capteur-nuage.ino
// GIGA R1 WiFi : POST JSON vers un service de test, toutes les 30 s.
#include <WiFi.h>
#include <WiFiSSLClient.h>
#include <ArduinoJson.h>
const char *SSID = "votre-wifi", *CLE = "votre-cle";
WiFiSSLClient client;
void setup() {
Serial.begin(115200);
WiFi.begin(SSID, CLE);
while (WiFi.status() != WL_CONNECTED) delay(300);
}
void loop() {
if (client.connect("api.example.com", 443)) {
StaticJsonDocument<128> doc;
doc["capteur"] = "A0";
doc["valeur"] = analogRead(A0);
doc["rssi"] = WiFi.RSSI();
String corps;
serializeJson(doc, corps);
client.println("POST /v1/mesures HTTP/1.1");
client.println("Host: api.example.com");
client.println("Content-Type: application/json");
client.print("Content-Length: "); client.println(corps.length());
client.println(); client.println(corps);
while (client.available()) Serial.write(client.read());
client.stop();
} else {
Serial.println("connexion TLS refusee");
}
delay(30000);
}