TEMPER USB thermometer

General HouseBot discussion. Any issues that don't fit into any of the other topics belong here.
Post Reply
vc1234
Member
Posts: 10
Joined: Thu Jan 08, 2009 10:19 am

TEMPER USB thermometer

Post by vc1234 »

Hi,

I've created a simple plug-in that can read this ( http://www.funponsel.com/blog/archives/ ... ratorians/) inexpensive (~ $10 on e-bay) USB thermometer. The plug-in can be compiled using VS 2008 Express. I had to make minor changes to the SDK Device.cpp (cast 'const char*' to 'char*') in order to make the VS compile it. The binary dll is also provided if you do not want to bother with the compiler.

The plug-in does not require the interface part and has the following properties:

Temperature
Celsius/Fahrenheit
Correction (to "calibrate" the thing)
COM Port (the gadget emulates a serial port)
Poll interval

The COM port can be found from the Windows System/Hardware window. You can modify the COM port property without need to recreate the device or restart HouseBot. There is a way to discover the thermometer port automatically, but what if you want to connect more than one? Feel free to modify the code if you feel like it...

The newer version of the gadget can sense humidity too, but since I do not have the latest version, I did not implement it. Should be trivial though (see the referenced website).
Attachments
Temper.rar
(74.98 KiB) Downloaded 439 times
kilowatt
Senior Member
Posts: 152
Joined: Thu Jan 08, 2004 5:45 pm
Location: Westford, MA

Re: TEMPER USB thermometer

Post by kilowatt »

Thanks,

I have a few of those devices and have been planning on making a device plugin eventually. I got mine from http://www.dealextreme.com/details.dx/sku.7003 where they are real cheap and free shipping. If you buy three or more they are less than $8.00 each delivered.

There is a nice little program UTAC out there for these devices. http://blog.n4rf.net/solutions/utac The source is available on sourceforge and I modified it to add a HouseBot external control interface. This program can run on any system with the TEMPer device attached and update the Temperature property of a null device via the external control interface over the network. This allows you to also use the multitude of features and servers built into UTAC and still get the temperature into HouseBot. Plus UTAC and HouseBot can be running on different PCs if you want. I tried to contact the author to incorporate some bug fixed I implemented along with the housebot addition but he has not responded. I'm not sure if I'm allowed to share my updated code without going through him.

I have a problem when I tried your plugin. I can't seem to get the port to open right. My TEMPer device is on COM20 and I always get "Error: [Temper_test]Could not initialize the device. Error 2 when opening the port" when I try to set the COM Port Name to COM20. Any ideas? I took a quick look at your code and did not see anything obvious.

Mark
vc1234
Member
Posts: 10
Joined: Thu Jan 08, 2009 10:19 am

Re: TEMPER USB thermometer

Post by vc1234 »

Hi,

Error 2, as any other possible error, is just a MS standard system error. '2' means that the the 'file' or rather the com port does not exist ( http://msdn.microsoft.com/en-us/library ... S.85).aspx ).

Did you change the default 'COM4' to to 'COM 20' ? You can do that with the device running as it will try to open a new port right away. Also, make sure it is indeed COM20: in the Hardware Manager you should see 'USB-SERIAL(COM20)'.
kilowatt
Senior Member
Posts: 152
Joined: Thu Jan 08, 2004 5:45 pm
Location: Westford, MA

Re: TEMPER USB thermometer

Post by kilowatt »

Yes I changed it to COM20. This port works fine for the UTAC program I mentioned. I also tried opening COM20 with hyperterminal to see if there where any errors and that worked fine (of course it doesn't do much with the TEMPer device since it communicates via the modem control signals). I made sure no other program has the COM port open. I'm running on windows XP Home edition SP3.

Somewhere here I have a serial port monitor program. I'll see if I can find that and use it to trace the COM port to see what happens when you try to initialize it.

Strange....

Mark
vc1234
Member
Posts: 10
Joined: Thu Jan 08, 2009 10:19 am

Re: TEMPER USB thermometer

Post by vc1234 »

OK,

I think the problem is caused by naming:

http://support.microsoft.com/kb/q115831

If you want to specify a COM port name higher than COM9, the "correct" syntax is:

"\\\\.\\COM20"

I'll modify the code and see if it still works with lower port numbers. I cannot force my laptop to use numbers higher than COM8.
kilowatt
Senior Member
Posts: 152
Joined: Thu Jan 08, 2004 5:45 pm
Location: Westford, MA

Re: TEMPER USB thermometer

Post by kilowatt »

I think your on to it... I put in "\\.\COM20" and it works

Mark
vc1234
Member
Posts: 10
Joined: Thu Jan 08, 2009 10:19 am

Re: TEMPER USB thermometer

Post by vc1234 »

I've attached the modified piece of code and the DLL.

It works with < 10 COMxx ports.
Attachments
HouseBOT.rar
(14.72 KiB) Downloaded 429 times
kilowatt
Senior Member
Posts: 152
Joined: Thu Jan 08, 2004 5:45 pm
Location: Westford, MA

Re: TEMPER USB thermometer

Post by kilowatt »

Works great now. Thanks :D

Mark

One other change you might consider is to make the temperature property to read only.
See: http://www.cebotics.com/forums/viewtopi ... 4&t=856333
vc1234
Member
Posts: 10
Joined: Thu Jan 08, 2009 10:19 am

Re: TEMPER USB thermometer

Post by vc1234 »

Here's the dll with read-only Temperature -- posted to a wrong thread first time ;)
Attachments
TemperPlugin.rar
(13.24 KiB) Downloaded 421 times
kilowatt
Senior Member
Posts: 152
Joined: Thu Jan 08, 2004 5:45 pm
Location: Westford, MA

Re: TEMPER USB thermometer

Post by kilowatt »

I found it on the other thread and tested it out. Looks good. I think you are right about needing to recreate the device for the property to change. I deleted it just prior to updating then recreated it anyway so I did not verify that fact.

One thing you should note if you use these devices to measure cold temperatures (like the winter weather here in New England) is they have a problem with temperatures just a little below freezing. There seems to be a point where the readings drop rapidly (faster than the actual temp) and then plateau for a bit then if it gets cold enough it starts reading lower again. I verified this by putting a device in my freezer and watching the graph (from the program UTAC) while it cooled off. The temperature plot drops as expected then drops about 5 degrees Fahrenheit fast, plateaus for a bit, then starts dropping again along the expected curve. I did not check if the calibration was correct once it started dropping again but it looked about right based on how it lines up with the beginning curve.

I don't have a copy of that curve now but here is the curve of the outside temp here in Massachusetts last night.
TEMPer graph.jpg
TEMPer graph.jpg (26.03 KiB) Viewed 5873 times
At the bottom of the graph the temp drops quickly and then levels out. The temperature did not get cold enough last night to start dropping below the plateau. Again this only occurs a little below the freezing point so it is not a problem for most monitoring. The quick spike up in the graph was from sunrise this morning when it briefly shines directly on my TEMPer.

Mark
vc1234
Member
Posts: 10
Joined: Thu Jan 08, 2009 10:19 am

Re: TEMPER USB thermometer

Post by vc1234 »

Mark,

Interesting ...

The device is "rated" at -20C which is -4F so it should work around 32F, but I guess it does not.

I wonder how you connect the device to your computer. Is your PC located outdoors ;) ?

I thought about measuring the outside temperature with wireless temperature sensors via the W800RF32 interface, but the gadgets are rather expensive (€ 46.20 > $62 @ http://www.rfxcom.com/sensors.htm).

vc
kilowatt
Senior Member
Posts: 152
Joined: Thu Jan 08, 2004 5:45 pm
Location: Westford, MA

Re: TEMPER USB thermometer

Post by kilowatt »

I bought some longer usb cables from http://www.cablewholesale.com/index.php where they are much cheaper than your average retail store. I ran these from the computer to the window. Then I used the thin usb cable that came with the TEMPer to run it out under the closed window in my office. It is actually between the window and the screen so it reads a little high. I put it in a small plastic bag so it wouldn't get wet when it rains.

I started with SmartHome TempLinc devices. There used to be a device plugin for housebot that supported those. I had four of them and they all died. Actually I got them to replace one so I had five that all died. I finally gave up on them but I still wanted temperature monitoring and I didn't want to make a big investment again. I could not resist the price for these TEMPer thermometers. It is a little harder to locate them where you want since they are USB. I would love to have a reasonably priced wireless temperature solution that can be used indoors and out. I suppose the best cheap solution would be to get into the one-wire devices. But wireless would be so nice.

So, thanks for the device plugin. It's great.

Mark
kilowatt
Senior Member
Posts: 152
Joined: Thu Jan 08, 2004 5:45 pm
Location: Westford, MA

Re: TEMPER USB thermometer

Post by kilowatt »

Here is a better graph showing the issue I talked about earlier in this topic. (Temperatures are Fahrenheit)
TEMPer graph 2.jpg
TEMPer graph 2.jpg (24.48 KiB) Viewed 5823 times
Again this behavior only seems to show up in this temperature range. The devices works great at other temperatures. I have a few of these and they all behave this way. Could be a bad batch of devices. I would be interested if others have seen this also.
Post Reply