: UPDATE OF PIN 13: Thanks to cybersbfor the catch.
The Fritzing schematic shows using pins 12 and 13. This not correct. Should use the pins listed in the code, pins 11 and 12.

This is as the title implies, An Arduino powered LCD monitored thermometer that uses an LM35 temp sensor for the temp readings. If you have never worked with an LCD before like me some things can be a little confusing such as: the first line, the top line is line 0. The second line, bottom line is line 1. But no matter once some of these things are figured out its easier to move on.

These run one time at power up:

First display line 0 is Waynes World
First display line 1 is Thermometer
Second display line 0 is LCD Displayed
Second display line 1 is Averaged Temp

These run over and over in the loop:

Third display line 0 is Current Temp is:
Third display line 1 is Celius [ tempC displayed ]
Fourth display line 0 is Current Temp is:
fourth display line 1 is Fahrenheit [ tempF displayed]

So the information that changes every 3 seconds on the display is it changes on line 1 from display three to display four. Celcius tempC] to Fahrenheit [tempF]

LCD's have one big plus that makes it easier for us to work with them. The LCD library.
When you download and install the Arduino program that is just one of the many libraries that are included.

While this LCD is after-after market it still utilizes the extremely common HD44780 parallel interface chipset. Lucky for me.
It can be used in 4-Bit or 8-Bit mode. We are using the 4-Bit mode here. That's why pins 7,8,9 and 10 of the LCD are not used.
If you are using 8-Bit mode then those pins will be used also.

This is the second time i have written this sketch. The first time i deleted it right after i finished it. Woops!
It' s good really, i need all the practice i can get for coding.

YouTube video link.

<p>Digital Temperature Monitor ( Room &amp; Body Temp )</p>
<p>hello can you help us to make this project, we use also a lm35 and arduino uno,<br>actually we will control also the temperature.. can you help us about the codes?</p>
<p>Yes very cool project. I just found an LM35 in my parts pile and starting looking for an ible to use it with. I'll give this a try tomorrow and let you know how it went. Thanks for taking the time to write this great Ible.</p>
<p>hello :D can you send me the code of this project ? it will help me a lot. thank you ! :D </p>
I want a code for temperature and time without using rtc
<p>Awesome! Thank you so much. I noticed that the display of F and C seemed swapped in value (C was F), but accurate. Was that a bug?</p><p>Any advice for coding the addition of a PowerSwitch Tail II (https://www.sparkfun.com/products/10747) and having it turn on until the sensor measures a certain avg temp, and then off? I'm wanting to hook up a simple tiny heater in a simple 2ft seed starter greenhouse and keep the temp up, but I'm not much of a coder. I'll be using a plastic bin and this heater BTW with a cup of water to hold the heat and provide humidity. <a href="http://amzn.com/B000CO89T8" rel="nofollow">http://amzn.com/B000CO89T8</a></p>
<p>Great project. Thank you! I am also using tmp36gz and had to adjust calculation variables as per the comment from citin. Except I had to change the *25 to *34 to get a near accurate reading. </p>
<p>Great project. Thank you! I am also using tmp36gz and had to adjust calculation variables as per the comment from citin. Except I had to change the *25 to *34 to get a near accurate reading. </p>
<p>Great project. Thank you! I am also using tmp36gz and had to adjust calculation variables as per the comment from citin. Except I had to change the *25 to *34 to get a near accurate reading. </p>
<p>Hi, I am starting with arduino and I am using the mega 2560, That program works very good, well my problem is, How can I read data from SD reader and write data too. When I try read, the lcd display goes clear and never comes back and when do reset on mega a lot trash comes to display.</p><p>/* </p><p>October 25 2012</p><p>Based off of a project by DJ Mentzik.</p><p>Enhanced and modified by WWC.</p><p>Supporting documents can be found at <a href="https://www.instructables.com/member/WWC/" rel="nofollow"> https://www.instructables.com/member/WWC/</a></p><p>Use and modife as needed.</p><p>Displays Current, 8 sec Average, Max and Min Temperature.</p><p> To wire your LCD screen to your Arduino, connect the following pins: </p><p>LCD Pin 6 to digital pin 12 - mega 50</p><p>LCD Pin 4 to digital pin 11 - mega 51</p><p>LCD Pin 11 to digital pin 5 - mega 43</p><p>LCD Pin 12 to digital pin 4 - mega 42</p><p>LCD Pin 13 to digital pin 3 - mega 41</p><p>LCD Pin 14 to digital pin 2 - mega 40</p><p>Additionally, wire a 10K pot to +5V and GND, with it's wiper (output) to LCD screens VO pin (pin3). </p><p> * SD card attached to SPI bus as follows:</p><p> ** MOSI - pin 11 - mega 51</p><p> ** MISO - pin 12 - mega 50</p><p> ** CLK - pin 13 - mega 52</p><p> ** CS - pin 4 - mega 44</p><p> */</p><p>#include &lt;SPI.h&gt;;</p><p>#include &lt;SD.h&gt;</p><p>#include &lt;LiquidCrystal.h&gt; // include the LCD driver library</p><p> // declare variables</p><p>char Room_ID[]=&quot;&quot;; </p><p>int ThmCode = 0; // Variable for Thermometer unit number</p><p>float tempC = 0; // Variable for holding Celcius temp (floating for decimal points precision)</p><p>float tempf = 0; // variable for holding Fareghneit temp</p><p>int tempPin = 0; // Declaring the Analog input to be 0 (A0) of Arduino board.</p><p>float samples[8]; // Array to hold 8 samples for Average temp calculation</p><p>float maxi = 0,mini = 100; // Max/Min temperature variables with initial values. LM35 in simple setup only measures Temp above 0.</p><p>int i;</p><p>File myFile; // about SD card</p><p>LiquidCrystal lcd(50,51,43,42,41,40); // Mega ////(12, 11, 5, 4, 3, 2); //Uno // initialize the library with the numbers of the interface pins</p><p>void setup()</p><p>{</p><p>Serial.begin(9600); // Opens serial port, sets data rate to 9600 bps</p><p>ThmCode = 1;</p><p>lcd.begin(16, 2); // Set up the LCD's number of columns and rows: </p><p>lcd.clear();</p><p>lcd.setCursor(2, 0); // Set LCD cursor position (column, row)</p><p>lcd.print(&quot;Waynes World&quot;); // Print text to LCD</p><p>lcd.setCursor(3, 1); // Set LCD cursor position (column,row) </p><p>lcd.print(&quot;Thermometer&quot;); // Print text to LCD</p><p>delay(5000); // wait 500ms // Delay to read text </p><p>lcd.clear(); // clear LCD display // Clear the display</p><p>lcd.setCursor(2, 0); // Set LCD cursor position (column, row)</p><p>lcd.print(&quot;LCD Displayed&quot;); // Print text to LCD</p><p>lcd.setCursor(1, 1); // Set LCD cursor position (column, row) </p><p>lcd.print(&quot; Averaged Temp &quot;); // Print text to LCD </p><p>delay(5000); // Delay to read text</p><p>lcd.clear(); // Clear LCD</p><p>///// SD-Card initializing /////</p><p> Serial.print(&quot;Initializing SD card...&quot;);</p><p> // On the Ethernet Shield, CS is pin 4. It's set as an output by default.</p><p> // Note that even if it's not used as the CS pin, the hardware SS pin </p><p> // (10 on most Arduino boards, 53 on the Mega) must be left as an output </p><p> // or the SD library functions will not work. </p><p> pinMode(53, OUTPUT);</p><p> if (!SD.begin(4)) {</p><p> Serial.println(&quot;initialization failed!&quot;);</p><p> return;</p><p> }</p><p> else</p><p> {</p><p> Serial.println(&quot;initialization done.&quot;);</p><p> delay(1000);</p><p> // open the file. note that only one file can be open at a time,</p><p> // so you have to close this one before opening another.</p><p>// myFile = SD.open(&quot;test.txt&quot;, FILE_WRITE);</p><p> // if the file opened okay, write to it:</p><p>// if (myFile) </p><p>//{</p><p>// Serial.print(&quot;Writing to test.txt...&quot;);</p><p>// myFile.println(&quot;testing 1, 2, 3.&quot;);</p><p>//// close the file:</p><p>// myFile.close();</p><p>// Serial.println(&quot;done.&quot;);</p><p>// } else {</p><p>// // if the file didn't open, print an error:</p><p>// Serial.println(&quot;error opening test.txt&quot;);</p><p>// }</p><p> // re-open the file for reading:</p><p> myFile = SD.open(&quot;test.txt&quot;);</p><p> if (myFile) {</p><p> Serial.println(&quot;test.txt:&quot;);</p><p> // read from the file until there's nothing else in it:</p><p> while (myFile.available()) </p><p> {</p><p> Serial.write(myFile.read());</p><p> }</p><p> Serial.readBytes(Room_ID,7);</p><p> // close the file:</p><p> myFile.close();</p><p> Serial.println(Room_ID);</p><p> } </p><p> else </p><p> {</p><p> // if the file didn't open, print an error:</p><p> Serial.println(&quot;error opening pacient.txt&quot;);</p><p> }</p><p> }</p><p>}</p><p>void loop()</p><p>{</p><p>Serial.println(&quot;&quot;); // Blank line for spacing in the serial monitor</p><p>Serial.print(&quot;Room Identification: &quot;);</p><p>Serial.println(Room_ID);</p><p>Serial.println(&quot;You are looking at a project built by WWC.&quot;); // Print text to Serial monitor</p><p>Serial.print(&quot;Feal free to use and modife as needed.&quot;);</p><p>Serial.println(&quot;&quot;); // Blank line for spacing in the serial monitor </p><p>Serial.print(&quot;LM35 Raw data: &quot;); // Print text to Serial monitor </p><p>Serial.println(analogRead(tempPin)); // Displays on serial monitor the sampled value before conversion to real Temperature reading</p><p> // Start of calculations FOR loop.</p><p>for(i = 0;i&lt;=7;i++){ // gets 8 samples of temperature</p><p>samples[i] = ( 4.4 * analogRead(tempPin) * 100.0) / 1024.0; // conversion math of LM35 sample to readable temperature and stores result to samples array. </p><p> // 5v is the supply volts of LM35. Change appropriatelly to have correct measurement. My case is 4.4Volts.</p><p> // If powered from USB then use value 4.4v to 4.6v. If power is 7v&lt; to the Arduino then use 4.9v to 5.1v </p><p> // The voltage is critical for accurate readings</p><p>Serial.println(samples[i]); // Print samples [i] to sertiual monitor </p><p> // ( LCD note: line 1 is the second row, since counting begins with 0):</p><p>lcd.setCursor(0, 0); // Set LCD cursor position (column 0, row 0)</p><p>lcd.print(&quot;Room: &quot;);</p><p>lcd.setCursor(6,0);</p><p>lcd.print(Room_ID);</p><p>lcd.setCursor(0, 1); // Set LCD cursor position (column 1, row 1)</p><p>lcd.print(&quot;Temp is: &quot;); // Print text to LCD</p><p>lcd.setCursor(9, 1); // Set LCD cursor position (column 12, row 1)</p><p>lcd.print(samples[i]); // print current Temp sample to LCD</p><p>tempC = tempC + samples[i]; // do the addition for average temperature </p><p>lcd.setCursor(14,1);</p><p>lcd.print(&quot; C&quot;); // Print text to LCD</p><p>delay(800); // wait 800ms</p><p>} // END of FOR loop</p><p>Serial.println(&quot;&quot;); // Blank line for spacing in the serial monitor</p><p>Serial.println(&quot;&quot;); // Blank line for spacing in the serial monitor </p><p>tempC = tempC/8.0; // calculated the averare of 8 samples in Celcius</p><p>tempf = (tempC * 9)/ 5 + 32; // converts to fahrenheit </p><p>if(tempC &gt; maxi) {maxi = tempC;} // set max temperature</p><p>if(tempC &lt; mini) {mini = tempC;} // set min temperature</p><p>Serial.print(&quot;Thermometer Code is: &quot;); // Send Results to Serial Monitor</p><p>Serial.println(ThmCode); // Send the data to the computer </p><p>Serial.println(&quot;now the New measurement:&quot;); // Send the data to the computer</p><p>Serial.print(&quot; Average Temperature in Celcius is &quot; ); // Print text to Serial monitor</p><p>Serial.println(tempC);//send the data to the computer // Send the data to the computer</p><p>Serial.print(&quot; Average Temperature in Farenait is &quot; ); // Print text to Serial monitor </p><p>Serial.println(tempf);//send the data to the computer // Send the data to the computer </p><p>Serial.print(&quot; MAX Temperature in Celcius is &quot; ); // Print text to Serial monitor </p><p>Serial.println(maxi);//send the data to the computer // Send the data to the computer</p><p>Serial.print(&quot; MIN Temperature in Celcius is &quot; ); // Print text to Serial monitor</p><p>Serial.println(mini);//send the data to the computer // Send the data to the computer</p><p> // Send results to LCD.</p><p>lcd.setCursor(9, 1); // Set LCD cursor position (column 0, line 1) </p><p>lcd.print(&quot; Fahrenheit &quot;); // Print text to LCD </p><p>lcd.setCursor(9, 1); // Set LCD cursor position (column 12, line 1) </p><p>lcd.print(tempf); // Send the data to the LCD </p><p>lcd.setCursor(14,1);</p><p>lcd.print(&quot; F&quot;); // Print text to LCD</p><p>delay(6000); // Wait 3 seconds to display the Fahrenheit temp and 3 seconds to display results to LCD screen befor starting the loop again = 6 seconds.</p><p>tempC = 0; // Set tempC to 0 so calculations can be done again</p><p> }</p><p>if somebody can help me, I appreciate. Thanks in advance.</p><p>My e-mail address is krautzhomeimprovement@gmail.com</p>
Really loved your project and completed it in 2 hours....nice instructables bro........the best part of this is the serial monitor data which i was unable to do it perfectly..........THANKZZZ A LOT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
I am glad this has helped you.
Hey! I just completed the build and it's working like a charm! Thanks! :) <br> <br>However, I hooked up the wiring based on the schematic picture you uploaded (I like to jump into the middle of things without reading first), which clearly points at digital 12 + 13 and in the code it says 11 + 12. I double checked my LCD soldering 3 times before I realised this. Is there something I'm missing or is the schematic drawing actually not correct? <br> <br>Nicely done btw! ;)
Ya you have found a discrepancy, nicely done. I would use 11 and 12. <br>Good work, i am glad this working for you.
Thanks for the credit there! ;) I was so glad to make this work as this was the second project I ever did on the Arduino. I actually moved those two pins over to 6 and 7 as my Ethernet shield is using those upper pins.
I have updated the ible and gave you the credit you deserve for the catch. Thanks
I've already done. but still can not :(
Recheck your wiring.
why my lcd blank??? just backlight... thkz
Adjust the contrast
Eloquently straight forward wiring, good coding nice project..<br> <br> Am I imagining your C&deg; scale only does even numbers ??<br> <br> A
Thank A. <br>This is quite a bit better than my first coding projects. <br> <br>It seams to be displaying an odd number in the tens, ones and tenths places, if i understand you question correctly. <br> <br>But there is a difference in the C compared to the F. I think you spotted it. I haven't been able to fix it. The C will display to the second temp changes. You can watch the numbers change on the display, while the F will display a single temp value. No change visible on current display showing. <br>All that is hard to explain. <br> If you watch the video you can see what the C value does compared to the F value.
I did watch it but the first time though I did not pay attention till half way through.<br> <br> On the second watching .... Yes, there are two odd number C&deg; values.<br> <br> Sorry to cast aspersions half cocked :-)<br> <br>
HI WWC <br>I have an Crowduino GSM/GPRS shield and crowduino with ATMega 328 shield . <br>and I want to monitor the LM35 sensor like if the temperature increased more than 28C <br>or decreased less than 23, the gsm shield send sms to my phone NO <br> <br>i want your help please.. <br> <br>thank you alot
Sorry i have never worked with those GPS shields. I would suggest to research this on Google. Good Luck.
it works ! but my sensor is a" tmp 36gz" i changed .. samples [i] = (4.4 * analogRead(tempPin) *1000) /1024; to samples [i] = (4.4 * analogRead(tempPin) *25) /1024; so i get nearly real temprature .
This great i am glad you got it sorted out. Will you be posting an ible? <br>I now have made a 8x10 LED matrix with scrolling temp date and time, no ible on that tho.
I m new to this instructables what did ible mean ? i create this ,it based on your stuff but its not ready now. <br> <br>https://www.instructables.com/id/Arduino-LCD-Thermometer-with-TMP36GZ-Temp-Sensor-b/
ible is short for Instructable
Hy i try to build it after your guid . But i miss the wires in the fritzing picture, on the Photo there are more wires. <br>The Serial monitor gives the feedback in farenheit and c&deg;c but it shows not the real tempratur it shows 65&deg;c but we have 19&deg;c.any solution? <br>Greatings.
Hi citin <br> <br>Great you have decided to build one of my projects. <br> <br>Your question is very vague on which wires so i will have to give the best answer i can. <br> Every picture has an explanation of where every wire goes. Maybe you did not see, but if you hover over a picture a drop down will appear with description of that individual picture. <br>Also in the code every wire is accounted for as it needs a place to go. <br> <br>For the incorrect temperature readings: Are you using an LM35 temp sensor? The LM335 is similar but will give different readings. <br>Has the code been altered? <br>Triple check the wiring!!! <br>Without more information i do not have any better answers. <br> <br>Let me know if you need more help as i will help the best i can and i would like to see your project also. <br> <br>Good Luck <br>Wayne <br>
now i know it wire 15 and 16 on the lcd display .. pos. gnd but didn't work i have to solder the wires to the lcd again. First time i did this , i thinks its bad work from me. <br>but not today i will try it tomorrow.

About This Instructable




Bio: Why would i buy something ready made when i can make it myself with half the features for twice the money? DIY!
More by WWC:3D Pinted Spool Reel Hard Drive Tachometer for a Desktop Computer 4093 Schmidt Trigger / Fan Speed Regulation 
Add instructable to: