Go Down

### Topic: Duffer at Math it seems ! help (Read 983 times)previous topic - next topic

#### Fixador

##### Jan 29, 2011, 10:16 pm
Newbie here - with a Uno for xmas !

What I intend to do is measure the temperature distribution ( in magnitude and time ) in a pelleted 'soild' fuel as it burns down - inside a can ( with variable rates of air supplied from below ) .
I have added an arduino shield for measuring the output of 4 thermocouples - ( type K ) - from Ryan McLaughlin
Ultimate output is to an Excel spreadsheet - via PLX-DAQ - to plot a chart.

After much assistance from Ryan ! I have got the setup recording to Excel - with a sketch just to measure room temperatures.

However - there are perculiarities in PLX -DAQ - which I am struggling to modify the sketch to scale the Serial outputs to something PLX-DAQ will accept
Code: [Select]
`/*  Multi_Temp.pde - Example using the MAX6675 Library.  Created by Ryan McLaughlin <ryanjmclaughlin@gmail.com>*/#include <MAX6675.h>int LED1 = 6; // Status LED Pinint CS0 = 7; // CS pin on MAX6675int CS1 = 8; // CS pin on MAX6675int CS2 = 9; // CS pin on MAX6675int CS3 = 10; // CS pin on MAX6675int SO = 12; // SO pin of MAX6675int SCK = 13; // SCK pin of MAX6675int units = 1; // Units to readout temp (0 = ?F, 1 = ?C)float error1 = 0.0; // Temperature compensation errorfloat error2 = 0.0; // Temperature compensation errorfloat error3 = 0.0; // Temperature compensation errorfloat error4 = 0.0; // Temperature compensation errorint status = 0; // Varible to control the status ledfloat temp[4];MAX6675 temp0(CS0,SO,SCK,units,error1);MAX6675 temp1(CS1,SO,SCK,units,error2);MAX6675 temp2(CS2,SO,SCK,units,error3);MAX6675 temp3(CS3,SO,SCK,units,error4);// Setup Serial output and LED Pin  // MAX6675 Library already sets pin modes for MAX6675 chip!//Warning : PLX_DAQ only accepts data between values 11 and 199 : outside this range generates an error // So if attampting to read t/c from 1 to 1000 degC range will need to reduce intervals - say 10deg, so 200deg outputs as 20 - then have excel x10 // on interval 10deg: PLX range 11 to 199 : translates as 110deg to 1990deg - hmmmm ! //on interval 5 deg : PLX range 11 to 199 :translates as 22deg to 995 deg ! better ...could introduce a fixed offset of say +150 ie, y=mx+c : gives 172deg to 1145 deg //on interval 5 deg & offset = + 28 deg: PLX range 11 to 199 :translates as 27deg to 1023 degvoid setup() { Serial.begin(9600); pinMode(LED1, OUTPUT);}void loop() {  temp[0] = temp0.read_temp(5); // Read the temp 5 times and return the average value   temp[1] = temp1.read_temp(5); // Read the temp 5 times and return the average value   temp[2] = temp2.read_temp(5); // Read the temp 5 times and return the average value   temp[3] = temp3.read_temp(5); // Read the temp 5 times and return the average value       //  Serial.print("Temperature: \t"); // Print Header to Serial  Serial.print("DATA,TIME,TIMER");   // required by PLX-DAQ  for (int i=0; i<4; i++){ // Loop through each of the four temps    status = 0; // Reset the status to 0 before we check for errors    Serial.print(",");           // comma must precede each data for PLX-DAQ    if(temp[i] == -1) { // If there is an error with the TC, temperature will be -1      Serial.print("11"); // Temperature is -1 and there is a thermocouple error............. elect to send "999" for PLX-DAQ        status++; // Add to the status varible so status LED turns on    } else {      Serial.print(((temp[i]-28)/5));   // Print the temperature to Serial : algorithm for PLX-DAQ : temp range = 83 to 1023deg - its automatically truncated     // Serial.print((temp[i]));  // for a first test 11 to 199 deg C :t/c's at room temp    }    //Serial.print("\t");          // Print a tab to demininate the data  }   if(status > 0) {               // Check if we should turn on the status LED    digitalWrite(LED1, HIGH);    // Turn on the status LED  } else {    digitalWrite(LED1, LOW);     // Turn off the status LED  }  Serial.println(" ");  delay(2000);    // Wait two second before reading again}`

The room temperature test used
Code: [Select]
`Serial.print((temp[i]));  // for a first test 11 to 199 deg C :t/c's at room temp`

For testing in a small gas flame - off the cooker
Code: [Select]
`Serial.print(((temp[i]-28)/5));`

This adjustment all stems down to :-
Code: [Select]
`//Warning : PLX_DAQ only accepts data between values 11 and 199 : outside this range generates an error`

Unfortunately in Excel - I didnt get the flame temperatures. These are my readings:-

T/C#1 :  Excel reading = 171 degC    and from Multimeter reading = 820 degC
T/C#2 :  Excel reading = 165 degC    and from Multimeter reading = 830 degC
T/C#3 :  Excel reading = 175 degC    and from Multimeter reading = 840 degC
T/C#4 :  Excel reading = 158 degC    and from Multimeter reading = 825 degC

As it was a small flame - an I was holding the thermocouples in place with my hand - I am not concerned at the difference in readings say - the 4 Excel readings , or the 4 Multimeter readings - as a tiny movement of my fingers would cause a big temperature change.

But why is my Excel readings so low ?

Paul

#### PaulS

#1
##### Jan 29, 2011, 11:31 pm
Since you are dividing the reading by 5, in order to make PLX-DAQ (whatever that is) happy, presumably in Excel you need to multiply by 5 again, and add the 28 back.

#### Fixador

#2
##### Jan 29, 2011, 11:49 pm
O heck !   its been a long trip since xmas ! stumbled at the last - so to speak !

thank you PaulS

Go Up

Please enter a valid email to subscribe

### Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy