<html><body><div style="color:#000; background-color:#fff; font-family:bookman old style, new york, times, serif;font-size:12pt"><div><span>Hi to all,</span></div><div><span>I have moved to testing the temperature sensor/probe LM35DZ for the experimental incubator which is now being finally in service. I have used the arduino sketch which I have found at adafruit webpage and which I posted below for the probe to get the temperature readings (in Celsius) displayed at the serial monitor. The temperature is around 50 degrees below the one measured by digital thermometer. So if I use a digital thermometer and it says it is 25.5 C, the LM35DZ tells me at serial monitor it is around -25 C (room t), when submerged in to the warm water digital thermometer shows 42C, probe -9.96C (not completely submerged, it is not water tight yet). Do you have idea how to change the script so it shows corresponding temperature? I use 5
 V.<br></span></div><div><br><span></span></div><div><span>I also wonder if the sensebridge would be the place to ask in the future, because it is likely I'm going to have more questions about similar sensor and arduino related topics.</span></div><div><br><span></span></div><div><span>Thanks a lot for any help,</span></div><div><br><span></span></div><div><span>Sincerely,</span><span class="tab"><br></span></div><div>&nbsp;</div><div>Frantisek Algoldor Apfelbeck<br></div><div><br></div><div><br></div><div class="build-code">
      <pre class="prettyprint linenums"><ol class="linenums"><li class="L0"><span class="com">//TMP36 Pin Variables</span></li><li class="L1"><span class="kwd">int</span><span class="pln"> sensorPin </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">;</span><span class="pln"> </span><span class="com">//the analog pin the TMP36's Vout (sense) pin is connected to</span></li><li class="L2"><span class="pln">                        </span><span class="com">//the resolution is 10 mV / degree centigrade with a</span></li><li class="L3"><span class="pln">                        </span><span class="com">//500 mV offset to allow for negative temperatures</span></li><li class="L4"><span class="pln"> </span></li><li class="L5"><span class="com">/*</span></li><li class="L6"><span class="com"> * setup() - this function runs once when you turn your Arduino on</span></li><li class="L7"><span class="com"> * We
 initialize the serial connection with the computer</span></li><li class="L8"><span class="com"> */</span></li><li class="L9"><span class="kwd">void</span><span class="pln"> setup</span><span class="pun">()</span></li><li class="L0"><span class="pun">{</span></li><li class="L1"><span class="pln">  </span><span class="typ">Serial</span><span class="pun">.</span><span class="kwd">begin</span><span class="pun">(</span><span class="lit">9600</span><span class="pun">);</span><span class="pln">  </span><span class="com">//Start the serial connection with the computer</span></li><li class="L2"><span class="pln">                       </span><span class="com">//to view the result open the serial monitor </span></li><li class="L3"><span class="pun">}</span></li><li class="L4"><span class="pln"> </span></li><li class="L5"><span class="kwd">void</span><span class="pln"> loop</span><span class="pun">()</span><span class="pln">                     </span><span
 class="com">// run over and over again</span></li><li class="L6"><span class="pun">{</span></li><li class="L7"><span class="pln"> </span><span class="com">//getting the voltage reading from the temperature sensor</span></li><li class="L8"><span class="pln"> </span><span class="kwd">int</span><span class="pln"> reading </span><span class="pun">=</span><span class="pln"> analogRead</span><span class="pun">(</span><span class="pln">sensorPin</span><span class="pun">);</span><span class="pln">  </span></li><li class="L9"><span class="pln"> </span></li><li class="L0"><span class="pln"> </span><span class="com">// converting that reading to voltage, for 3.3v arduino use 3.3</span></li><li class="L1"><span class="pln"> </span><span class="kwd">float</span><span class="pln"> voltage </span><span class="pun">=</span><span class="pln"> reading </span><span class="pun">*</span><span class="pln"> </span><span class="lit">5.0</span><span class="pun">;</span></li><li
 class="L2"><span class="pln"> voltage </span><span class="pun">/=</span><span class="pln"> </span><span class="lit">1024.0</span><span class="pun">;</span><span class="pln"> </span></li><li class="L3"><span class="pln"> </span></li><li class="L4"><span class="pln"> </span><span class="com">// print out the voltage</span></li><li class="L5"><span class="pln"> </span><span class="typ">Serial</span><span class="pun">.</span><span class="kwd">print</span><span class="pun">(</span><span class="pln">voltage</span><span class="pun">);</span><span class="pln"> </span><span class="typ">Serial</span><span class="pun">.</span><span class="pln">println</span><span class="pun">(</span><span class="str">" volts"</span><span class="pun">);</span></li><li class="L6"><span class="pln"> </span></li><li class="L7"><span class="pln"> </span><span class="com">// now print out the temperature</span></li><li class="L8"><span class="pln"> </span><span
 class="kwd">float</span><span class="pln"> temperatureC </span><span class="pun">=</span><span class="pln"> </span><span class="pun">(</span><span class="pln">voltage </span><span class="pun">-</span><span class="pln"> </span><span class="lit">0.5</span><span class="pun">)</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> </span><span class="lit">100</span><span class="pln"> </span><span class="pun">;</span><span class="pln">  </span><span class="com">//converting from 10 mv per degree wit 500 mV offset</span></li><li class="L9"><span class="pln">                                               </span><span class="com">//to degrees ((volatge - 500mV) times 100)</span></li><li class="L0"><span class="pln"> </span><span class="typ">Serial</span><span class="pun">.</span><span class="kwd">print</span><span class="pun">(</span><span class="pln">temperatureC</span><span class="pun">);</span><span class="pln"> </span><span
 class="typ">Serial</span><span class="pun">.</span><span class="pln">println</span><span class="pun">(</span><span class="str">" degrees C"</span><span class="pun">);</span></li><li class="L1"><span class="pln"> </span></li><li class="L2"><span class="pln"> </span><span class="com">// now convert to Fahrenheight</span></li><li class="L3"><span class="pln"> </span><span class="kwd">float</span><span class="pln"> temperatureF </span><span class="pun">=</span><span class="pln"> </span><span class="pun">(</span><span class="pln">temperatureC </span><span class="pun">*</span><span class="pln"> </span><span class="lit">9.0</span><span class="pln"> </span><span class="pun">/</span><span class="pln"> </span><span class="lit">5.0</span><span class="pun">)</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="lit">32.0</span><span class="pun">;</span></li><li class="L4"><span class="pln"> </span><span
 class="typ">Serial</span><span class="pun">.</span><span class="kwd">print</span><span class="pun">(</span><span class="pln">temperatureF</span><span class="pun">);</span><span class="pln"> </span><span class="typ">Serial</span><span class="pun">.</span><span class="pln">println</span><span class="pun">(</span><span class="str">" degrees F"</span><span class="pun">);</span></li><li class="L5"><span class="pln"> </span></li><li class="L6"><span class="pln"> delay</span><span class="pun">(</span><span class="lit">1000</span><span class="pun">);</span><span class="pln">                                     </span><span class="com">//waiting a second</span></li><li class="L7"><span class="pun">}</span></li></ol></pre>
    </div><div><br></div><div><br></div><div>biotechnologist&amp;kvasir and hacker</div><br><br><div>http://www.frantisekapfelbeck.org</div><div><br><br></div><div>"There is no way to peace, peace is the way." Ghandi<br></div></div></body></html>