Brutus. On the Web.

Arduino Temperature Display

August 18th, 2008
No Gravatar

This was more of a proof of concept, a “I can do it” sort of project. I had purchased the LM35 so long ago with plans to use it with a PicMicro.

I had purchased a couple of the Freeduino SB boards from Solarbotics, and found that I liked the quick/rapid prototyping it offers. Its my first experience with the Arduinos, and apart from limited availability of the microcontroller, and an incorrect capacitor on the power supply, I’ve been pleasantly surprised.

I actually desoldered the capacitor out of the circuit to regain full voltage control of the board, and for future ones I’ll also have to desolder the vreg, since I prefer to use a switchmode and I’ll bypass some of the board control with my switch to save battery power.

LM35 is hooked up into Analog 0, and the reference is set to internal, which switches the 5V reference to 1.1V. Measured with my DMM, it was closer to 1.043 and that is so close to the magic 1.024 number that the raw value is closer to the true reading from the LM35.

The LCD is the SLCD162 MeLabs LCD Display, which I also picked up from Solarbotics.

The LM35 is taped to an old northbridge heatsink, which provides a closer “In Air” reading.

I’ll be tearing apart this circuit to use the microcontroller in another project, but at least it will have some memory resting here on the site.


9 Responses to “Arduino Temperature Display”

  1. RobertNo Gravatar

    I am trying to duplicate your setup but can’t figure out how you have the LCD hooked up. Is it connected through the I2C interface? I currently have my arduino reading the LM35 and turning a relay on/off which controls the internal temperature of my home built kegerator. I found your work on interfacing an LCD and though it would be perfect for displaying the actual temp of the beer. Thanks for any help you can offer!

  2. RobertNo Gravatar

    Upon closer examination I determined you are interfacing using the Asynchronous RS232 connection, but when I hook everything up and compile the code I get strange random characters on the LCD. I have the same panel as you have, so is there something different I need to do to the lcd to get it to display correctly? Thanks!

  3. BRuTuSNo Gravatar

    If I recall correctly I had to check the little solder bridge jumpers on the LCD. You have to set the LCD for TTL serial communication instead of RS232 so that the voltages and inversion are correct for the microcontroller.

  4. RobertNo Gravatar

    Just figured that out; bridging J3…. it was driving me nuts! Thanks for the info though.

    I have another question about the sendLcd commands you use… where do you find them?
    Is there a data sheet or another resource that explains what each of the command do? I’ve haven’t been able to find any similar programs that use commands for serial LCD communication and can’t find any resources on how to write command for it either. Most everything is uses the CrystalLcd libraries or similar….

    Two things I eventually want to are add a momentary switch that will turn the back-light on for 10 seconds then turn off and also convert Celsius to Fahrenheit.
    I wrote some code for the C to F conversion that works fine but I can figure out an equation to get the output as a decimal as you have for Celsius….

    Thanks again!

  5. RobertNo Gravatar

    Think I might have answered my own question… you have to convert the hex command to regular decimal…. hex value “fe” is decimal “254” … so sendLcd(254); sendLcd(1) is just the decimal for the hex val to clear the LCD…

  6. BRuTuSNo Gravatar

    Yes Sir – Hex to Decimal is how I did it in my program.

    the SendLCD command really was just for a tiny bit less typing on my part 😉 What I perhaps should have done was modify that function to accept a hex value and convert/send it in decimal.. would have saved me some of the lookup conversions I did by hand.

  7. RobertNo Gravatar

    I found your sketch and have been hacking it up to fit my purpose… it’s getting nice and messy now… hehe.. I’m a hardware guy so software is a different world to me….

    Have a question about the conversion part… what does the “if” statement do?

    temp = lm35_val; //gets mV reading from LM35 center leg…
    temp1=temp/10; // divide by 10 to get “true” Celsius reading
    temp2=temp%10; //modulo operation for extra variable of accuracy

    if (temp2 >= 5) //not sure what this part does…….????

  8. BRuTuSNo Gravatar

    Could not find a rounding function in the Arduino software so I made my own 😉

  9. RobertNo Gravatar

    Thanks for your help… I finished my project and wrote up a quick instructable about it…
    Had some outside help re-writing the code to use millis() instead of Delays…. check it out!

Leave a Reply

You must be logged in to post a comment.

Proudly powered by WordPress.
Copyright © Brutusweb. All rights reserved.