I just sent this message to nikonoid, but I thought I'd echo it here for the benefit of the next recipients.
I've included a little Arduino shield which uses an Si7021 temperature and humidity sensor.
Here's the Python script I use to read the data from the Arduino and log the data in CSV format:
https://gist.github.com/cellularmitosis/421781b4f89636b612378f33d705f8c3(also attached to this post)
Usage:
The script takes one argument, which is the serial port it should read from.
For example, using this script on linux might look like:
./Si7021-logger.py /dev/ttyACM0
The script will print output like so:
timestamp,temp_c,humidity
1500422021.565,25.4043,68.5087
1500422022.565,25.4257,68.5239
1500422023.565,25.4150,68.5239
...
That's a timestamp (seconds since the 1970), temperature in celsius, and humidity in percent.
On Linux, your serial port will probably look like /dev/ttyACM0 or /dev/ttyUSB0. On Mac, it might look like /dev/tty.usbserial-DN02TIYO.
On Linux, after you plug in the Arduino, you can run the dmesg command to figure out which device name it got associated with. I don't know of the equivalent of dmesg on Mac, so I just open the Arduino IDE to figure it out. I'm guessing you can do the same on Windows, but I haven't tried it.
Since the output of the script is in CSV format, you can just redirect the output of the script to a file in order to log to a file, e.g.:
./Si7021-logger.py /dev/ttyACM0 > temp-log.csv
If you'd like to watch the output while also logging to a file, you can use the tee command:
./Si7021-logger.py /dev/ttyACM0 | tee temp-log.csv
Technical info:
The Arduino spits out 9 bytes of binary at a time: a 32-bit floating point temperature, a 32-bit floating point humidity, and an 8-bit CRC.
The Python script reads in 9 bytes and checks that the CRC is valid. If it isn't valid, it tries reading another byte until the CRC works, so even if the script starts up in the middle of a 9-byte sequence, the script will recover after throwing away the first reading.