Logs data coming from a serial port
Project description
Serial Data Logger
A simple python script that logs the input received from a serial (USB) input to an SQLite database along with logging the time stamp (in the format YYMMDDHHMMSS
) of the received message.
Serial data logger expects the serial inputs to be comma separated.
Install
pip install serialdatalog
Usage
Here's an example using a Finometer pressure sensor.
import logging
import serialdatalog as sdl
logging.basicConfig(level=logging.INFO)
# table_dict is formed of key : value pairs consisting of:
# sql_header : sql_data_type
# If the number of headers is different to that read from the serial input then the input is not
# logged.
table_dict = {
"Elapsed_Time" : "REAL",
"Finger_Pressure" : "REAL",
"Height" : "REAL",
"Arm_Pressure" : "REAL",
"Finger_Plethysmogram" : "REAL",
}
sdl.logger(
table_dict,
source="/dev/ttyACM0",
dest="datalog.sqlite3",
encoding='utf-8',
timeout=10
)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
serialdatalog-0.1.2.tar.gz
(3.0 kB
view hashes)
Built Distribution
Close
Hashes for serialdatalog-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f3e225484390c3efd94fda6de4bb69d9b0a4bd7e4d5a136c12eca17e2bca0d5 |
|
MD5 | 948aff7fb0722c93d28d2d496b09380e |
|
BLAKE2b-256 | 9de85996cb7cc3310f960ec17b0f5964dbf24e35e03b9bfddfb359f72a214809 |