<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Hack a Day &#187; sht71</title>
	<atom:link href="http://hackaday.com/tag/sht71/feed/" rel="self" type="application/rss+xml" />
	<link>http://hackaday.com</link>
	<description>Fresh hacks every day</description>
	<lastBuildDate>Fri, 10 Feb 2012 11:18:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='hackaday.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/5560f98f805877b0e332f191cb9e0af3?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Hack a Day &#187; sht71</title>
		<link>http://hackaday.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://hackaday.com/osd.xml" title="Hack a Day" />
	<atom:link rel='hub' href='http://hackaday.com/?pushpress=hub'/>
		<item>
		<title>Parts: Precision humidity and temperature sensor (SHT1x/7x)</title>
		<link>http://hackaday.com/2008/12/29/parts-precision-humidity-and-temperature-sensor-sht1x7x/</link>
		<comments>http://hackaday.com/2008/12/29/parts-precision-humidity-and-temperature-sensor-sht1x7x/#comments</comments>
		<pubDate>Mon, 29 Dec 2008 18:03:14 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[parts]]></category>
		<category><![CDATA[tool hacks]]></category>
		<category><![CDATA[2 wire interface]]></category>
		<category><![CDATA[bus pirate]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[interfacing]]></category>
		<category><![CDATA[monday parts]]></category>
		<category><![CDATA[sensirion]]></category>
		<category><![CDATA[sht11]]></category>
		<category><![CDATA[sht1x]]></category>
		<category><![CDATA[sht71]]></category>
		<category><![CDATA[sht7x]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=7279</guid>
		<description><![CDATA[Sensirion&#8217;s SHTxx is a digitally interfaced humidity and temperature sensor. Accurate humidity measurements usually require careful analog design, but the SHTxx moves all that complicated stuff into a single chip. Through-hole (SHT7x) and surface mount (SHT1x) versions are available, we used the surface mount SHT11 with +/-3% accuracy. We&#8217;ll show you how to use the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=7279&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-7334" title="sht11" src="http://hackadaycom.files.wordpress.com/2008/12/sht11.jpg" alt="sht11" width="450" height="322" /></p>
<p>Sensirion&#8217;s <a href="http://www.sensirion.com/en/01_humidity_sensors/00_humidity_sensors.htm">SHTxx</a> is a digitally interfaced humidity and temperature sensor. Accurate humidity measurements usually require careful analog design, but the SHTxx moves all that complicated stuff into a single chip. Through-hole (SHT7x) and surface mount (SHT1x) versions are available, we used the surface mount SHT11 with +/-3% accuracy. We&#8217;ll show you how to use the SHTxx below.</p>
<p><span id="more-7279"></span></p>
<p><strong>Sensirion SHT1x/SHT7x precision humidity and temperature sensor (<a href="http://octopart.com/search?q=sht*">Octopart search</a>, starting at $25).</strong></p>
<p>This isn&#8217;t a cheap sensor. Octopart lists <a href="http://octopart.com/search?q=sht*">a few places to buy it</a>. Several smaller hobby electronics stores carry it; Hobby Engineering has it for $29 (#<a href="http://www.hobbyengineering.com/H1509.html">H01509-01C</a>). We found compatible PCB footprints in <em>sht10_11_15.lbr</em> and <em>sht11.lbr</em> on the <a href="http://www.cadsoftusa.com/cgi-bin/download.pl?page=/home/cadsoft/html_public/download.htm.en&amp;dir=eagle/userfiles/libraries">Cadsoft library download page</a>. Pin connections for the different package types are in the datasheet: <a href="http://www.sensirion.com/en/pdf/product_information/Datasheet-humidity-sensor-SHT1x.pdf">SHT1x</a> (PDF), <a href="http://www.sensirion.com/en/pdf/product_information/Datasheet-humidity-sensor-SHT7x.pdf">SHT7x</a> (PDF).</p>
<p><img class="alignnone size-full wp-image-7314" title="sht11" src="http://hackadaycom.files.wordpress.com/2008/12/cct1.png" alt="sht11" width="452" height="337" /></p>
<p>The SHTxx has a two-wire serial interface that requires pull-up resistors (R1,2), values between 2K and 10K should work. Sensirion recommends a decoupling capacitor (C1) only if the sensor is powered over a length of wire, but we think it&#8217;s always a good idea to include one.</p>
<p>We&#8217;ll demonstrate the SHTxx using the <a href="http://hackaday.com/2008/11/19/how-to-the-bus-pirate-universal-serial-interface/">Bus Pirate universal serial interface</a> in raw2wire mode with Hi-Z outputs. The SHTxx is powered from the Bus Pirate&#8217;s 3.3volt supply. The Bus Pirate&#8217;s on-board pull-up resistors hold the bus high, eliminating the need for external resistors R1 and R2.</p>
<p><strong>Interface</strong></p>
<p>The SHTxx communicates over two wires using a simple serial protocol. The protocol isn&#8217;t compatible with I2C, but a single SHTxx can exist on a bus with I2C peripherals.</p>
<table border="0">
<tbody>
<tr>
<td><strong>Command</strong></td>
<td><strong>Code</strong></td>
</tr>
<tr>
<td>Measure Temperature</td>
<td><em>000</em>00011</td>
</tr>
<tr>
<td>Measure Relative Humidity</td>
<td><em>000</em>00101</td>
</tr>
<tr>
<td>Read Status Register</td>
<td><em>000</em>00111</td>
</tr>
<tr>
<td>Write Status Register</td>
<td><em>000</em>00110</td>
</tr>
<tr>
<td>Soft reset</td>
<td><em>000</em>11110</td>
</tr>
</tbody>
</table>
<p>Five commands control the SHTxx, these are outlined in the table. The first 3 bits are the address (always 000), the remaining 5 bits are a unique command code.</p>
<p><strong>Reset</strong></p>
<p>Start a transaction by clearing any partial commands or data from a previous use. A minimum of nine clock ticks while data is high will clear the SHTxx interface. The Bus Pirate syntax to for this is <em>-^:9</em>; data high (-), 9 clock ticks (^:9).<strong><br />
</strong></p>
<p>Commands to the SHT11 begin with a unique start condition. Like an <a href="http://www.esacademy.com/faq/i2c/busevents/i2cstast.htm">I2C start condition</a>, this is the only time when the data signal changes with the clock signal high. This illegal condition causes the chip to prepare for a new command. The SHTxx start condition is different than I2C, allowing both types of devices to exist on the same bus.</p>
<p>The Bus Pirate code to generate an SHTxx style start condition is<em> -/_\/-\ </em>; data starts high (-), clock up (/), data goes low (_), clock low (\), clock high (/), data goes high (-), and a final clock low transition (\) ends the sequence.</p>
<p>A soft reset is a good idea because it puts the chip in a default state. Prior to the first temperature or humidity conversion, we send the soft reset command.</p>
<blockquote><p>RAW2WIRE&gt;-^:9 -/_\/-\ 0b00011110 !<strong>&lt;&#8211;command</strong><br />
4xx RAW2WIRE DATA OUTPUT, 1 <strong>&lt;&#8211;clear interface</strong><br />
4xx RAW2WIRE 0&#215;09 CLOCK TICKS<br />
4xx RAW2WIRE DATA OUTPUT, 1 <strong>&lt;&#8211;start condition</strong><br />
4xx RAW2WIRE CLOCK, 1<br />
4xx RAW2WIRE DATA OUTPUT, 0<br />
4xx RAW2WIRE CLOCK, 0<br />
4xx RAW2WIRE CLOCK, 1<br />
4xx RAW2WIRE DATA OUTPUT, 1<br />
4xx RAW2WIRE CLOCK, 0<br />
420 RAW2WIRE WRITE: 0x1E <strong>&lt;&#8211;soft reset code</strong><br />
4xx RAW2WIRE READ BIT: 0 <strong>&lt;&#8211;acknowledge</strong><strong> bit, OK</strong><br />
RAW2WIRE&gt;</p></blockquote>
<p>First, we clear the interface (-^:9), then send the start condition (<em>-/_\/-\). </em>The reset command (0b00011110=0x1E) follows. The SHTxx acknowledges (acks) commands by pulling the data line low for one bit after a command is transmitted. We read one bit (!) to get the acknowledgment status; 0 is success, 1 signals an error.</p>
<p><strong>Temperature</strong></p>
<p>Now we can read the temperature<strong>. </strong>This happens in two steps, with a delay for the temperature conversion.<strong><br />
</strong></p>
<blockquote><p>RAW2WIRE&gt;-^:9 -/_\/-\ 0b00000011 !<br />
4xx RAW2WIRE DATA OUTPUT, 1  <strong>&lt;&#8211;clear interface</strong><br />
4xx RAW2WIRE 0&#215;09 CLOCK TICKS<br />
4xx RAW2WIRE DATA OUTPUT, 1 <strong>&lt;&#8211;start condition</strong><br />
&#8230;<br />
4xx RAW2WIRE CLOCK, 0<br />
420 RAW2WIRE WRITE: 0&#215;03 <strong>&lt;&#8211;start temperature conversion</strong><br />
4xx RAW2WIRE READ BIT: 0 <strong>&lt;&#8211;ack bit, OK</strong><br />
RAW2WIRE&gt;</p></blockquote>
<p>First, we send a start condition and the temperature conversion command (00000011=0&#215;03). The SHTxx replies to a successful command by pulling the data line low for one bit (ack). After the ack bit, the data line goes high until the conversion finishes.</p>
<blockquote><p>RAW2WIRE&gt;.<br />
4xx RAW2WIRE DATA INPUT, STATE: 0 <strong>&lt;&#8211;data low when done</strong><br />
RAW2WIRE&gt;</p></blockquote>
<p>When the data line goes low, the temperature conversion is finished. &#8216;.&#8217; is the Bus Pirate command to read the data state without a clock tick. Now we can grab the result.</p>
<blockquote><p>RAW2WIRE&gt;r_^ r_^ r_^<br />
430 RAW2WIRE READ: 0&#215;17 <strong>&lt;&#8211;data byte 1</strong><br />
4xx RAW2WIRE DATA OUTPUT, 0 <strong>&lt;&#8211;data low</strong><br />
4xx RAW2WIRE 0&#215;01 CLOCK TICKS <strong>&lt;&#8211;send ack bit</strong><br />
430 RAW2WIRE READ: 0xCC <strong>&lt;&#8211;data byte 2</strong><br />
4xx RAW2WIRE DATA OUTPUT, 0<br />
4xx RAW2WIRE 0&#215;01 CLOCK TICKS<br />
430 RAW2WIRE READ: 0x0C <strong>&lt;&#8211;crc</strong><br />
4xx RAW2WIRE DATA OUTPUT, 0<br />
4xx RAW2WIRE 0&#215;01 CLOCK TICKS<br />
RAW2WIRE&gt;</p></blockquote>
<p>Each byte read (r) requires an I2C style acknowledgment bit with the data low. We do this with the _^ sequence; data low (_), one clock tick (^).</p>
<p>The first two bytes are the temperature reading (0x17cc), followed by a CRC (0x0c). The raw value (0x17cc=6092) is converted to degrees Celsius using the equation and coefficients on page 9 of the datasheet. Temperature readings are 14bits by default:</p>
<p style="padding-left:30px;">T = -39.7 + 0.01*<em>X</em></p>
<p style="padding-left:30px;"><span style="text-decoration:underline;">21.22C</span> = -39.7 + (0.01*<em>6092</em>)</p>
<p><strong>Humidity</strong></p>
<p>Humidity conversions are started with code 00000101 (0&#215;05 hex).<strong><br />
</strong></p>
<blockquote><p>RAW2WIRE&gt;-^:9 -/_\/-\ 0b00000101 ! <strong>&lt;&#8211;command</strong><br />
4xx RAW2WIRE DATA OUTPUT, 1 <strong>&lt;&#8211;clear interface</strong><br />
4xx RAW2WIRE 0&#215;09 CLOCK TICKS<br />
4xx RAW2WIRE DATA OUTPUT, 1 <strong>&lt;&#8211;start condition</strong><br />
&#8230;<br />
4xx RAW2WIRE CLOCK, 0<br />
420 RAW2WIRE WRITE: 0&#215;05 <strong>&lt;&#8211;start humidity conversion</strong><br />
4xx RAW2WIRE READ BIT: 0<strong>&lt;&#8211;ack bit, OK</strong></p></blockquote>
<p>As before, a ninth acknowledgment bit is low if the SHTxx processed the command.</p>
<blockquote><p>RAW2WIRE&gt;.<br />
4xx RAW2WIRE DATA INPUT, STATE: 0 <strong>&lt;&#8211;data low when done</strong></p></blockquote>
<p>The data line goes high and then returns low when the humidity conversion is done.</p>
<blockquote><p>RAW2WIRE&gt;r_^ r_^ r_^<br />
430 RAW2WIRE READ: 0&#215;05 <strong>&lt;&#8211;data byte 1</strong><br />
4xx RAW2WIRE DATA OUTPUT, 0 <strong>&lt;&#8211;data low</strong><br />
4xx RAW2WIRE 0&#215;01 CLOCK TICKS <strong>&lt;&#8211;ack bit</strong><br />
430 RAW2WIRE READ: 0&#215;80 <strong>&lt;&#8211;data byte 2</strong><br />
4xx RAW2WIRE DATA OUTPUT, 0<br />
4xx RAW2WIRE 0&#215;01 CLOCK TICKS<br />
430 RAW2WIRE READ: 0&#215;46 <strong>&lt;&#8211;crc</strong><br />
4xx RAW2WIRE DATA OUTPUT, 0<br />
4xx RAW2WIRE 0&#215;01 CLOCK TICKS<br />
RAW2WIRE&gt;</p></blockquote>
<p>A complete conversion generates a three byte response. The first two bytes are the raw humidity reading (0&#215;0580=1408), the final byte is a CRC (0&#215;46) that can be used to verify data integrity.</p>
<p>Humidity readings have 12bits of resolution by default, convert to humidity using this equation:</p>
<p style="padding-left:30px;">RH = -2.0468 + 0.0367(<em>X</em>) + (-0.0000015955*(<em>X</em>^2))</p>
<p style="padding-left:30px;"><span style="text-decoration:underline;">46.46%RH</span> = -2.0468 + 0.0367(<em>1408</em>) + (-0.0000015955*(<em>1408</em>^2))</p>
<p><strong>Conclusion</strong></p>
<p>This isn&#8217;t a cheap sensor, but it doesn&#8217;t require careful analog design like the <a href="http://content.honeywell.com/sensing/prodinfo/humiditymoisture/">Honeywell HIH series</a>. Have you worked with a humidity sensor?</p>
<p>Like this post? Check out the <a href="http://hackaday.com/category/parts/">parts posts</a> you may have missed.</p>
<br />Posted in parts, tool hacks  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/7279/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/7279/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/7279/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/7279/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/7279/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/7279/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/7279/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/7279/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/7279/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/7279/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/7279/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/7279/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/7279/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/7279/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=7279&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2008/12/29/parts-precision-humidity-and-temperature-sensor-sht1x7x/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Ian</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2008/12/sht11.jpg" medium="image">
			<media:title type="html">sht11</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2008/12/cct1.png" medium="image">
			<media:title type="html">sht11</media:title>
		</media:content>
	</item>
	</channel>
</rss>
