Fighting with computers

Computers are not always friendly.

Saturday, January 16, 2010

Temperature logger needed

Heating and air conditioning are the cause of much trouble on campus. Yesterday I was asked to make a decission as it was believed one of our buildings was too hot because of the sun. But, as I'd like to make my decissions based on facts I decided to setup a temperature logger. As heating is off on Sunday (but Sun is only off at night) I'll be able to compare the temperature profile of Sunday against all the other days when the heating is on.

Unfortunately no data logger was available so I set up my own one using three simple elements: An arduino board (actually it was an iDuino I had lying around) a Dallas Semiconductor (actually now part of Maxim IC) DS18B20 digital temperature sensor and a PC.

I adapted some code I borrowed from Nuelectronics to read the temperature and I transimted to the PC over the serial port. On the PC side (my office PC is running Windows) I had to program it using VisualStudio, so I created a simple VisualBasic program, whose only purpose is to add the time to the temperature received over the serial port. By redirecting the console output to a file I collect the measurements to a file. Alternatively you can use this code written in Windows PowerShell (remember to save it with .ps1 file extension).

I connected the DS18B20 using the two wires configuration, so an extra 4.7Kohm resistor was needed, but then only two wires are connected to the sensor (instead the three) as this was more convenient to get the sensor located on the right place.

Update: I've got some trouble with PowerShell as it outputs Unicode that some of my scripts are not happy with. In order to change the output I used the out-file cmdlet with -encoding UTF8 and -append parameters instead of the usual stdout redirection operator (>).


Post a Comment

<< Home