Saturday, November 3, 2012

Temperature Measurement Assignment


11/2/2012
Temperature Measurement Assignment 
    
          As I continue further and further into my education to become a mechanical engineer, I often wonder, “What do I need to know in order to become an extraordinarily good (or at least a proficient) mechanical engineer?”  Recently I have begun learning some computer programming in my Mechanical Engineering 223 (Technology Design) class.  It is important for me to learn computer programming for a couple of reasons.  It gives me more tools to use when analyzing things, designing products, or operating mechanisms.  In the end this saves me enormous amounts of time and allows me to create much better products. 

          When contemplating how do design a sketch for the Arduino that would enable me to easily reach my goal of measuring and recording temperature measurements in three different scenarios, I decided that I would need to do some knowledge construction (i.e. finding the best source of knowledge out there, figuring out the knowledge, and applying it to my situation).  I did this by consulting our ARDX kit’s “Experimenter’s Guide for Arduino”, which gave me an already-designed sketch for recording temperature with an Arduino.  I also consulted Adafruit Tutorials as to their method for programming an Arduino to record temperature data.  This knowledge construction allowed me to create my own sketch, basing it off of the ARDX sketch, in a very short amount of time.  The most efficient and stress-free method for engineers to address problems is to use knowledge construction and build off of already-developed ideas (i.e. don’t “reinvent the wheel”).

The Arduino sketch that I developed to record temperature data is as follows:

/* A simple program to output the current temperature to the IDE's debug window 
 * This sketch has the ability to output temperature is celcius, 
 fahrenheit, or Kelvin, or any combination of the three.
 *  To activate the different temperature readings simply erase the 
 comment indicator(s) (i.e. * / and / * ) for the reading(s) you want
 */

//TMP36 Pin Variables
int temperaturePin = 0; //the analog pin the TMP36's Vout (sense) pin is connected to
                        //the resolution is 10 mV / degree centigrade 
                        //(500 mV offset) to make negative temperatures an option

/*
 * setup() - this function runs once when you turn your Arduino on
 * We initialize the serial connection with the computer
 */
void setup()
{
  Serial.begin(9600);  //Start the serial connection with the copmuter
                       //to view the result open the serial monitor 
                       //last button beneath the file bar (looks like a box with an antenae)
}

void loop()                     // run over and over again
{
  //the following prints temperature in celcius
 float temperature = getVoltage(temperaturePin);  //getting the voltage reading from the temperature sensor
 temperature = (temperature - .5) * 100;          //converting from 10 mv per degree wit 500 mV offset
                                                  //to degrees ((volatge - 500mV) times 100)
 Serial.println(temperature);                     //printing the result
 Serial.println("degrees Centigrade");


// the following prints temperature in fahrenheit

/* float temperaturef = getVoltage(temperaturePin);  // getting the voltage reading from the temperature sensor 
temperaturef = ((((temperaturef - .5) * 100)*1.8) + 32);  //converting from celsius to fahrenheit
 Serial.println(temperaturef);                        // printing the result
 Serial.println("degrees Fahrenheit");                 // printing label for value
*/

//the following prints temperature in Kelvin

/*float temperaturek = getVoltage(temperaturePin);    //getting the voltage from the temperature sensor
temperaturek = (((temperaturek -.5)*100) + 273.15);          // converting from celsius to kelvin
Serial.println(temperaturek);                    // printing the result
Serial.println("degrees Kelvin");               // printing label for value
*/

 delay(2000);                                     //waiting a second
}

/*
 * getVoltage() - returns the voltage on the analog input defined by
 * pin
 */
float getVoltage(int pin){
 return (analogRead(pin) * .004882814); //converting from a 0 to 1023 digital range
                                        // to 0 to 5 volts (each 1 reading equals ~ 5 millivolts
}

Recorded Data: 

Degrees in Celcius
Temperature of wall of cup filled with hot water  (data every 3 seconds)
Temperature of metal razor blade on ice cube (data every 2 seconds)
Temperature of heavy paper held over toaster (data every 2 seconds)
17.38
18.36
21.78
22.75
24.71
25.68
27.15
28.13
28.13
29.59
29.59
30.08
30.08
31.05
31.05
31.54
33.01
33.01
33.01
33.01
33.50
33.50
33.98
33.98
33.98
34.47
34.96
34.96
22.75
22.75
22.75
22.27
21.78
20.80
20.31
19.34
18.85
17.38
16.41
15.43
14.94
14.45
13.48
13.48
12.99
12.50
12.50
12.50
12.01
12.01
11.52
11.52
11.52
11.04
11.04
11.04
19.82
19.82
20.80
20.80
21.78
22.75
23.73
25.20
26.17
27.64
29.10
30.57
32.52
31.54
31.54
33.98
36.91
38.38
39.36
40.82
42.29
43.75
44.73
45.70
47.17


           

             Perhaps the most exciting feature of this sketch, which sets it apart from the ARDX code and the Adafruit sketch is its ability to measure temperature not only in Celsius (centigrade), but also in Fahrenheit and Kelvin.  All three print options are found in the loop section of the sketch, however currently the Fahrenheit and Kelvin options are deactivated by being turned into comments.  To activate them, one only has to delete the comment indicators (i.e. /* and */ ).  I chose to include these options since, as engineers, we often have to deal with all three different temperature, so having the option to record data in any one (or all) of different forms is extremely handy.
           
            In retrospect, there were some things I did well and some things that could be improved on.  As was mentioned earlier, using knowledge construction to help build my sketch allowed me to be efficient as well as lowering my stress level.  One thing that I could have done better, however, would have been to make a written plan of action, i.e. to write out my plan before executing it.  Although the benefits of having a written plan of action to follow have been clearly displayed in other projects and experiments, I didn’t take the time to do it on this project and suffered some because of it.  




No comments:

Post a Comment