Digital Humidity Temperature Sensor SHT15 with Arduino

 '' This is a breakout board of the famous sensor Sensirion SHT1x.
SHT1x is Sensirion’s family of surface mountable relative humidity and temperature sensors.
The sensors integrate sensor elements plus signal processing on a tiny foot print and provide a fully calibrated digital output.
A unique capacitive sensor element is used for measuring relative humidity while temperature is measured by a band-gap sensor.
The applied CMOSens® technology guarantees excellent reliability and long term stability.
Here there is a collection of examples for connect the sensor SHT15 with Arduino.



Wiring

 ''''

  • Clock 'SCL' to Digital Pin 11
  • Data 'SDA' to Digital Pin 10 with 10kΩ Pull-up Resistor 1)
  • Vcc to 5V
  • GND to Arduino GND



Source Code Simple Example

  1. Download the library “sth1x.zip” and unzip it in your Arduino Library directory
  2. Flash your Arduino with this sketch:
    ReadSHT1xx.pde
    /**
     * ReadSHT1xValues
     *
     * Read temperature and humidity values from an SHT1x-series (SHT10,
     * SHT11, SHT15) sensor.
     *
     * Copyright 2009 Jonathan Oxer <jon@oxer.com.au>
     * www.practicalarduino.com
     */
     
    #include <SHT1x.h>
     
    // Specify data and clock connections and instantiate SHT1x object
    #define dataPin  10
    #define clockPin 11
    SHT1x sht1x(dataPin, clockPin);
     
    void setup()
    {
       Serial.begin(38400); // Open serial connection to report values to host
       Serial.println("Starting up");
    }
     
    void loop()
    {
      float temp_c;
      float temp_f;
      float humidity;
     
      // Read values from the sensor
      temp_c = sht1x.readTemperatureC();
      temp_f = sht1x.readTemperatureF();
      humidity = sht1x.readHumidity();
     
      // Print the values to the serial port
      Serial.print("Temperature: ");
      Serial.print(temp_c, DEC);
      Serial.print("C / ");
      Serial.print(temp_f, DEC);
      Serial.print("F. Humidity: ");
      Serial.print(humidity);
      Serial.println("%");
     
      delay(2000);
    }
  3. View results on Arduino Serial:

Thanks to Jonathan Oxer and Maurice Ribble for this software


miniProject: Remote Temperature,Humidity with Arduino + Ethernet Shield

  1. Flash your Arduino with this sketch: 2)
    RemoteSHT1.pde
    #include <Ethernet.h>
    #include <SHT1x.h>
     
    /* Software Version */
    #define VERSION 1.0
     
    /* 2wire SHT1 */
    #define dataPin  10
    #define clockPin 11
     
    SHT1x sensor(dataPin, clockPin);
    float h; // Humidity
    float t; // Temperature
     
    // Network Configuration.
    byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //mac address
    byte ip[] = { 10, 0, 1, 33 }; // ip
    byte gateway[] = { 10, 0, 1, 1 }; // gateway
    byte subnet[] = { 255, 255, 255, 0 }; // subnet
    int server_port = 23;  // Telnet Server Port
     
    // init Telnet Server on port server_port
    Server server(server_port);
     
    /* Function init_eth0 */
    void init_eth0(void) {
       Ethernet.begin(mac, ip, gateway, subnet);
       server.begin();
    }
     
    void setup(void) {
      Serial.begin(9600);
      debug_network_info();
      init_eth0(); //init ethernet
    }
     
    /* Loop */
    void loop() {     
       Client client = server.available(); // Client Telnet 
     
       /* Telnet console*/
       if (client) {
     
            char command = client.read();
            if(command == 't' ) { //Show Temperature
               t=sensor.readTemperatureC(); //read Temperature
    	   server.print("T: ");
    	   server.println(t);
            }
            if(command == 'h' ) { //Show Humidity
               h=sensor.readHumidity(); //read Temperature
    	   server.print("H: ");
    	   server.println(h);
            }
            else if (command == 'e') //exit connection
    	  client.stop(); 
            else if (command == '?') { //show help
              server.println("Command available:");
              server.println("                   '?' this help");
              server.println("                   't' show Temperature (C)");
              server.println("                   'h' show Humidity (%)");
              server.println("                   'e' exit telnet");
            }
            /* ADD Sensor*/
     
        }
        /* Serial Debug */
           if(Serial.available()>0) {
             char c = Serial.read();
             if( c == 't' ) { // command 't' : Show Temperature 
                 t=sensor.readTemperatureC(); //read Temperature
                 Serial.println("> Temperature");
                 Serial.print("  T: ");
                 Serial.print(t);
                 Serial.println(" C");
              }
              if( c == 'h' ) { // command 'h' : Show Humidity 
                 h=sensor.readHumidity(); //read Temperature
                 Serial.println("> Humidity");
                 Serial.print("  H: ");
                 Serial.print(h);
                 Serial.println(" %");
              }
              else if ( c == '?') { // Command 'h' : Show Help 
                 Serial.println("> ? Help");
                 Serial.println("  Usage:  '?' show help");
                 Serial.println("          't' show Temperature");
                 Serial.println("          'h' show Humidity");
                 Serial.println("          'n' show Network Info");
              }
              else if (c == 'n') { // Command 'n' : Show Network Info
                debug_network_info();
              }
              else { // Unknown Command 
                Serial.print("> '");
                Serial.print(c);
                Serial.print("'");
                Serial.println(" Unknown Command!");
              }
           }       
    }
     
    /* Fuction debug Network info : debug_network_info(void) 
       Show the Network Settings to Serial
     */
     void debug_network_info(void) {
     
      if(Serial.available()>=0) {
         Serial.print("**** Arduino Remote Sensor (v. ");
         Serial.print(VERSION,1);
         Serial.println(") ****");
         Serial.println("");
     
         /* Print Mac Address */
         Serial.print("* Mac:   "); 
         for(int i=0; i<6; i++) {
    	Serial.print(mac[i],HEX);
    	if(i!=5)
    	   Serial.print(":");
    	else
    	   Serial.println("");
         }
         /* Print IP */
         Serial.print("* Ip:    ");
         for(int i=0; i<4; i++) {
    	Serial.print((int)ip[i]);
    	if(i!=3)
    	   Serial.print(".");
    	else
    	   Serial.println("");
         }
         /* Print Netmask */
         Serial.print("* Mask:  ");
         for(int i=0; i<4; i++) {
    	Serial.print((int)subnet[i]);
    	if(i!=3)
    	   Serial.print(".");
    	else
    	   Serial.println("");
         }
         /* Print Gateway */
         Serial.print("* Gw:    ");
         for(int i=0; i<4; i++) {
    	Serial.print((int)gateway[i]);
    	if(i!=3)
    	   Serial.print(".");
    	else
    	   Serial.println("");
         }
         /* Print Telnet Server Port*/
         Serial.print("* Port:  ");
         Serial.println(server_port);
         Serial.println("");
         Serial.println("> Send command..");     
         }
    }



Link

1)  '''' The pull-up resistor is already on board
2) Change the network setting on top of the code
 
sht15_arduino.txt · Last modified: 2010/12/11 17:51 by marco.antonini
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki