EcoRenovator  

Go Back   EcoRenovator > Improvements > Geothermal & Heat Pumps
Advanced Search
 


Blog 60+ Home Energy Saving Tips Recent Posts


 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 03-04-13, 05:50 AM   #8
Mikesolar
Master EcoRenovator
 
Mikesolar's Avatar
 
Join Date: Aug 2012
Location: Toronto
Posts: 958
Thanks: 40
Thanked 158 Times in 150 Posts
Default

Here is the current code which is purely a copied code from the Adafruit site "using a thermister". Then, I added the last line from Jeffs approach in bold. It seems to ignore the added code and continues to post in ohms. I am looking for a reason for this but the program doesn't come up with any errors.

Code:
// the value of the 'other' resistor
#define SERIESRESISTOR 10000    
 
// What pin to connect the sensor to
#define THERMISTORPIN A0 
 
void setup(void) {
  Serial.begin(9600);
}
 
void loop(void) {
  float reading;
 
  reading = analogRead(THERMISTORPIN);
 
  Serial.print("Analog reading "); 
  Serial.println(reading);
 
  // convert the value to resistance
  reading = (1023 / reading)  - 1;
  reading = SERIESRESISTOR / reading;
  Serial.print("Thermistor resistance "); 
  Serial.println(reading);
  
  float logcubed = log(reading);
logcubed = logcubed * logcubed * logcubed;
float kelvin = 1.0 / (-7.5e-4 + 6.23e-4 * log(reading) - 1.73e-6 * (logcubed));
float celsius = kelvin - 273.15;
 
  delay(1000);
}

Last edited by Piwoslaw; 03-04-13 at 01:55 PM..
Mikesolar is offline   Reply With Quote
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 12:56 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Ad Management by RedTyger
Inactive Reminders By Icora Web Design