temperature formula found

so last night i was working on the whole brewery monitoring device and getting the degrees F of the probe.

I found out that it was incredibly easy. so the arduino card on the analog read gets a value in increments of (5/1024) or 0.0048828125V. the reported value returns how many steps of that voltage it is reporting. so the actual value is like 315 for about 34F and 348 for 66F.

after staring at that for a while, i was trying to hard to figure out a formula. then out of more of a desperation move, i thought, i wonder what the difference is. After some subtracting I found that it seems to be reporting the degrees F + 282.

so in short, its the reported value – 282 = degrees F. so now my code looks like this

int pin = 0; // analog pin
int tempf=0; // temperature variable
int samples[10]; // variables to make a better precision
int serialByte = 0;//incoming serial byte
int i;

void setup()
{
  Serial.begin(57600); // start serial communication
}
void loop()
{
  if (Serial.available() > 0) {
    serialByte = Serial.read();
    //do not allow other pins to be read.
    if(serialByte >=48 && serialByte <= 53) {
      //get multiples and take average for more stable reading
      for(i = 0;i<=9;i++){
        samples[i]=analogRead(serialByte);
        tempf = tempf + samples[i];
        //has a 10 second read period for the average
        delay(1000);
      }
      int temp = (tempf/10)-282;
      tempf=0;
      //return the degrees F.
      //will automatically be sent through xbee
      Serial.println(temp);
    }
  }
}

now just have to do the web portal code and the windows app to upload to the database the web portal reads from.
and my code tags dont seem to work…

Advertisements

Leave a comment

No comments yet.

Comments RSS TrackBack Identifier URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s