Python utilities for real-time embedded device analysis over UART. Built during IoT firmware development at Niltech to replace generic terminal emulators with project-specific tooling.
| Script | Purpose |
|---|---|
serial_reader.py |
Threaded UART reader — no dropped bytes |
packet_parser.py |
Binary packet decoder (sync byte, CRC8, structured logs) |
realtime_plotter.py |
Live matplotlib sensor data plotter |
calibration_tool.py |
Automated multi-point sensor calibration with NVS write |
pip install -r requirements.txt
# Live plot sensor data
python realtime_plotter.py COM3 --baud 115200 --channels 2
# Run calibration
python calibration_tool.py COM3 --points 5 --channel 0[0xAA] [LEN] [TYPE] [PAYLOAD ...] [CRC8]
| Type | Description |
|---|---|
0x01 |
Sensor data — float32 ch0, float32 ch1, uint16 raw ADC, uint8 flags |
0x02 |
Device status |
0x03 |
Alarm event |
0x04 |
Debug log string |
0x05 |
Calibration response |
Text-mode log parsing for firmware that outputs:
[12345][INFO][SENSOR] SpO2: 98% HR: 72bpm
SerialReaderruns on a background daemon thread — the main thread never blocks onreadline()packet_parser.pyvalidates CRC8 before processing; malformed packets are silently dropped and counted- Calibration coefficients (gain + offset) are computed via least-squares and written directly to device NVS over UART command