loading

Hello,

Good Greetings..!! I (Somanshu Choudhary) on the behalf of Dcube tech ventures going to measure temperature using Arduino nano and displaying it on 16 X 2 LCD it is one of the applications of I2C protocol to read analog data of temperature Sensor STS-21.

Step 1: Overview

  1. Temperature Sensor STS-21
  2. DATASHEET LINK : https://www.sensirion.com/experts-for-smart-sensor...

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. 12 or 14-Bit Resolution Digital Output I²C Interface LINK: https://www.controleverything.com/content/Temperat...
  6. 16 X 2 LINK : http://www.amazon.in/16x2-Alphanumeric-Display-JHD...
  7. Ribbon Wire LINK : http://www.amazon.in/Multi-Colored-Strand-Ribbon-C...
  8. New Soldering Iron - 25W , Solder Wire LINK : http://www.amazon.in/New-Soldering-Iron-Solder-buy...

  9. Wire Stripper & Cutter KG163 LINK : http://www.amazon.in/KitsGuru-Wire-Stripper-Cutter...

Step 3: Circuit Diagram

Step 4: Programming

#include

#include LiquidCrystal lcd(6, 7, 5, 4, 3, 2);

void setup()

{

// set up the LCD's number of columns and rows

lcd.begin(16, 2);

// I2C address of the STS21

#define TMP_ADDR 0x4A

// Join I2c Bus as master

Wire.begin();

// Start serial communication

Serial.begin(9600);

// Begin transmission

Wire.beginTransmission(TMP_ADDR);

// Select no hold master

Wire.write(0xF3);

// End transmission and release I2C bus

Wire.endTransmission();

}

void loop()

{

// Begin transmission

Wire.beginTransmission(TMP_ADDR);

// Select Data Registers

Wire.write(TMP_ADDR);

// End transmission and release I2C bus

delay(500);

// Request 2 bytes , Msb first

Wire.requestFrom(TMP_ADDR, 2 );

// Read the two bytes

while(Wire.available())

{

int msb = Wire.read();

int lsb = Wire.read();

Wire.endTransmission();

// Data conversion in raw values

int rawtmp = msb << 8 |lsb;

int value = rawtmp & 0xFFFC;

double ans = -46.85 + (175.72 * (value / 65536.0));

// Print output

Serial.print("celsius value : ");

Serial.println(ans);

lcd.setCursor(0, 0);

lcd.print("celsius value : ");

lcd.setCursor(0,1);

lcd.print(ans,10);

delay(1000);

} }

Step 5:

For further quires Feel free to visit our site:

www.dcubetechnologies.com

About This Instructable

255views

1favorite

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: