SACC

/ / navigation


First Circuit
Part 2


/ / Introduction



A thermistor looks similar to a three legged transistor. It's three pins correspond to GND, signal and 5V. It is easy to use. The way it works is that it puts out 10 millivolts per degree centigrade on the signal pin. To allow measuring temperatures below freezing there is a 500mV offset

25°C=750mV
0°C=500mV

To convert this from the digital value to degrees you use Arduino's ability to do some math. To display the temperature, you'll use the Serial Monitor.

Here is the schematic


After you wire the circuit, complete and upload the code:
   The Code: - http://tinyurl.com/dfj8rs
/* 
 *  A simple program to output the current temperature 
 *  to the IDE's debug window  
 *  For more details on this circuit: 
 *  http://tinyurl.com/c89tvd  */


int temperaturePin = 0;
float temperatureVoltage;

void setup(){
  Serial.begin(9600);  
}
 
void loop(){
 float temperature = getVoltage(temperaturePin);  

//converting from 10 mv
//per degree with 500 mV offset to
//degrees ((volatge - 500mV) times 100)
temperaureVoltage=temperature;
temperature = (temperature - .5) * 100;


//print the temperature and temperatureVoltage to the Serial Monitor
__________________
Serial.println("degrees in centigrade");

__________________
Serial.println("output in voltage");


//wait a second
__________________
}

/*
 * getVoltage() - returns the voltage on the analog input 
 * defined by pin
 */
float getVoltage(int pin){

/*converting from a 0 to 1024 digital range
* to 0 to 5 volts (each 1 reading equals ~ 5 millivolts
*/
      return (analogRead(pin) * .004882814);

}

This is the formula to convert Centigrade to fahrenheit:
F = (C * 1.8) + 32 )
Modify the code above to print the temperature in fahrenheit.