Instructions
PROGRAM 3. DATA LOGGER
This program (03_data_logger.py) doesn't have a graphical interface. It just prompts
you to enter an interval in seconds between readings, followed by the name of a file
in which to save the readings.
In the example above, sampling is set to 5 seconds and the file is called
readings.txt. When you have finished logging data, CTRL-c will end logging and
close the file.
The data are saved in the same format as they are shown in the screen capture
above. That is, the first line specifies the headings, with each value delimited by a
TAB character. The file is saved in the same directory as the program.
Having captured the data, you can then import it into a spreadsheet (like
LibreOffice) on your Raspberry Pi and then plot a chart from the data.
If LibreOffice is not installed on your Raspberry Pi, you can install it using the
Add/Remove Software option on the Preferences Menu.
Open a new spreadsheet, chose Open from the file menu, and navigate to the data
file you want to look at. This will open an import dialog (see the next page) showing
that the spreadsheet has automatically detected the columns of the data.
Page 17