PDA

View Full Version : external temperature measurement kit


perhansen
April 30th, 2009, 18:57
Hi all you wise guys.
I have bought this home solder kit http://quozl.netrek.org/ts/
It's a 4 channel temperature measurement.
Its plenty of linux and windows out there to get i running, so it shouldent be so hard.
I manage to get it running with my linux, but it seems a bit harder with freebsd.

I found this perl code:

#!/usr/bin/perl

#system "stty 2400 cs8 > /dev/ttyd0 < /dev/ttyd0";

$sensor = $ARGV[0];

open DEV, "/dev/ttyd0" or die "Cannot open serial port!";

undef $outside;
undef $inside;

$reads = 0;

while (<DEV>) {
chomp;
next, unless (/[0-9] 00.*\./);
($id, $temp) = split(/ /);
if ($sensor) {
next, unless ($sensor == $id);
}
$id = $1, if ($id =~ /[^0-9]([0-9]+)/);
$inside = $temp, if ($id == 1);
$outside = $temp, if ($id == 2);
if ($reads > 2 || (defined($outside) && defined ($inside))) {
goto HERE;
}
$reads++;
}

HERE:
$inneg = ($inside =~ /\-/);
$outneg = ($outside =~ /\-/);
$inside = $1, if ($inside =~ /0+(.*)/);
$outside = $1, if ($outside =~ /0+(.*)/);
# $inside = int($inside);
# $outside = int($outside);
$inside = "-" . $inside, if ($inneg);
$outside = "-" . $outside, if ($outneg);
# print "Inside: $inside C\nOutside: $outside C\n";
print "Inside: $inside C Outside: $outside C\n";


I can actually see that this code is opening the port and receiving data, but nothing gets printed on the screen, not even a error message.
I don't know a thing about programming, so i can't find the problem my self.
I have tried several python codes, but nothing seems to work in bsd, maybe because the code is designed to run in linux.. :?
This program does the job quite well http://quozl.netrek.org/ts/tsl-1.2.tar.gz but its a sourcecode and needs to be compiled with the make command, witch doesn't exist in bsd. I then added the package gmake, but when i try compiling i get an error that cc is missing.

The only thing the code should do is save the temperatures in a log-file, witch i then print on my webpage with some php or even better if i could access the serial-port and read the temperature though php.

Please can anyone help me with this?

DutchDaemon
April 30th, 2009, 19:18
[...]needs to be compiled with the make command, witch doesn't exist in bsd. I then added the package gmake, but when i try compiling i get an error that cc is missing.

How on earth did you install FreeBSD? It comes with a state-of-the-art C compiler and all necessary tools like 'make' and 'cc', which are both firmly lodged in the base system (/usr/bin/make and /usr/bin/cc).

perhansen
April 30th, 2009, 20:01
actually i'am running freenas on my server.

DutchDaemon
April 30th, 2009, 20:14
Well freenas != freebsd ... Based on a very stripped version of FreeBSD at most. Try http://apps.sourceforge.net/phpbb/freenas/index.php first, I'd say.

perhansen
May 1st, 2009, 08:55
I haved tried there, but no help.

graudeejs
May 1st, 2009, 12:32
show output of uname -a

perhansen
May 2nd, 2009, 13:27
freenas:~# uname -a
FreeBSD freenas.local 7.2-PRERELEASE FreeBSD 7.2-PRERELEASE #0: Sun Mar 22 12:19:07 CET 2009 root@vmbsd71i386:/usr/obj/freenas/usr/src/sys/FREENAS-i386 i386