Device::Temperature::TMP102 - I2C interface to TMP102 temperature sensor using Device::SMBus
Read temperature for a TMP102 temperature sensor over I2C.
This library correctly handles temperatures below freezing (0°C).
Refer to the documentation on Device::SMBus for information on enabling the i2c driver and finding the addresses of your i2c devices.
In the process of testing this on raspberry pi, I saw this error:
perl: symbol lookup error: .../Device/SMBus/SMBus.so: undefined symbol: i2c_smbus_write_byte
The fix was to install the package libi2c-dev.
https://www.sparkfun.com/products/9418 https://www.sparkfun.com/datasheets/Sensors/Temperature/tmp102.pdf http://donalmorrissey.blogspot.com/2012/09/raspberry-pi-i2c-tutorial.html
With code and comments taken from example code for the ATmega328:
http://www.sparkfun.com/datasheets/Sensors/Temperature/tmp102.zip /* TMP Test Code 5-31-10 Copyright Spark Fun Electronics© 2010 Nathan Seidle Example code for the TMP102 11-bit I2C temperature sensor You will need to connect the ADR0 pin to one of four places. This code assumes ADR0 is tied to VCC. This results in an I2C address of 0x93 for read, and 0x92 for write. This code assumes regular 12 bit readings. If you want the extended mode for higher temperatures, the code will have to be modified slightly. */
Contains the I2CDevice Address for the bus on which your TMP102 is connected. The default value is 0x48.
$self->getTemp()
Returns the current temperature, in degrees Celsius.
$self->convertTemp( $reading )
Given a value read from the TMP102, convert the value to degrees Celsius.
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in '(0°C).'. Assuming UTF-8
To install Device::TMP102, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Device::TMP102
CPAN shell
perl -MCPAN -e shell install Device::TMP102
For more information on module installation, please visit the detailed CPAN module installation guide.