Hello everybody,
Disclaimer: I am not and electronics expert, my knowledge is limit so please bear with me
I'm doing some research to find the limit of a cooling solution i'm using. I'd would like to measure the temperature stability, not accuracy.
I ordered the Linear DC570A demoboard in the hopes I could hook up a 10K NTC thermistor to it very easily.
I was wrong. =(
I go the interface running using the following topic Link.
made some adjustments and got the following sketch
/*
Interface between Arduino DM board and Linear Tech LTC2440 24-bit ADC
Nov. 12 2010 John Beale
LTC2440 <----------> Arduino
11: /CS <- to digital pin 10 (SS pin)
7: MOSI <- to digital pin 11 (MOSI pin)
12: MISO -> to digital pin 12 (MISO pin)
13: SCLK <- to digital pin 13 (SCK pin)
10: /EXT - ground
1: GND - ground
2: VDD3 - 5V supply
*/
#include <SPI.h> // include the SPI library
// set I/O pins used in addition to clock, data in, data out
const byte slaveSelectPin = 10; // digital pin 10 for /CS
const byte resetPin = 9; // digital pin 9 for /RESET
const int nsamples = 5; // how many ADC readings to average together
// SPI_CLOCK_DIV16 gives me a 1.0 MHz SPI clock, with 16 MHz crystal on Arduino
void setup() {
Serial.begin(115200); // set up serial comm to PC at this baud rate
pinMode (slaveSelectPin, OUTPUT);
pinMode (resetPin, OUTPUT);
digitalWrite(slaveSelectPin,HIGH); // chip select is active low
digitalWrite(resetPin,HIGH); // reset is active low
SPI.begin(); // initialize SPI, covering MOSI,MISO,SCK signals
SPI.setBitOrder(MSBFIRST); // data is clocked in MSB first
SPI.setDataMode(SPI_MODE0); // SCLK idle low (CPOL=0), MOSI read on rising edge (CPHI=0)
SPI.setClockDivider(SPI_CLOCK_DIV16); // system clock = 16 MHz, chip max = 1 MHz
Serial.println("LTC2440 Test");
}
#include <math.h>
float vcc = 5.00; // only used for display purposes, if used
// set to the measured Vcc.
float pad = 10000; // balance/pad resistor value, set this to
// the measured resistance of your pad resistor
float thermr = 10000; // thermistor nominal resistance
float Thermistor(long RAWADC) {
long Resistance;
float Temp; // Dual-Purpose variable to save space.
Resistance=((16777216 * pad / RAWADC) - pad);
Temp = log(Resistance); // Saving the Log(resistance) so not to calculate it 4 times later
Temp = 1 / (0.000831166375923117 + (0.000256436021065264 * Temp) + (0.000000206045827449766 * Temp * Temp * Temp));
Temp = Temp - 273.15; // Convert Kelvin to Celsius
// BEGIN- Remove these lines for the function not to display anything
//Serial.print("ADC: ");
//Serial.print(sum);
//Serial.print("/1677216"); // Print out RAW ADC Number
//Serial.print(", vcc: ");
//Serial.print(vcc,2);
//Serial.print(", pad: ");
//Serial.print(pad/1000,3);
//Serial.print(" Kohms, Volts: ");
//Serial.print(((sum*vcc)/1677216.0),3);
//Serial.print(", Resistance: ");
//Serial.print(Resistance);
//Serial.print(" ohms, ");
// END- Remove these lines for the function not to display anything
// Uncomment this line for the function to return Fahrenheit instead.
//temp = (Temp * 9.0)/ 5.0 + 32.0; // Convert to Fahrenheit
return Temp; // Return the Temperature
}
// =============================================================================
// Main Loop:
// acquire 'nsamples' readings, convert to units of volts, and send out on serial port
void loop() {
int i;
long secs;
float mins;
double volts;
long in; // incoming serial 32-bit word
long sum = 0;
float temp;
long RAWADC;
for (i=0; i<nsamples; i++) {
in = SpiRead();
in &= 0x1FFFFFFF; // force high three bits to zero
in = in>>5; // truncate lowest 5 bits
sum += in;
delay(198); // (msec). Total Looptime: +2 msec (overhead for comms)
}
// volts = in * 2.5 / 8.388607; // 0x7fffff = 8388607
volts = sum * (0.2980232594); // microvolts
volts = volts / nsamples;
RAWADC = sum / nsamples;
mins = (float) millis() / 60000; // elapsed time in minutes
temp=Thermistor(RAWADC); // read ADC and convert it to Celsius
Serial.print(volts);
Serial.print(", ");
Serial.print(RAWADC);
Serial.print(", ");
Serial.println(temp,3); // display Celsius
} // end main loop
// =================================================================
// SpiRead() -- read out 4 bytes from LTC2440 chip via SPI interface
// =================================================================
long SpiRead(void) {
long result = 0;
long b;
// long result2 = 0;// MOSI/SDI pin 7 HIGH => 7 Hz, best resolution
digitalWrite(slaveSelectPin,LOW); // take the SS pin low to select the chip
delayMicroseconds(1); // probably not needed, only need 25 nsec delay
b = SPI.transfer(0xff); // B3
result = b<<8;
b = SPI.transfer(0xff); // B2
result |= b;
result = result<<8;
b = SPI.transfer(0xff); // B1
result |= b;
result = result<<8;
b = SPI.transfer(0xff); // B0
result |= b;
// take the SS pin high to de-select the chip:
digitalWrite(slaveSelectPin,HIGH);
return(result);
}
I get readings up to 25C and an RAWADC value of 16777216 /2
It will not go up further then this no matter how i connect the thermistor.
any other connection I tried doesn't give me the correct temperature.
I connected it to the DC570A as followed:
From REF+ to 10K Resistor
From 10K Resistor to 10K Thermistor
From 10K Resistor to IN+
From 10K Thermistor to IN –
IN- is connected straight to GND
Could I get some advice on how to get the full range of the 10K Thermistor?