Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1461

[VB6] TEMPer Gold USB HID Thermometer Class

$
0
0
Note

Be sure to see the updated version (posted as version 2 below)!


Some Background

TEMPer is a series of products by PCsensor for measuring temperature (and in some cases humidity). There are many models on the market with varying capabilities. While some of the early units appear as USB Serial devices (COMx: ports) the newer ones are USB HID devices that use the standard Windows driver and don't require driver installation.

TEMPerGold.cls is a Visual Basic 6.0 Class that works only with the TEMPer Gold product. It is a wrapper around the RDingUSB.dll that comes with the unit's software package. The software is a basic .Net application you may or may not find useful. There is basically ZERO documentation available on the companion mini-CD or online.

TEMPer Gold runs from about $9 to $20 USD (depending on where you shop) if you are curious. I've never seen the red LED light up as described by PCsensor. But perhaps mine has a dummy LED where the LED would go, having been dropped to save costs?


Basic Operation

If you plug in the TEMPer Gold without installing any software it "installs" in Windows as two HID devices: one a keyboard and the other a special function device.

As a "keyboard" you can make basic use of the TEMPer by opening Excel or even Notepad and then holding Caps Lock or Num Lock for 3 seconds, which makes it start "typing" readings until you hold down Caps Lock or Num Lock 3 seconds again.

Details on using the sample .Net applet can be found on the PCsensor web site (see link above). I didn't install it because I have too much .Net clutter here right now anyway, and did not want to risk the cruft a poorly constructed installer might leave behind even after uninstalling it.


Extracting RDingUSB.dll

Since [version 1 of] my code requires this DLL you'll have to extract it in order to use TEMPerGold.cls yourself.

The easiest way is to locate the MSI package containing the PCsensor demo applet and do an "administrative install" to extract the installation files to a folder. Example:

Code:

msiexec /a "d:\work\temper\thepackage.msi" /qb TARGETDIR="d:\work\temper\packagefiles"

My Demo

The attached demo Project archive contains all of the files needed to build and run the VB6 demo. However for it to run you'll need to either put RDingUSB.dll in the Project folder yourself, or else place it where a normal system DLL Search will find it.

The demo as written manages the state of its UI to guide you through the right steps, but basically:
  • First you Open the device.
  • Then you can Get/Set the Calibration.
  • Then you can start taking sample readings.
  • Finally you Close the device.
Calibration is an offset ranging from -8 to +7°C, and it seems to be non-volatile. You only need to set it when you want to adjust it.


Oof!

This was a messy thing to track down and I had lots of false starts.

While written only for the TEMPer Gold you can probably modify it to work for other TEMPer devices that are USB HID devices. The earlier models that present themselves as a USB COM-port might be easier to use but most of the logic in this class will not apply.

From a DUMPBIN of the file the RDingUSB.dll is really a renamed SonixUSB.dll.


Taking it Further

You could easily write a data logger, charting application, etc. if you want one.

I'm thinking of adding it as optional functionality to my GossCam webcam server posted here in another thread.
Attached Images
   
Attached Files

Viewing all articles
Browse latest Browse all 1461

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>