Ever wanted to monitor your ESP32 logs from your PC or smartphone? Even outside your local network?
Then look no further, here's the solution!
WebTerminal
library also requires you install https://github.com/256dpi/arduino-mqtt
(search for lwmqtt
in the Library Manager)
The following sketch has been autogenerated to contain a unique CLIENT_ID
that identifies your ESP32.
You will use the usual ESP_LOGx
functions to print log messages and they will be automatically
forwarded remotely.
Filename: WebTerminalExample.ino
/**
* Inspect logs from remote Serial Monitor
*
* Be sure to set "TOOLS > CORE DEBUG LEVEL = INFO"
* to turn on debug messages
*
* Be sure to replace your WiFi credentials!
*/
#include <WebTerminal.h>
#define WIFI_SSID "SSID"
#define WIFI_PASS "PASSWORD"
#define CLIENT_ID "01JD6RT8R50E6MTZ1KDRT9GHH3"
/**
*
*/
void setup() {
delay(3000);
Serial.begin(115200);
Serial.println("___WEB TERMINAL EXAMPLE___");
// connect to WiFi and remote terminal
while (!WebTerminal.begin(WIFI_SSID, WIFI_PASS, CLIENT_ID)) {
Serial.println("Can't connect to web terminal");
}
Serial.println("Connected to web terminal");
Serial.print("Log messages will be visible online at ");
Serial.print("http://mqtt.eloquentarduino.com/");
Serial.print("arduino-web-serial-monitor/");
Serial.println(CLIENT_ID);
}
/**
*
*/
void loop() {
ESP_LOGI("APP", "This is a INFO message");
ESP_LOGW("APP", "This is a WARN message");
ESP_LOGE("APP", "This is a ERROR message");
raw_log_i("This message will not be forwarded online");
delay(3000);
}
After you flashed the sketch above, click on the button below to see the magic happen!
Due to implementation details, the log viewer page is served over HTTP, so your browser will warn you. Click "Proceed to mqtt.eloquentarduino.com" in the Advanced settings.
Here's a quick demo of the log page
This is a free service for hobbyst makers. There's no limit to the number of logs you can receive,
but your CLIENT_ID
is valid for 1 hour. After that, you will be disconnected and
log
messages will be rejected.
Also, you cannot send messages back to your board.
If you want to remove the limit of 1 hour or send messages back to your board, drop me an email at
Join 1177 businesses and hobbysts skyrocketing their Arduino + ESP32 skills twice a month