Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Page 2 of 2 < 1 2
Topic Options
#194242 - 19/12/2003 14:49 Re: D-I-Y room temperature sensor circuit for PC [Re: andym]
g_attrill
old hand

Registered: 14/04/2002
Posts: 1172
Loc: Hants, UK
I think I need to go for a drive...

<joke>

This is a nice place at this time of year...

http://www.multimap.com/map/browse.cgi?X=560000&Y=95000&scale=100000&coordsys=gb

</joke>

Top
#194243 - 19/12/2003 15:06 Re: D-I-Y room temperature sensor circuit for PC [Re: g_attrill]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
Yeah, sometimes my company makes me want to drive off a cliff, too.
_________________________
Tony Fabris

Top
#194244 - 19/12/2003 15:37 Re: D-I-Y room temperature sensor circuit for PC [Re: g_attrill]
andym
carpal tunnel

Registered: 17/01/2002
Posts: 3996
Loc: Manchester UK
I'm not that upset, if we get bought by microsoft then maybe...
_________________________
Cheers,

Andy M

Top
#194245 - 24/12/2003 15:42 Re: D-I-Y room temperature sensor circuit for PC [Re: tfabris]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
Okay, I did it. All done. Works.

Interestingly, I did not use any pre-made solution. All of the other solutions used some kind of IC with timing data to send the temperature reading as a set of pulses. Even the one that used the joystick port did so by sending timed pulses to the joystick buttons, instead of being resistance measured on the X/Y axes.

But reading about the joystick port gave me the idea: Cheap $2.00 thermistors on one of the joystick port axes, write a quick bit of VB code to read the value, and you've got it.

Here is a picture of the final assembly. You will see that I have two thermistors, more on the reason for that below. They are crimped to some serial port pins I bought and plugged into the X and Y axis sensor pins for the joystick port (1-3 and 6-8). Total cost of thermistors and pins: About 6 bucks. And that's just because I had to buy an entire serial port assembly to get the pins.



Also note the audio plug coming out of the sound card. This server computer has a soundcard only because it's the device that supplies the on-hold music for our telephone system. We kept going through CD players... turns out that WinAmp on a Win98 box is more reliable. Who'd have thunk it?

Anyway, the things I learned from this:

1. In order for Windows to recognize that a joystick is present, it must be getting some kind of a reading on both the X and Y axis of the joystick, otherwise it thinks it's unplugged. Hence two thermistors. I only use the value for one of the two.

2. Even if the Device Manager says that the joystick port is working, Windows won't actually return the values on that port until you've actually added a specific joystick in the windows control panel.

3. Thermistors are going to return different values, you can't expect them to all be the same. In this case, the X and Y values were wildly different, even though they are reading the same temp.

4. If all you care about is a single temp threshold (in my case the threshold is "server room is hotter than I'd like it to be"), you don't need complex code to calibrate exact sensor temps. All I did was turn off the AC in the server room, then watch the axis value change. When I felt it was warm enough in there that I'd get nervous, I noted the value. My program merely sends email when that threshold is busted.

5. The value returned from the Windows joystick function goes down as the temperature goes up. Important to keep in mind when you're putting those pesky greater-than and less-than signs in your code...

My code currently keeps a record of the last X readings in log file on a shared folder on the main file server. X can be changed on the fly by editing the first line of that log file (for now, X is 20). I can also change the threshold value itself by editing that same log file. So I can disable the emails on the fly remotely simply by changing the threshold.

It samples the temperature about once per minute. If the last ten minutes of readings all bust the threshold, it sends an email to three addresses: My work email, my home email, and my cell phone. It will continue to do so every ten minutes until I do something about it. This repetition is important, because my corporate SMTP server is sketchy about sending emails.

Anyway, thanks everyone for your help and suggestions in this thread. I can now go on xmas vacation and not worry about the AC in the server room.


Attachments
193906-thermistors.jpg (206 downloads)

_________________________
Tony Fabris

Top
#194246 - 24/12/2003 16:00 Re: D-I-Y room temperature sensor circuit for PC [Re: tfabris]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
Now you need to figure out how to plug it into an SNMP agent and log it via MRTG.
_________________________
Bitt Faulk

Top
#194247 - 28/12/2003 05:18 Re: D-I-Y room temperature sensor circuit for PC [Re: wfaulk]
andy
carpal tunnel

Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
Though of course you don't need SNMP with MRTG. You can just as easily output the reading from stdout for MRTG to read.
_________________________
Remind me to change my signature to something more interesting someday

Top
#194248 - 28/12/2003 15:56 Re: D-I-Y room temperature sensor circuit for PC [Re: andy]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
Good point. I always think of getting MRTG data from remote computers.
_________________________
Bitt Faulk

Top
Page 2 of 2 < 1 2