Description
The
Si705x Digital Temperature Sensors offer industry-leading low power
consumption
and high accuracy across the entire operating voltage and
temperature
range. These monolithic CMOS ICs feature a band-gap
temperature
sensor element, an analog-to-digital converter with up to 14-
bit
resolution, signal processing, calibration data, and an I2C interface.
The
patented use of novel signal processing and analog design enables
the
sensors to maintain their accuracy over a wide temperature and
voltage
range, while consuming very little current.
The
temperature sensors are factory-calibrated and the calibration data is
stored
in the on-chip non-volatile memory. This ensures that the sensors
are
fully interchangeable, with no recalibration or software changes
required.
Applications
HVAC/R
Thermostats
White goods
Computer equipment
Portable consumer devices
Asset tracking
Cold chain storage
Battery protection
Industrial controls
Medical equipment
Pin Assignments:
Application Circuits:
Application Code :
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <linux/i2c-dev.h> | |
| #include <sys/ioctl.h> | |
| #include <fcntl.h> | |
| void main() | |
| { | |
| // Create I2C bus | |
| int file; | |
| char *bus = "/dev/i2c-1"; | |
| if ((file = open(bus, O_RDWR)) < 0) | |
| { | |
| printf("Failed to open the bus. \n"); | |
| exit(1); | |
| } | |
| // Get I2C device, SI7050 I2C address is 0x40(64) | |
| ioctl(file, I2C_SLAVE, 0x40); | |
| // Send temperature measurement command, NO HOLD MASTER(0xF3) | |
| char config[1] = {0xF3}; | |
| write(file, config, 1); | |
| sleep(1); | |
| // Read 2 bytes of temperature data | |
| // temp msb, temp lsb | |
| char data[2]={0}; | |
| if(read(file, data, 2) != 2) | |
| { | |
| printf("Error : Input/Output error \n"); | |
| } | |
| else | |
| { | |
| // Convert the data | |
| float cTemp = (data[0] * 256 + data[1]); | |
| cTemp = (((cTemp * 175.72) / 65536) - 46.85); | |
| float fTemp = cTemp * 1.8 + 32; | |
| // Output data to screen | |
| printf("Temperature in Celsius : %.2f\n", cTemp); | |
| printf("Temperature in Fahrenheit : %.2f\n", fTemp); | |
| } | |
| } |


No comments:
Post a Comment