Using Joystick Ports to Measure Case Temperature?
cheros asks: "Due to lack of options I had to stick one of my machines in a spot where I'm worried it might get hot, so I am looking for a low cost way to monitor environment temperature. As it's a humble 486 it doesn't have sensors, but it DOES have a joystick port. I'm merely looking for one of 'OK', 'Warm', 'Hot', or 'Get the fire extinguisher!' style status info so I'm not too bothered about granularity. If I remember correctly, a joystick port gives me 2 channels to fool with. I was wondering if anyone has already been playing with the idea to use an NTC (temperature sensitive resistor), and if they got anywhere. In my case it's a matter of scanning the port every so often and sending an SMS email if the situation warrants attention. As a matter of fact, the joystick port also has a couple of switch lines as well - there's all sorts of fun to be had. The last time I've coded was in 6303 assembler on Psion Organisers, so don't expect too much of me in the way of coding skills - it'll take me a while to get up to speed in Perl. Yes, I run Linux [it's a 486 - what did you expect? XP? ;-)]"
why bother having it message you? just have it shut the damn thing down
A 486 is hardly a heat sensitive piece of hardware. Hell, many of them didnt even bother with heatsinks. If you can get your 486 to overheat, take it out of the oven.
I have no idea how one would measure temperatures through some sort of joystick port dongle; however, it put me in mind of the coolest hack I've ever seen for a joystick port, very cool. It may even be vaguely on topic since he mentions the "all sorts of fun to be had" with the joystick port... Take a look:
:-)
Hooking an Arcade Star Wars Flight Yoke to a PC
What a cool joystick port hack--it uses all the original electronics from a circa 1984 Star Wars or RotJ controller, except for a change of POTS. Better than any cheesy gaming steering wheel.
Chasing Amy
(We all chase Amy...)
"The more corrupt the state, the more numerous the laws"-Tacitus
I use a program called netsaint to monitor the internal network.
They have a cool hack premade for what you need
http://www.netsaint.org/docs/hacks/hltherm.php
I really hate Dan Patrick.
Your biggest problem is going to be getting thermisters in the right resistance and wattage range. IIRC, most thermisters are in the 10-100k range, and aren't good for many volts [Watts]. Self-heating!
As another poster has commented, why are you worried? A 486 certainly only needs a passive heatsink (if that) and you could probably lose the PSU fan without overheating if the Linux box is fairly idle due to idle-at-HLT powersavings.
Unless you have your computer sitting on top of a furnace, you won't have to worry much about overheating a 486 - my 486 doesn't even have a heatsink/fan, and, come to think of it, I've never seen a 486 with that going on.
Probably the easiest thing you can do is just attatch a heatsink and fan with some thermal compound, and maybe get one of those ball-bearing fans that fits into a PCI slot if you want some extra cooling. That alone should remove any worries you need to have about overheating the computer, so you won't even need a heat sensor.
A joystick port, eh? Oh, good, that will help.
What about my 466? It DOES have a power supply...
;)
-- "So, what's the deal with Auntie Gerschwitz et all?"
on a 486? Windows 98
http://www.allthingsspiny.co.uk/pcthermometer.html for one
-- Mod me down. I am not a karma tart. ffs,gag
Your link says:
1. Requirements
Microsoft Windows 95,98, 2000, Possibly ME. XP home, XP Pro
But thanks for playing!
Have you been stalked by Seth today?
What I don't get is why you want to figure out how to hook such a device to the joystick port...
(1) "Unless your computer is on a furnace..." Forget that, unless your computer is IN a furnace heat is the last thing you have to worry about with a 486er.
(2) On a pre-Pentium system I doubt if it's technically possible to find out the temperature of the CPU. However, I may be wrong...
(3) To me trying something through a joystick port sounds like one of those geek experiments that's powered by beer, determination, and having nothing better to do. The geek way is not always the best way to do things seeing as how simplicty is easily overlooked.
To me the easiest way to do this would seem to be to buy a cheap digital therometer. Somehow affix the temperature sensor to the CPU (That computer's old enough to where I'd just say duct tape the sucker.) Get the wires from the sensor inside the box hooked up to the reader outside the box. That way all you'd have to do is glance over at the box and see the temperature on the reader..
Would be a hell of a lot easier than jerry-rigging a device and writing the programming to do what you asked about...
I've done this before. I simply picked up a thermistor from radio shack, stuck it in the holes, and then wrote a little program to record the current time, flip the bit, and just sit in a wait() loop reading, and then check the current time, subtract them, and convert. I found a formula on a webpage somewhere that approximated the resistance based on the delay, and then I just interpolated the temperature from the numbers on the back of the thermistor package. The problem I tended to get, though, was that I needed to take several readings and then discard any outliers. Even with realtime priority and -20 niceness on the process, I frequently got timing errors that gave me temperatures 10, 20, or even 50 degrees off.
You could always try to hack the kernel's joystick driver to do this... aim for more accuracy.
I don't have the program I wrote anymore (sorry!) because it was an a very old boxen that has since been replaced, but I remember it was fairly short.
--TheOrangeSquid Is it any wonder things seem so awry? We swim in a sea of confusion and don't have to think to survive
Go digital!
Get some (up to eight) LM78 chips which you can (usually) connect directly to your parallel port. (use the i2c-pport module from linux-i2c or lm-sensors). Then you can use all usual hardware-monitoring programs that exist for linux.
i2c-pport docs
lm_sensors lm75 module docs
lm75 datasheet from national
Doesn't this box have a serial port? I monitor the temperature of our computer room using Dallas Semiconductor DS-18S20 sensors and Digitemp. The sensors can be connected to your computer via the serial port and are relatively inexpensive (approx $3.00 for the sensor, $10.00 for the serial port interface)
8-------------------1 / /
s\ l a m e n e s s
ss\ f i l t e r s
ss9\-------------/15
and the pin meanings:
--
Seeing is believing; You wouldn't have seen it if you didn't believe it.
Due to lack of options I had to stick one of my machines in a spot where I'm worried it might get hot
Too many ways to answer...
Network Wizards, the first site that kept Internet census numbers, had a product called the WizTemp that connected to an RS-232 port on a *nux machine. I used a bunch of them on a Sun/Solaris. It was a thermistor in mini-phone plug that plugged directly into a RS-232 connector. It included a script that would monitor the temperature and log it and take actual- send an email - on high temperatures.
Alas, the site site says the WizTemp product is no longer available, but you may want to email him to get the details on what he used and how it worked.
Ever dream you could fly? Get up from the Flight Sim. I Fly
The most extreme, fun way is to use pyrometric cones - just wait for these cones to droop and move the joystick, and you'll find out the temperature! Here's how to use the cones when upgrading the wiring of your computer.
A much more practical way is to use the Dallas Semiconductor (now bought by Maxim, and not the magazine)
Dallas has a demo application you can use as an example - a weather station and some good application note examples. It uses the DS1820 or the DS18S20 and you can get up to 2 free samples of each. This device is digital, so no calibration is needed for the accuracy you need. They have a lot of other temperature sensors; some even have alarm outputs, so once you program it, reading only one bit will tell you if the temperature is out of limits. It has a well-written and complete datasheet. They've got software for win32, linux, beos, java, and 8051. If you write your own software or modifiy theirs, you don't really need a serial port adapter; just a wire on the parallel port will do (and it will power the device, too!!)
If anyone's interested, I can dig up some c-code that I used - it works with the parallel port under dos.
HIV Crosses Species Barrier... into Muppets
Link a joystick with all springs removed to a big outdoor thermometer's bimetallic element, so that as the element moves (as it would move the needle) it moves the joystick.
Assembly is the reverse of disassembly.
Compiled under turbo c circa 3/97. As you can see, I've got one wire powering the 1820, and another for the data. I think I'm using the parallel port's open collector output with a built-in pull-up resistor, as required by the DS1820.
// LPT1
.
// interrupts off // reset pulse // look for ack... // wait min time
// LSB first // interrupts off // send a 1 // // send a 0 // lameness filter fix // lameness filter fix
// LSB first
// interrupts off
// allow powerup // if conv. done
The us_delay function is a hacked-up form of the built-in turbo c library tick_delay function - I'm not sure if it's still copyrighted, so I didn't include it. It may not be that useful because it was custom-tuned to my 486. Yep, I had an oscilliscope available to do the tuning, but there are otherways to tune the loop.
---- file test1821.c
#include <stdio.h>
#include <dos.h>
#include <conio.h>
#include "usdelay.h"
unsigned char outport1=0, outport2=0x0A;
#define lptbase 0x378
// for DS1821
#define DQ_hi() {outport2&=0xF7; outp(lptbase+2,outport2);}
#define DQ_lo() {outport2|=0x08; outp(lptbase+2,outport2);}
#define DQ_in() ((inportb(lptbase+2)&0x08)^0x08)
#define DS1821off() {outport1&=0xFB; outp(lptbase,outport1);}
#define DS1821on() {outport1|=0x04; outp(lptbase,outport1);}
// 1= no presence detect, 0=presence detected
unsigned char reset_onewire(void)
{ unsigned char alone;
disable();
DQ_lo();
us_delay(750);
DQ_hi();
us_delay(100);
alone=DQ_in();
us_delay(380);
enable();
return alone ? 1 : 0;
} / / lameness filter fix
void sendbyte_onewire(unsigned char byte)
{ unsigned char mask=1;
disable();
while (mask)
{ if (mask & byte)
{ DQ_lo();
us_delay(1);
DQ_hi();
us_delay(60);
}
else
{ DQ_lo();
us_delay(60);
DQ_hi();
us_delay(1);
}
mask <<= 1;
}
enable();
} / / lameness filter fix
unsigned char getbyte_onewire(void)
{ unsigned char byte=0;
unsigned char mask=1;
unsigned char bit;
disable();
while (mask)
{ DQ_lo();
us_delay(1);
DQ_hi();
us_delay(12);
bit=DQ_in();
us_delay(45);
if (bit)
byte |= mask;
mask <<= 1;
}
enable();
return byte;
} / / lameness filter fix
unsigned char read_1821(unsigned char cmd)
{ reset_onewire();
sendbyte_onewire(cmd);
return getbyte_onewire();
} / / lameness filter fix
void cmd_1821(unsigned char cmd)
{ reset_onewire();
sendbyte_onewire(cmd);
} / / lameness filter fix
#define readstatus_1821() read_1821(0xAC)
#define readTH_1821() read_1821(0xA1)
#define readTL_1821() read_1821(0xA2)
#define readtemp_1821() read_1821(0xAA)
#define start_1821() cmd_1821(0xEE)
#define stop_1821() cmd_1821(0x22)
void main()
{ int i;
unsigned char s;
printf ("=== DS1821 test ===\n");
DS1821on();
DQ_hi();
delay(100);
i=reset_onewire();
if (i)
printf ("No one-wire devices detected.\n");
else
{ printf ("ALONE=%d\n", i);
printf ("STATUS=0x%02x\n", (unsigned int) readstatus_1821());
i=(int) (char) readTH_1821();
printf (" TH= %6.1føC,%6.1føF\n", i*1.0, i*1.8+32.0);
i=(int) (char) readTL_1821();
printf (" TL= %6.1føC,%6.1føF\n", i*1.0, i*1.8+32.0);
i=(int) (char) readtemp_1821();
printf ("temp= %6.1føC,%6.1føF\n", i*1.0, i*1.8+32.0);
start_1821();
getch();
printf ("STATUS=0x%02x\n", (unsigned int) readstatus_1821());
i=(int) (char) readTH_1821();
printf (" TH= %6.1føC,%6.1føF\n", i*1.0, i*1.8+32.0);
i=(int) (char) readTL_1821();
printf (" TL= %6.1føC,%6.1føF\n", i*1.0, i*1.8+32.0);
i=(int) (char) readtemp_1821();
printf ("temp= %6.1føC,%6.1føF\n", i*1.0, i*1.8+32.0);
while (!kbhit())
{ if ((s=readstatus_1821()) & 0x80)
{ i=(int) (char) readtemp_1821();
printf ("temp= %6.1føC,%6.1føF\n", i*1.0, i*1.8+32.0);
start_1821();
}
}
getch();
}
getch();
DQ_lo();
DS1821off();
} / / lameness filter fix
lamenessfilter doesn't like posts with too few characters per inch. I guess they like obtuse perl programs instead of nicer c programs (flame away) lamenessfilter doesn't like posts with too few characters per inch. I guess they like obtuse perl programs instead of nicer c programs (flame away) lamenessfilter doesn't like posts with too few characters per inch. I guess they like obtuse perl programs instead of nicer c programs (flame away) lamenessfilter doesn't like posts with too few characters per inch. I guess they like obtuse perl programs instead of nicer c programs (flame away) lamenessfilter doesn't like posts with too few characters per inch. I guess they like obtuse perl programs instead of nicer c programs (flame away) lamenessfilter doesn't like posts with too few characters per inch. I guess they like obtuse perl programs instead of nicer c programs (flame away) lamenessfilter doesn't like posts with too few characters per inch. I guess they like obtuse perl programs instead of nicer c programs (flame away) lamenessfilter doesn't like posts with too few characters per inch. I guess they like obtuse perl programs instead of nicer c programs (flame away) lamenessfilter doesn't like posts with too few characters per inch. I guess they like obtuse perl programs instead of nicer c programs (flame away) lamenessfilter doesn't like posts with too few characters per inch. I guess they like obtuse perl programs instead of nicer c programs (flame away) lamenessfilter doesn't like posts with too few characters per inch. I guess they like obtuse perl programs instead of nicer c programs (flame away)
lamenessfilter doesn't like posts with too few characters per inch. I guess they like obtuse perl programs instead of nicer c programs (flame away) lamenessfilter doesn't like posts with too few characters per inch. I guess they like obtuse perl programs instead of nicer c programs (flame away) lamenessfilter doesn't like posts with too few characters per inch. I guess they like obtuse perl programs instead of nicer c programs (flame away) lamenessfilter doesn't like posts with too few characters per inch. I guess they like obtuse perl programs instead of nicer c programs (flame away) lamenessfilter doesn't like posts with too few characters per inch. I guess they like obtuse perl programs instead of nicer c programs (flame away) lamenessfilter doesn't like posts with too few characters per inch. I guess they like obtuse perl programs instead of nicer c programs (flame away) lamenessfilter doesn't like posts with too few characters per inch. I guess they like obtuse perl programs instead of nicer c programs (flame away) lamenessfilter doesn't like posts with too few characters per inch. I guess they like obtuse perl programs instead of nicer c programs (flame away) lamenessfilter doesn't like posts with too few characters per inch. I guess they like obtuse perl programs instead of nicer c programs (flame away) lamenessfilter doesn't like posts with too few characters per inch. I guess they like obtuse perl programs instead of nicer c programs (flame away) lamenessfilter doesn't like posts with too few characters per inch. I guess they like obtuse perl programs instead of nicer c programs (flame away)
HIV Crosses Species Barrier... into Muppets
Damn. It took me longer to get around the lameness filter than it did to find the code. What the point of the "code" selection on the comment form when all it does is change the font?
And the funny thing - when I added the above paragraph to the post, it didn't pass the compression test -- but all that repetition I used did pass, and adding the above useful paragraph should have made it better... oh well...
HIV Crosses Species Barrier... into Muppets
Measure temperature, light, etc with your joystick port
http://www.epanorama.net/documents/joystick/pc_
No offense, but it's very obvious you haven't been a geek very long. We've all battled with graphics cards, serial ports, game ports, parallel ports, sound cards....anyways, here's what you need:
Fucking lameness filter....
Heres the link
PCGPE - Joystick
axes is the plural form of axis. you axehole.
I currently have my joystick measuring the temperature of my room once a minute. I originally planned to use thermistors, but experiments with a diode turned out to work just fine. Now, I honestly have no clue how it works, because the specific diode I'm using is basically broken (doesn't act like a diode should in a normal circuit), and a normal diode doesn't work in my circuit. So it was just complete luck that it worked out for me (and I *really* don't know why it works...) But it should work theoretically with thermistors in the same way. Essentially, as long as your current varies with temperature, you can measure temperature with it.
The code is amazingly simple. Here's the important part (C, obviously, running on a Linux 2.2 kernel):
"which" is just the channel you want to read.
The tricky part is the calibration. You'll first just hope that your readings scale linearly with temperature, and mess around with an offset and slope until it matches some known readings. If it's not linear, well... But if you just want "Good", "Bad", and "This reading wasn't taken, because the CPU is a puddle of slag", then it's not so bad.
Good luck. It was a fun project for me. I still don't have the calibration worked out quite right, but that's okay. Oh, and I use RRD Tool to graph the results. I have pretty, colorful, utterly useless graphs of the temperature of my room. Yay!
I almost forgot...
A good quick reference
A good detailed reference
Arstechncia...go to the openforums...navigate aroudn there; try case and cooling fetish.
Just my 2 cents directing a guy to a place w/ lots of people who do this seemingly daily.
1 tequila 2 tequila 3 tequila floor
That's excellent morcheeba! Thanks very much for posting all that.