TEMPer in FreeBSD

More info about TEMPer on main page.

My experiments with TEMPer in FreeBSD.

History

2010-01-02: on the freebsd-usb mailing list, Stefan Bethke told about the utility he wrote, which can be found here. Compiled with cc -o temper Temper.c, and gives:

tingo@testhost-1$ ./temper -n 10
25.69
25.62
25.69
25.69
25.69
25.69
25.62
25.69
25.69
25.62
tingo@testhost-1$ ./temper -h
temper: option requires an argument -- h
usage: temper [-d device] [-h high] [-l low] [-n count]
    -d device   USB serial port of the TEMPer
    -h high     thermostat on temperature
    -l low      thermostat off temperature
    -n count    number of readings to take, <0 is infinite
If the high temperature is below the low temperature, operation of the
thermostat is reversed, and the output is turned on when the measured
temperature is below the threshold.

2009-12-27: Tested with FreeBSD 8.0-stable, which have a working uchcom:

root@testhost-1# uname -a
FreeBSD testhost-1.kg4.no 8.0-STABLE FreeBSD 8.0-STABLE #0: Sat Dec 12 23:49:41 CET 2009     root@testhost-1.kg4.no:/usr/obj/usr/src/sys/GENERIC  amd64

I did kldload uchcom, and then plugged in the TEMPer. I got this in /var/log/messages:

Dec 27 23:07:43 testhost-1 kernel: ugen1.2: <vendor 0x4348> at usbus1
Dec 27 23:07:43 testhost-1 kernel: ucom0: <vendor 0x4348 USB-SER!, rev 1.10/2.50, addr 2> on usbus1
Dec 27 23:07:43 testhost-1 kernel: ucom0: CH340 detected

I changed the device from /dev/ttyUSB0 (Linux) to /dev/ttyU0 (FreeBSD) in TEMPer.c and compiled it with gcc -lm -o TEMPer2 TEMPer2.c. Then I tested it:

root@testhost-1# ./TEMPer2
Init starting
Init done
^Croot@testhost-1#

Hmm, not good. TEMPer3.c is a slighthly modified version:

root@testhost-1# ./TEMPer3
Init starting
Init done
00:48:03 -1000.000000 C
00:48:03 -1000.000000 C
00:48:04 -1000.000000 C
00:48:04 -1000.000000 C
00:48:04 -1000.000000 C
00:48:04 -1000.000000 C
00:48:04 -1000.000000 C

2009-04-08: I got myself a TEMPer, an usb thermometer. More info here, and here. There is a FreeBSD driver for the serial chip: uchcom, but it is not in RELENG_7 yet. I got a version out of the attic (of the src repository), it compiled and loaded ok. But the program TEMPer.c (modified) didn't work. From /var/log/messages:

Apr  8 19:27:08 kg-work2 kernel: ucom0: <vendor 0x4348 USB-SER!, class 255/0, rev 1.10/2.50, addr 2> on uhub1
Apr  8 19:27:08 kg-work2 kernel: ucom0: CH340 detected