com.phidgets
Class TemperatureSensorPhidget

java.lang.Object
  extended bycom.phidgets.Phidget
      extended bycom.phidgets.TemperatureSensorPhidget

public final class TemperatureSensorPhidget
extends Phidget

This class represents a Phidget temperature Sensor. All methods to read temperaure data from the sensor are implemented in this class.

The Temperature Phidget consists of a thermocouple interface, and a temperature sensing IC, which is used to measure the temperature of the thermocouple cold junction and calibrate the thermocouple sensed temperature.

Both the thermocouple and temperature IC temperatures can be read. Value are returned in degrees celcius.

Author:
Phidgets Inc.

Field Summary
static int PHIDGET_TEMPERATURE_SENSOR_E_TYPE
          E-Type Thermocouple.
static int PHIDGET_TEMPERATURE_SENSOR_J_TYPE
          J-Type Thermocouple.
static int PHIDGET_TEMPERATURE_SENSOR_K_TYPE
          K-Type Thermocouple.
static int PHIDGET_TEMPERATURE_SENSOR_T_TYPE
          T-Type Thermocouple.
 
Fields inherited from class com.phidgets.Phidget
PHIDCLASS_ACCELEROMETER, PHIDCLASS_ADVANCEDSERVO, PHIDCLASS_ANALOG, PHIDCLASS_BRIDGE, PHIDCLASS_ENCODER, PHIDCLASS_FREQUENCYCOUNTER, PHIDCLASS_GPS, PHIDCLASS_INTERFACEKIT, PHIDCLASS_LED, PHIDCLASS_MOTORCONTROL, PHIDCLASS_NOTHING, PHIDCLASS_PHSENSOR, PHIDCLASS_RFID, PHIDCLASS_SERVO, PHIDCLASS_STEPPER, PHIDCLASS_TEMPERATURESENSOR, PHIDCLASS_TEXTLCD, PHIDCLASS_TEXTLED, PHIDCLASS_WEIGHTSENSOR, PHIDGET_LOG_CRITICAL, PHIDGET_LOG_DEBUG, PHIDGET_LOG_ERROR, PHIDGET_LOG_INFO, PHIDGET_LOG_VERBOSE, PHIDGET_LOG_WARNING, PHIDID_ACCELEROMETER_2AXIS, PHIDID_ACCELEROMETER_3AXIS, PHIDID_ADVANCEDSERVO_1MOTOR, PHIDID_ADVANCEDSERVO_8MOTOR, PHIDID_ANALOG_4OUTPUT, PHIDID_BIPOLAR_STEPPER_1MOTOR, PHIDID_BRIDGE_4INPUT, PHIDID_ENCODER_1ENCODER_1INPUT, PHIDID_ENCODER_HS_1ENCODER, PHIDID_ENCODER_HS_4ENCODER_4INPUT, PHIDID_FREQUENCYCOUNTER_2INPUT, PHIDID_GPS, PHIDID_INTERFACEKIT_0_0_4, PHIDID_INTERFACEKIT_0_0_8, PHIDID_INTERFACEKIT_0_16_16, PHIDID_INTERFACEKIT_0_8_8_w_LCD, PHIDID_INTERFACEKIT_2_2_2, PHIDID_INTERFACEKIT_4_8_8, PHIDID_INTERFACEKIT_8_8_8, PHIDID_INTERFACEKIT_8_8_8_w_LCD, PHIDID_IR, PHIDID_LED_64, PHIDID_LED_64_ADV, PHIDID_LINEAR_TOUCH, PHIDID_MOTORCONTROL_1MOTOR, PHIDID_MOTORCONTROL_HC_2MOTOR, PHIDID_MOTORCONTROL_LV_2MOTOR_4INPUT, PHIDID_NOTHING, PHIDID_PHSENSOR, PHIDID_RFID, PHIDID_RFID_2OUTPUT, PHIDID_RFID_2OUTPUT_READ_WRITE, PHIDID_ROTARY_TOUCH, PHIDID_SERVO_1MOTOR, PHIDID_SERVO_1MOTOR_OLD, PHIDID_SERVO_4MOTOR, PHIDID_SERVO_4MOTOR_OLD, PHIDID_SPATIAL_ACCEL_3AXIS, PHIDID_SPATIAL_ACCEL_GYRO_COMPASS, PHIDID_TEMPERATURESENSOR, PHIDID_TEMPERATURESENSOR_4, PHIDID_TEMPERATURESENSOR_IR, PHIDID_TEXTLCD_2x20, PHIDID_TEXTLCD_2x20_w_0_8_8, PHIDID_TEXTLCD_2x20_w_8_8_8, PHIDID_TEXTLCD_ADAPTER, PHIDID_TEXTLED_1x8, PHIDID_TEXTLED_4x8, PHIDID_UNIPOLAR_STEPPER_4MOTOR, PHIDID_WEIGHTSENSOR
 
Constructor Summary
TemperatureSensorPhidget()
           
 
Method Summary
 void addTemperatureChangeListener(TemperatureChangeListener l)
          Adds a temperature change listener.
 double getAmbientTemperature()
          Returns the temperature of the ambient sensor.
 double getAmbientTemperatureMax()
          Returns the maximum temperature that will be returned by the ambient sensor.
 double getAmbientTemperatureMin()
          Returns the minimum temperature that will be returned by the ambient sensor.
 double getPotential(int index)
          Returns the potential of a thermocouple input.
 double getPotentialMax(int index)
          Returns the maximum potential that will be returned by a thermocouple input.
 double getPotentialMin(int index)
          Returns the minimum potential that will be returned by a thermocouple input.
 int getSensorCount()
          Deprecated. Replaced by getTemperatureInputCount()
 double getTemperature(int index)
          Returns the temperature of a thermocouple.
 double getTemperatureChangeTrigger(int index)
          Returns the change trigger for an input.
 int getTemperatureInputCount()
          Returns the number of thermocouples.
 double getTemperatureMax(int index)
          Returns the maximum temperature that will be returned by a thermocouple input.
 double getTemperatureMin(int index)
          Returns the minimum temperature that will be returned by a thermocouple input.
 int getThermocoupleType(int index)
          Returns the thermocouple type for an input.
 void removeTemperatureChangeListener(TemperatureChangeListener l)
           
 void setTemperatureChangeTrigger(int index, double newVal)
          Sets the change trigger for an input.
 void setThermocoupleType(int index, int type)
          Sets the thermocouple type for an input.
 
Methods inherited from class com.phidgets.Phidget
addAttachListener, addDetachListener, addErrorListener, addServerConnectListener, addServerDisconnectListener, close, disableLogging, enableLogging, equals, getDeviceClass, getDeviceID, getDeviceLabel, getDeviceName, getDeviceType, getDeviceVersion, getLibraryVersion, getSerialNumber, getServerAddress, getServerID, getServerPort, isAttached, isAttachedToServer, log, open, open, open, open, open, openAny, openAny, openAny, openAny, openAny, openLabel, openLabel, openLabel, openLabel, openLabel, removeAttachListener, removeDetachListener, removeErrorListener, removeServerConnectListener, removeServerDisconnectListener, setDeviceLabel, toString, waitForAttachment, waitForAttachment
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PHIDGET_TEMPERATURE_SENSOR_K_TYPE

public static final int PHIDGET_TEMPERATURE_SENSOR_K_TYPE
K-Type Thermocouple. This is used with getThermocoupleType and setThermocoupleType

See Also:
Constant Field Values

PHIDGET_TEMPERATURE_SENSOR_J_TYPE

public static final int PHIDGET_TEMPERATURE_SENSOR_J_TYPE
J-Type Thermocouple. This is used with getThermocoupleType and setThermocoupleType

See Also:
Constant Field Values

PHIDGET_TEMPERATURE_SENSOR_E_TYPE

public static final int PHIDGET_TEMPERATURE_SENSOR_E_TYPE
E-Type Thermocouple. This is used with getThermocoupleType and setThermocoupleType

See Also:
Constant Field Values

PHIDGET_TEMPERATURE_SENSOR_T_TYPE

public static final int PHIDGET_TEMPERATURE_SENSOR_T_TYPE
T-Type Thermocouple. This is used with getThermocoupleType and setThermocoupleType

See Also:
Constant Field Values
Constructor Detail

TemperatureSensorPhidget

public TemperatureSensorPhidget()
                         throws PhidgetException
Method Detail

getTemperatureInputCount

public int getTemperatureInputCount()
                             throws PhidgetException
Returns the number of thermocouples.

Returns:
Number of inputs
Throws:
PhidgetException

getSensorCount

public int getSensorCount()
                   throws PhidgetException
Deprecated. Replaced by getTemperatureInputCount()

Throws:
PhidgetException

getTemperature

public double getTemperature(int index)
                      throws PhidgetException
Returns the temperature of a thermocouple. This value is returned in degrees celcius but can easily be converted into other units. This value will always be between getTemperatureMin and getTemperatureMax. The accuracy depends on the thermocouple used. The board is calibrated during manufacture.

Parameters:
index - Index of the thermocouple
Returns:
Temperature in derees celcius
Throws:
PhidgetException - If this Phidget is not opened and attached, or if a thermocouple sensor is not plugged into the board. See open for information on determining if a device is attached.

getTemperatureMax

public double getTemperatureMax(int index)
                         throws PhidgetException
Returns the maximum temperature that will be returned by a thermocouple input. This value depends on the thermocouple type.

Parameters:
index - Index of the thermocouple
Returns:
Maximum temperature in derees celcius
Throws:
PhidgetException - If this Phidget is not opened and attached. See open for information on determining if a device is attached.

getTemperatureMin

public double getTemperatureMin(int index)
                         throws PhidgetException
Returns the minimum temperature that will be returned by a thermocouple input. This value depends on the thermocouple type.

Parameters:
index - Index of the thermocouple
Returns:
Minimum temperature in derees celcius
Throws:
PhidgetException - If this Phidget is not opened and attached. See open for information on determining if a device is attached.

getAmbientTemperature

public double getAmbientTemperature()
                             throws PhidgetException
Returns the temperature of the ambient sensor. This value is returned in degrees celcius but can easily be converted into other units. This value will always be between getAmbientTemperatureMin and getAmbientTemperatureMax. This is the temperature of the board at the thermocouple cold junction.

Returns:
Temperature in derees celcius
Throws:
PhidgetException - If this Phidget is not opened and attached. See open for information on determining if a device is attached.

getAmbientTemperatureMax

public double getAmbientTemperatureMax()
                                throws PhidgetException
Returns the maximum temperature that will be returned by the ambient sensor.

Returns:
Maximum ambient temperature in derees celcius
Throws:
PhidgetException - If this Phidget is not opened and attached. See open for information on determining if a device is attached.

getAmbientTemperatureMin

public double getAmbientTemperatureMin()
                                throws PhidgetException
Returns the minimum temperature that will be returned by the ambient sensor.

Returns:
Minimum ambient temperature in derees celcius
Throws:
PhidgetException - If this Phidget is not opened and attached. See open for information on determining if a device is attached.

getPotential

public double getPotential(int index)
                    throws PhidgetException
Returns the potential of a thermocouple input. This value is returned in millivolts. This value will always be between getPotentialMin and getPotentialMax. This is very accurate, as it is a raw value from the A/D. This is the value that is internally used to calculate temperature in the library.

Parameters:
index - Index of the thermocouple
Returns:
Potential in millivolts
Throws:
PhidgetException - If this Phidget is not opened and attached. See open for information on determining if a device is attached.

getPotentialMax

public double getPotentialMax(int index)
                       throws PhidgetException
Returns the maximum potential that will be returned by a thermocouple input.

Parameters:
index - Index of the thermocouple
Returns:
Maximum potential in millivolts
Throws:
PhidgetException - If this Phidget is not opened and attached. See open for information on determining if a device is attached.

getPotentialMin

public double getPotentialMin(int index)
                       throws PhidgetException
Returns the minimum potential that will be returned by a thermocouple input.

Parameters:
index - Index of the thermocouple
Returns:
Minimum potential in millivolts
Throws:
PhidgetException - If this Phidget is not opened and attached. See open for information on determining if a device is attached.

setTemperatureChangeTrigger

public void setTemperatureChangeTrigger(int index,
                                        double newVal)
                                 throws PhidgetException
Sets the change trigger for an input. This is the ammount by which the sensed temperature must change between TemperatureChangeEvents. By default this is set to 0.5.

Parameters:
index - Input
newVal - Trigger
Throws:
PhidgetException - If this Phidget is not opened and attached, or if the index is out of range. See open for information on determining if a device is attached.

getTemperatureChangeTrigger

public double getTemperatureChangeTrigger(int index)
                                   throws PhidgetException
Returns the change trigger for an input. This is the ammount by which the sensed temperature must change between TemperatureChangeEvents. By default this is set to 0.5.

Parameters:
index - Input
Returns:
Trigger
Throws:
PhidgetException - If this Phidget is not opened and attached, or if the index is out of range. See open for information on determining if a device is attached.

getThermocoupleType

public int getThermocoupleType(int index)
                        throws PhidgetException
Returns the thermocouple type for an input. The possible values for type are PHIDGET_TEMPERATURE_SENSOR_K_TYPE, PHIDGET_TEMPERATURE_SENSOR_J_TYPE, PHIDGET_TEMPERATURE_SENSOR_E_TYPE and PHIDGET_TEMPERATURE_SENSOR_T_TYPE

Parameters:
index - Input
Returns:
Thermocouple Type
Throws:
PhidgetException - If this Phidget is not opened and attached, or if the index is out of range. See open for information on determining if a device is attached.

setThermocoupleType

public void setThermocoupleType(int index,
                                int type)
                         throws PhidgetException
Sets the thermocouple type for an input. The Phidget Temperature Sensor board can be used with K, E, J and T-Type Thermocouples. Support for other thermocouple types, and voltage sources other then thermocouples in the valid range (between getPotentialMin and getPotentialMax) can be achieved using getPotential.

The possible values for type are PHIDGET_TEMPERATURE_SENSOR_K_TYPE, PHIDGET_TEMPERATURE_SENSOR_J_TYPE, PHIDGET_TEMPERATURE_SENSOR_E_TYPE and PHIDGET_TEMPERATURE_SENSOR_T_TYPE

By default, type is set to PHIDGET_TEMPERATURE_SENSOR_K_TYPE.

Parameters:
index - Input
type - Thermocouple Type
Throws:
PhidgetException - If this Phidget is not opened and attached, or if the index is out of range. See open for information on determining if a device is attached.

addTemperatureChangeListener

public final void addTemperatureChangeListener(TemperatureChangeListener l)
Adds a temperature change listener. The temperature change handler is a method that will be called when the temperature has changed by at least the Trigger that has been set.

There is no limit on the number of temperature change handlers that can be registered for a particular Phidget.

Parameters:
l - An implemetation of the TemperatureChangeListener interface

removeTemperatureChangeListener

public final void removeTemperatureChangeListener(TemperatureChangeListener l)