A Method to Wirelessly View and Record MCU Logs in Real-Time

A Method to Wirelessly View and Record MCU Logs in Real-TimeImagine you are a manager of multiple devices, spread across various environments, such as lighting equipment on rooftops, charging equipment at charging stations, and shared devices at train and bus stations.

How do you check the device logs when these devices have anomalies?

If these device issues require long-term observation and log collection, what will you do?

And if the device malfunctions, the program crashes, and the device needs to be restarted, how do you remotely restart the device?

Or would you go to the site to grab the logs, restart the device, but that might involve dismantling the device, rewiring, etc. One device is manageable, but what if it’s 10 devices, or 100 devices?

If you still rely on traditional methods to view device logs and restart devices, it will be a great pain and inefficiency.

Wouldn’t it be great to have a method that allows you to handle these issues remotely from your office or home?

There are some serial data recording modules on the market, but they basically just save data to a TF card, and to view serial data, you have to take out the TF card, which is not very suitable for solving the problems mentioned above. So I designed a wireless serial data recording module that not only saves data to a TF card but also has a supporting PC software, allowing users to view data wirelessly and configure it to a remote server, while also featuring two serial ports, making it twice as useful.

[Friendly Reminder] Send “log tool” in the public account backend to get this tool;

The hardware design has gone through 6 iterations before reaching what I consider a reasonable appearance.

A Method to Wirelessly View and Record MCU Logs in Real-Time
Hardware Iteration

This article will introduce how to use this tool to solve the problems mentioned above. Below is the framework logic diagram of the device working:

A Method to Wirelessly View and Record MCU Logs in Real-Time
All under control

Devices Used

A Method to Wirelessly View and Record MCU Logs in Real-Time
Wireless Dual Serial Data Collector

Here I used a wired dual serial data collector designed by me to solve the problems mentioned above, allowing you to monitor data remotely and support decision-making like a strategist.

This device has two working modes, as shown in the figure below.

A Method to Wirelessly View and Record MCU Logs in Real-Time
Working Modes

Local Area Network Mode: If there is no server, you can directly view the device logs in the local area network by configuring the computer and wireless serial device to the same local area network;

Wide Area Network Mode: If there is a server, you can set the wireless serial device to connect to the server, and the computer also connects to the server, allowing you to view device logs from miles away.

Usage Process

A Method to Wirelessly View and Record MCU Logs in Real-Time
Process
  1. Device configuration;
  2. Device wiring;
  3. Open the computer tool to view the device logs;

Yes, you read that right, just three steps, and you can solve the problems we mentioned above!

Next, let me introduce the key steps;

Wireless Serial Configuration

  1. Prepare a TF card (not exceeding 16G), format the card to FAT32, and create two directories **/log/uart_0 and /log/uart_1** on the SD card;

    A Method to Wirelessly View and Record MCU Logs in Real-Time
    TF Card Formatting
  2. Configure the device to connect to the Wi-Fi and MQTT server address. The specific configuration interface is shown below.

    A Method to Wirelessly View and Record MCU Logs in Real-Time
    Device Configuration

View Real-Time Device Logs

Remote Viewing of Device Logs

Once we have configured the device, since we have set the device to connect to the MQTT server, we can subscribe to the relevant topics of the device using an MQTT client to view the device logs;

Here I used the MQTT.fx PC tool to connect to the same MQTT server as the device and subscribe to the device’s serial channel topic to view the device logs remotely;

A Method to Wirelessly View and Record MCU Logs in Real-Time
MQTT Client

View Device Logs in Local Area Network

At the same time, if we do not have a server, we can open the computer tool under the configured Wi-Fi, and we can find that the device automatically connects, allowing us to receive the serial logs in real-time;

A Method to Wirelessly View and Record MCU Logs in Real-Time
PC Software Viewing Real-Time Logs

Historical Logs

In local area network mode, we can also see that the device stores the data from serial port 0 and serial port 1 sequentially on the TF card, and we can view the historical serial data through the PC software;

A Method to Wirelessly View and Record MCU Logs in Real-Time
Historical Logs

We can double-click a file to open the log, and we can also right-click to save the historical log to the local computer.

A Method to Wirelessly View and Record MCU Logs in Real-Time
Historical Logs

Other Functions

In addition to the above-mentioned capabilities of viewing device logs in real-time within the local area network and remotely through a server configuration, the device has many other functions. I have compiled a complete function list as follows:

Number Function (New Version)
1 Wireless Serial ✔ Supported
2 Real-Time Log Viewing ✔ Supported
3 Historical Log Viewing ✔ Supported
4 Serial Data Recording to TF Card ✔ Supported
5 View TF Card Free Space ✔ Supported
6 Two-Way Data Communication (Send/Receive) ✔ Supported
7 Number of Serial Ports ❤️ 2
8 Serial Port Baud Rate ❤️ 4800-3000000 (Customizable)
9 Can Work Independently from TF Card ❤️ Supported
10 Custom UDP Client Reporting ❤️ Supported
11 Custom MQTT Client Reporting ❤️ Supported
12 Automatically Add Network Timestamp to Logs ❤️ Supported (Version Requirement: v3.0.0+)
13 Automatically Discover and Connect to PC Software ❤️ Supported (Version Requirement: v3.0.0+)
14 Serial Port Mapping Forwarding ❤️ Supported, Allows Familiar Serial Tools to View
15 Online Deletion of TF Card Logs ❤️ Supported (Version Requirement: v3.0.2+)
16 Customizable IO ❤️ Supports Two Customizable IO (Future Support)
17 Module Hotspot Mode (AP) ❤️ In Development (Stay Tuned)

More Fun

More fun: 【Major Upgrade】Stronger Wireless (Dual) Serial Data Recording & Debugging Tool: https://flowus.cn/share/afc3681e-bce7-4019-8c9c-88745595165d?code=GS8DRP

[Friendly Reminder] Send “log tool” in the public account backend to get this tool;

Leave a Comment

×