Go Down

Topic: Arduino Thermistor (Read 1 time) previous topic - next topic

uink

I am new to arduino, though i have worked with lilypad.  I need to hook my arduino uno to a 10K thermistor, and don't know how.  Do i have to use a resistor? Where on the breadboard do i put the components?
Thanks

Si

You have to make the thermistor one half of a potential divider.

There is a thread here about the calculation, as thermistors are not linear devices.

http://arduino.cc/forum/index.php/topic,51364.0.html
--
My New Arduino Book: http://www.arduinobook.com

Si

Quote
http://www.arduinoevilgenius.com/projects


I'm guessing you have loaded the sketch for the temperature logger, rather than the thermostat.

If you read the sketch code, you have to send 'g' on the serial monitor to start the logging, then after a few mins 'r' to read the results back.

This sketch writes data to EEPROM and all sorts of clever stuff. You will probably want to sorten it, or at least change the logging period to something faster.

--
My New Arduino Book: http://www.arduinobook.com

Si

I don't think it will be the components.

Read through the sketch and fish out the bit with the formula, and then just use that in a simpler sketch of your own, that just takes a reading and then Serial.println(myReading) to see what's happening.

Have a go and post your sketch back.
--
My New Arduino Book: http://www.arduinobook.com

uink

I edited the code like you said (I think).  I am terrible with programming.  It still just prints 'ready' and stays.  I am using 9600 baud.  I tried other bauds, but the just print one line of characters and nothing more. 
Thanks

Code: [Select]
// Project 13 - Temperature Logger
#include <EEPROM.h>


#define ledPin 13
#define analogPin 0
#define maxReadings 255
#define beta 4090 // from your thermistors datasheet
#define resistance 33


void setup()
{
   pinMode(ledPin, OUTPUT);
   Serial.begin(9600);
   Serial.println("Ready");
}

void loop()
{
  if (Serial.available())
  {
    char ch = Serial.read();
    if (ch == 'g' || ch == 'G')
    {

    }   
    else if (ch == 'x' || ch == 'X')
    {

      EEPROM.write(0, 0);
      Serial.println("Data cleared");
    }
    else if (ch == 'r' || ch == 'R')
   
    {
      Serial.println("Mode set to deg C");

    }
    else if (ch == 'f' or ch == 'F')
    {
      Serial.println("Mode set to deg F");

    }
    else if (ch == '?')
    {
      reportStatus();
    }
  }

   delay(1000);
}



void logReading()
{

  {
    long a = analogRead(analogPin);
    float temp = beta / (log(((1025.0 * resistance / a) - 33.0) / 33.0) + (beta / 298.0)) - 273.0;


  }

  {
    Serial.println("Full! logging stopped");

  }
}

void reportStatus()
{
Serial.println("----------------");
Serial.println("Status");
Serial.print("Sample period\t");

Serial.print("Num readings\t");

Serial.print("Mode degrees\t");

Serial.println("----------------");
}

Go Up