My radio shack is cupboard size and has a small fan heater in it which very quickly warms the space. But just how quickly…
A while back I built a PIC based thermometer that reads a Maxim 1-wire temperature sensor and sends the readings out a serial port at 9600 baud.
USB serial cables seem to just work out of the box on linux these days:
A little bit of python using pyserial to read lines from the serial port and log them to a text file suitable for reading in to a spreadsheet.
#!/usr/bin/env python
"""Utility to log temperatures from a serial device.
"""
import serial
import time
LOGFILE = '/tmp/temperatures.txt'
ser = serial.Serial('/dev/ttyUSB0')
log = open(LOGFILE, "a")
line = ser.readline()
while line:
logline = "%s\t%s\n" % (time.ctime(),
line.split()[0])
log.write(logline)
log.flush()
line = ser.readline()
Here's a bit of the log file:
Sun Jul 10 14:31:07 2011 28.0
Sun Jul 10 14:31:09 2011 28.5
Sun Jul 10 14:31:11 2011 28.5
Sun Jul 10 14:31:13 2011 28.5
Sun Jul 10 14:31:15 2011 28.5
Sun Jul 10 14:31:17 2011 29.0
Here is the temperature in my shack from window close to toasty warm.
No comments:
Post a Comment