Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Arduino Tutorial: 2 Sensor Temperature Display

  1. #1
    If you can't hack it, you don't own it! Oneslowz28's Avatar
    Join Date
    Mar 2007
    Location
    Aiken, Sc
    Posts
    5,084

    Default Arduino Tutorial: 2 Sensor Temperature Display

    Using your Arduino to read and display temperature is quite simple. For my Arduino Controlled PC Watercooling Information Center I needed to be able to read the temperature from 2 Bitspower Temperature Stop Fittings. After probing the temp sensors with my multi-meter I was able to tell that they were simple 10k thermistors. A quick search on the Arduino site gave me a starting point and below is the finished product.


    You need:





    Connecting the Temperature sensors.

    Lets start by connecting the 2 temperature sensors. To do this we need to connect 1 leg of each temperature sensor (or thermistor) to analog pins 0 and 1. Then you must connect each remaining leg to a 10k resistor and then to one of the arduinos ground pins.

    Connecting the LCD to the Arduino.

    Lets start by connecting power to the backlight. The 10k trimpot will be used to control the LCD's contrast.

    • 1.Connect LCD pin 16 to the Arduino's ground pin.
    • 2.Connect LCD pin 15 to the Arduino's 5v pin.
    • 3.Connect the 10K trimpots wiper (center pin) to LCD pin 3.
    • 4.Connect one of the remaining 2 legs of the trimpot to the Arduino's 5v pin.
    • 5.Conned the last remaining leg of the trim pot to the Arduino's ground pin.


    Now we can connect the data lines from the LCD to the Arduino.

    • 1.Connect LCD pin 1 to the Arduino's ground pin.
    • 2.Connect LCD pin 2 to the Arduino's 5V pin.
    • 3.Connect LCD pin 4 RS to Arduino digital pin 7.
    • 4.Connect LCD pin 5 RW to the Arduino's ground pin. (This is tied to ground because we are not reading any information from the LCD)
    • 5.Connect LCD pin 6 EN to Arduino digital pin 8
    • 6.Connect LCD pin 11 DB4 to Arduino digital pin 9
    • 7.Connect LCD pin 12 DB5 to Arduino digital pin 10
    • 8.Connect LCD pin 13 DB6 to Arduino digital pin 11
    • 9.Connect LCD pin 14 BD7 to Arduino digital pin 12




    Here is the the code. Thanks to OvRiDe for helping me with this.

    Code:
    //Arduino Controlled 2 sensor Temp Display. Uses 2 10k thermistors and a 10k pull up resistor. 
    //Code By Charles Gantt http://themakersworkbench.com
    //Code based on Thermistor2 Elaborate code found here http://www.arduino.cc/playground/ComponentLib/Thermistor2
    //This code was developed as a side project to my Call of Duty Modern Warfare 2 Case mod found at http://www.thebestcasescenario.com/forum/showthread.php?t=21320
    
    #include <LiquidCrystal.h>
    #include <math.h>
    LiquidCrystal lcd(7, 8, 9, 10, 11, 12);		  
    double Thermistor(int RawADC) {
      long Resistance;  
      double Temp;
      Resistance=((10240000/RawADC) - 10000);
      Temp = log(Resistance);
      Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));
      Temp = Temp - 273.15;
      return Temp;  
    }
    
    void printDouble(double val, byte precision) {
    
      lcd.print (int(val));
      if( precision > 0) {
        lcd.print(".");
        unsigned long frac, mult = 1;
        byte padding = precision -1;
        while(precision--) mult *=10;
        if(val >= 0) frac = (val - int(val)) * mult;
        else frac = (int(val) - val) * mult;
        unsigned long frac1 = frac;
        while(frac1 /= 10) padding--;
        while(padding--) Serial.print("0");
        lcd.print(frac,DEC) ;
      }
    }
    
    void setup() {
      Serial.begin(115200);
      lcd.begin(16, 2);
    }
    
    #define ThermistorPIN 0  
    #define Thermistor2PIN 1
    double temp;
    void loop() {
      lcd.setCursor(0, 0);
      temp=Thermistor(analogRead(ThermistorPIN));	  
      lcd.print("Sensor 1 ");
      printDouble(temp,2);
      lcd.print((char)223);   
      lcd.print("C   ");
      lcd.setCursor(0, 1);
      temp=Thermistor(analogRead(Thermistor2PIN));
      lcd.print("Sensor 2 ");
      printDouble(temp,2);
      lcd.print((char)223);   
      lcd.print("C   ");  
      delay(100);
    }
    Code sources
    http://www.arduino.cc/playground/Com...ib/Thermistor2
    http://www.arduino.cc/en/Reference/LiquidCrystal
    Last edited by Oneslowz28; 06-12-2010 at 12:17 AM.

  2. #2
    Its not cool till its watercooled. Fuganater's Avatar
    Join Date
    Oct 2007
    Location
    Kinshasa, DRC
    Posts
    2,843

    Default Re: Arduino Tutorial: 2 Sensor Temperature Display

    Oneslowz... how much to make me one?

  3. #3
    Resident 100HP water-cannon operator SXRguyinMA's Avatar
    Join Date
    Jun 2008
    Location
    MA
    Posts
    5,865

    Default Re: Arduino Tutorial: 2 Sensor Temperature Display

    I can make you one, they're cake what color LCD do you want? I'll get you a price

  4. #4
    Its not cool till its watercooled. Fuganater's Avatar
    Join Date
    Oct 2007
    Location
    Kinshasa, DRC
    Posts
    2,843

    Default Re: Arduino Tutorial: 2 Sensor Temperature Display

    Orange would be amazing... hopefully its not too expensive?

  5. #5
    Its not cool till its watercooled. Fuganater's Avatar
    Join Date
    Oct 2007
    Location
    Kinshasa, DRC
    Posts
    2,843

    Default Re: Arduino Tutorial: 2 Sensor Temperature Display

    And can you use inline sensors?

  6. #6
    Resident 100HP water-cannon operator SXRguyinMA's Avatar
    Join Date
    Jun 2008
    Location
    MA
    Posts
    5,865

    Default Re: Arduino Tutorial: 2 Sensor Temperature Display

    Red on Black:
    http://www.sparkfun.com/products/791

    Amber on Black:
    http://www.sparkfun.com/products/9054

    The sensors would be any standard 2-wire 10k thermistor, which most in-line watercooling temp probes are (I testes the Koolance one I got for Maximum Security, and it is). Alternatively, I've got a ton of the ones from the NZXT Sentry 2 fan controller you can use just as well.

    PM me if you're serious about me making one for you

  7. #7
    Fox Furry crenn's Avatar
    Join Date
    Apr 2005
    Location
    In the shadows behind you
    Posts
    4,067

    Default Re: Arduino Tutorial: 2 Sensor Temperature Display

    Maybe you should check some of these out: http://www.maxim-ic.com/datasheet/index.mvp/id/2812
    Antec Sonata II | Pioneer DVR-212
    Good news! You can follow my website or follow me on twitter!

  8. #8
    One Eye, Sixteen Cores. Kayin's Avatar
    Join Date
    Jun 2009
    Location
    Birmingham, AL
    Posts
    1,921

    Default Re: Arduino Tutorial: 2 Sensor Temperature Display

    Dallas one-wires, the industry standard for temp sensors. I need to get me a couple...
    Project:Mithril, sponsored by Petra's Tech Shop and Sidewinder Computers-MOTM Nominee October '08




  9. #9
    Mostly a nutcase CorsePerVita's Avatar
    Join Date
    Mar 2008
    Location
    Oregon!
    Posts
    426

    Default Re: Arduino Tutorial: 2 Sensor Temperature Display

    Curious... anyway to adapt something like this into a standalone setup, say, not attached to a computer?

  10. #10
    Resident 100HP water-cannon operator SXRguyinMA's Avatar
    Join Date
    Jun 2008
    Location
    MA
    Posts
    5,865

    Default Re: Arduino Tutorial: 2 Sensor Temperature Display

    it is standalone. once you program the arduino that's it, just needs a power source

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •