loading

Hello,

Good Greetings..!!

I (Somanshu Choudhary) on the behalf of Dcube tech ventures going to measure temperature using Arduino nano, it is one of the applications of I2C protocol to read analog data of temperature Sensor TMP-112.

Step 1: Overview

  1. TMP-112 is a temperature sensor.
  2. DATASHEET Link: http://www.ti.com/lit/ds/symlink/tmp112.pdf

Step 2: What You Need / Links

  1. Arduino Nano Link: https://store.arduino.cc/
  2. I²C Shield for Arduino Nano Link: https://www.controleverything.com/content/I2C-Mast...
  3. USB Cable Type A to Micro Type B 6 Feet Long Link:https://www.controleverything.com/content/USB-Cabl...
  4. I²C Cable Link:https://www.controleverything.com/content/I2C-Cabl...
  5. TMP112 I²C Temperature Sensor ±.5°C 12-Bit I²C Mini Module Link:https://www.controleverything.com/content/Temperat...

Step 3: Circuit Diagram

Step 4: Programming

#include

void setup()

{

// I2C address of the TMP112

#define TMP_ADDR 0x48

// Join I2c Bus as master

Wire.begin();

// Start serial communication

Serial.begin(9600);

// Begin transmission

Wire.beginTransmission(TMP_ADDR);

// Select ENABLE register

Wire.write(0x01);

// Select normal operation

Wire.write(0x60A0);

// End transmission and release I2C bus

Wire.endTransmission();

}

void loop()

{

// Begin transmission

Wire.beginTransmission(TMP_ADDR);

// Select Data Registers

Wire.write(0X00);

// End Transmission

Wire.endTransmission();

delay(500);

// Request 2 bytes , Msb first

Wire.requestFrom(TMP_ADDR, 2 );

// Read the two bytes

while(Wire.available())

{

//remove garbage

Serial.flush();

int msb = Wire.read();

int lsb = Wire.read();

Wire.endTransmission();

// Data conversion in raw values

int rawtmp = msb << 8 |lsb;

int value = rawtmp >> 4;

double ans = value * 0.0625 ;

// Print output

Serial.print("celsius value : ");

Serial.println(ans) ;

}

}

Step 5:

I did my best u do yours ;-)

For further quires Feel free to visit our site:

www.dcubetechnologies.com

About This Instructable

479views

0favorites

More by Dcube Tech Ventures:Home Automation with Raspberry Pi using Relay board Motion Control with Raspberry Pi and LIS3DHTR, 3-Axis Accelerometer, using Python 3-Axis Accelerometer, ADXL345 with Raspberry Pi using Python 
Add instructable to: