Wednesday, August 10, 2011

Velleman VM100 / K8055 and the VM132 Temperature reading

More stuff with the Velleman VM100 / K8055 Experimental USB Interface

In the past we used this board for repeater activity logging:

Today we will use it to monitor temperatures.  The hookup is printed on the back of the VM132 cardboard packaging.  In case you misplaced that:

If you were to just connect a thermistor to the analog input of the USB interface board, you'd have to put a table to your program to convert the voltage to temperature. The voltage over the a NTC conduction model thermistor is very non-linear vs. temperature.  This table is essentially what is on with the TLV2741 comparator chip on the VM132 board.

The analog inputs of a K8055 are supposed to get an input voltage. With jumper SK2 open and ATT1 turned fully clockwise, that input voltage should be in the range of 0 to +5V.

The VM132 Universal Temperature Sensor has a 0 to 20mA current loop.  After the connections are made it is just a matter of adjusting the K8055 ATT1 and or the blue multi turn VM132 trim pot to calibrate the returned software reading to the actual temperature.

Velleman VM110 Experimantal USB Interface
Velleman VM132 Universal Temperature Sensor
+12 volts to the sensor

Linux k8055 library binary:

 Syntax : k8055 [-p:(number)] [-d:(value)] [-a1:(value)] [-a2:(value)]  
        [-num:(number) [-delay:(number)] [-dbt1:(value)]  
        [-dbt2:(value)] [-reset1] [-reset2] [-debug]  
     -p:(number)   Set board number  
     -d:(value)   Set digital output value (8 bits in decimal)  
     -a1:(value)   Set analog output 1 value (0-255)  
     -a2:(value)   Set analog output 2 value (0-255)  
     -num:(number)  Set number of measures  
     -delay:(number) Set delay between two measure (in msec)  
     -dbt1:(value)  Set debounce time for counter 1 (in msec)  
     -dbt2:(value)  Set debounce time for counter 2 (in msec)  
     -reset1     Reset counter 1  
     -reset2     Reset counter 2  
     -debug     Activate debug mode  
 Example : k8055 -p:1 -d:147 -a1:25 -a2:203  

What it returns looks like a string of 6 numbers, separated by semicolons.
 Example: 499;16;128;230;9;8  
        499 : Measure done 499 msec after program start  
        16 : Digital input value is 10000 (I5=1, all other are 0)  
        128 : Analog 1 input value is 128  
        230 : Analog 2 input value is 230  
        9  : Counter 1 value is 9  
        8  : Counter 2 value is 8  

So we need to create script to pool the k8055 program and look at that third number, analog input 1.
 # Bash wrapper to watch the input of a Vellman K8055 board.  
 while true  
 T=`k8055 | awk -F ";" '{print $3}'`  
 if [ $T -ne "$LAST" ];  
   then echo `date '+%b %d %Y %T'`: TEMP $T  
 LAST=`echo $T`  
 sleep 1  
 [root@kb9mwr k8055]# ./temp  
 Aug 02 2011 00:44:17: TEMP 66  

No comments: