This Python script runs on a Raspberry Pi (or any Linux system) and:
- Reads incoming text data from a serial port (e.g. a USB-connected device such as a pager, sensor, or microcontroller).
- Detects when the incoming data changes.
- Saves each unique line to a local CSV log file.
- Sends each unique line as an HTTP POST request to a remote web server for further processing.
- β
Works with
/dev/serial/by-id/...or/dev/ttyUSB0 - β Filters out duplicate lines (only sends new data)
- β
Logs timestamped entries to
test_data.csv - β
Sends data to a remote PHP/HTTP endpoint via
requests.post() - β Handles serial decoding issues gracefully
- β Recovers from most runtime errors without crashing
- Python 3.x
- Installed Python packages:
pip install pyserial requests