Arduino Nano - SI7050 Temperature Sensor Tutorial
by Dcube Tech Ventures in Circuits > Electronics
2104 Views, 3 Favorites, 0 Comments
Arduino Nano - SI7050 Temperature Sensor Tutorial
SI7050 is a digital temperature sensor which works on I2C communication protocol and offers high accuracy over the entire operating voltage and temperature range. This high accuracy of the sensor is attributed by the novel signal processing and analog design. These sensors are embedded with an on-chip memory which stores the callibration data which facilitates its usage over a wide range. Here is its demonstration with Arduino Nano.
What You Need..!!
Connection:
Take an I2C shield for Arduino Nano and gently push it over the pins of Nano.
Then connect the one end of I2C cable to SI7050 sensor and the other end to the I2C shield.
Connections are shown in the picture above.
Code:
The arduino code for SI7050 can be downloaded from our github repository-DCUBE Store.
Here is the link for the same :
https://github.com/DcubeTechVentures/SI7050/blob/master/Arduino/SI7050.ino
We include library Wire.h to facilitate the I2c communication of the sensor with the Arduino board.
You can also copy the code from here, it is given as follows:
// Distributed with a free-will license.
// Use it any way you want, profit or free, provided it fits in the licenses of its associated works.
// SI7050
// This code is designed to work with the SI7050_I2CS I2C Mini Module
#include
// SI7050 I2C address is 0x40(64)
#define Addr 0x40
void setup()
{
// Initialise I2C communication as MASTER
Wire.begin();
// Initialise serial communication, set baud rate = 9600
Serial.begin(9600);
// Start I2C transmission
Wire.beginTransmission(Addr);
// Stop I2C transmission
Wire.endTransmission();
delay(300);
}
void loop()
{
unsigned int data[2];
// Start I2C transmission
Wire.beginTransmission(Addr);
// Send temperature measurement command, NO HOLD MASTER
Wire.write(0xF3);
// Stop I2C transmission
Wire.endTransmission();
delay(500);
// Request 2 bytes of data
Wire.requestFrom(Addr, 2);
// Read 2 bytes of data
// temp msb, temp lsb
if(Wire.available() == 2)
{
data[0] = Wire.read();
data[1] = Wire.read();
}
// Convert the data
float temp = ((data[0] * 256.0) + data[1]);
float ctemp = ((175.72 * temp) / 65536.0) - 46.85;
float ftemp = ctemp * 1.8 + 32;
// Output data to serial monitor
Serial.print("Temperature in Celsius : ");
Serial.print(ctemp);
Serial.println(" C");
Serial.print("Temperature in Fahrenheit : ");
Serial.print(ftemp);
Serial.println(" F");
delay(500);
}
Applications:
SI7050 can be incorporated in various systems including computer equipments, portable consumer devices and medical equipments. This sensor can be employed in cold storage chains, asset tracking as well as various industrial control systems. It plays a pivotal role in battery protection too.