Wireless Trace for Debug
Display on a webpage a serial debug trace send by Wifi. Use an ESP32 with small olded to generate the webpage when a distant is connected
When a project is using software, a trace is often used.
In my case, I always use a serial link, 9600 bds, to send messages to outside and later to debug and found the software issues.
My problem is to always have a connected computer to the device to record and analyze later.
Here, a simple proposal, using an ESP32 with small oled (in this case, a Wemos version).
The software is, at this moment quite simple:
- Open the serial link to predefine speed: 9600 bds
- Connect to wifi network, home network
- Initiale server with a port, eiher standard 80, or random one like 6200...
- The main loop is reading all characters from serial link
- Record all of them in a table of 65000 dimension
- When a distant is connected, create a webpage and send all the table content to the webpage, with just transforming the CR/LF by
- The table is rolling index management. If the writing index is at the end, it is restarting from beginning
The beauty of this is that with a correct port forward in the router, it is possible to see the trace from outside home (it is the reason of random port).
The hardware is very simple, just a pullup 10k on the Rx line and a diod, 4148, with the anod on the RX and cathod to the Tx of the device. This is to accept 5V power device.
The software can be improved with using WifiManager to avoid Wifi in hard in the code, enter some parameters such as server port, or even change some color of the log regarding some special string.
In the join SW, I have 2 Wifi connection, in case the first one fail, it will try on the second one
I develop a simple casing, files joined.
So far, I use this for some time and help me to debug some old bugs on a Nixie clock...
Laurent
In my case, I always use a serial link, 9600 bds, to send messages to outside and later to debug and found the software issues.
My problem is to always have a connected computer to the device to record and analyze later.
Here, a simple proposal, using an ESP32 with small oled (in this case, a Wemos version).
The software is, at this moment quite simple:
- Open the serial link to predefine speed: 9600 bds
- Connect to wifi network, home network
- Initiale server with a port, eiher standard 80, or random one like 6200...
- The main loop is reading all characters from serial link
- Record all of them in a table of 65000 dimension
- When a distant is connected, create a webpage and send all the table content to the webpage, with just transforming the CR/LF by
- The table is rolling index management. If the writing index is at the end, it is restarting from beginning
The beauty of this is that with a correct port forward in the router, it is possible to see the trace from outside home (it is the reason of random port).
The hardware is very simple, just a pullup 10k on the Rx line and a diod, 4148, with the anod on the RX and cathod to the Tx of the device. This is to accept 5V power device.
The software can be improved with using WifiManager to avoid Wifi in hard in the code, enter some parameters such as server port, or even change some color of the log regarding some special string.
In the join SW, I have 2 Wifi connection, in case the first one fail, it will try on the second one
I develop a simple casing, files joined.
So far, I use this for some time and help me to debug some old bugs on a Nixie clock...
Laurent
Discussie (1 opmerking(en))