Displaying Temperature on LCD Using STS-21(I2C)

Introduction: Displaying Temperature on LCD Using STS-21(I2C)

About: We are a group of makers. We work in IoT, IOS app, android app, embedded design, sensor design, raspberry pi, arduino, beaglebone, particle electron, particle photon, Bluetooth.

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.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

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
  2. I²C Shield for Arduino Nano
  3. USB Cable Type A to Micro Type B 6 Feet Long LINK
  4. I²C Cable LINK
  5. 12 or 14-Bit Resolution Digital Output I²C Interface.
  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

Be the First to Share

    Recommendations

    • LED Strip Speed Challenge

      LED Strip Speed Challenge
    • Sculpting Challenge

      Sculpting Challenge
    • Clocks Contest

      Clocks Contest

    Discussions