Datasheet

Gibberish is Displayed
This happens because the serial
monitor is receiving data at a
different speed than expected.
To fix this, click the pull-down
box that reads "*** baud" and
change it to "9600 baud".
27
CIRC-10
More details, where to buy more parts, where to ask more questions:
http://ardx.org/CIRC10
Nothing Seems to Happen
This program has no outward
indication it is working. To see
the results you must open the
Arduino IDE's serial monitor.
(instructions on previous page)
Outputting voltage: do this first revert to the original code then change:
Serial.println(temperature);
This is a simple matter of changing one line. Our
---->
Serial.print(temperature);
sensor outputs 10mv per degree centigrade so to get
Serial.println(" degrees centigrade");
voltage we simply display the result of getVoltage().
The change to the first line means when we next output it
delete the line temperature = (temperature - .5) * 100;
will appear on the same line, then we add the informative
Outputting degrees Fahrenheit:
text and a new line.
Again this is a simple change requiring only maths. To
Changing the serial speed:
If you ever wish to output a lot of data over the serial line
go degrees C ----> degrees F we use the formula:
( F = C * 1.8) + 32 )
time is of the essence. We are currently transmitting at 9600
add the line
baud but much faster speeds are possible. To change this
temperature =
(((temperature - .5) * 100)*1.8) + 32;
change the line:
Serial.begin(9600); ----> Serial.begin(115200);
before Serial.println(temperature);
Upload the sketch turn on the serial monitor, then change
More informative output:
the speed from 9600 baud to 115200 baud in the pull down
Let's add a message to the serial output to make what
menu. You are now transmitting data 12 times faster.
is appearing in the Serial Monitor more informative. To
Temperature Value is
Unchanging
Try pinching the sensor with
your fingers to heat it up or
pressing a bag of ice against it
to cool it down.
Download the Code from ( http://ardx.org/CODE10 )
(copy the text and paste it into an empty Arduino Sketch)
/* --------------------------------------------- void loop()
* | Arduino Experimentation Kit Example Code |
// run over and over again
* | CIRC-10 .: Temperature :. |
{
* ---------------------------------------------
float temperature = getVoltage(temperaturePin);
*
//getting the voltage reading from the
* A simple program to output the current temperature
//temperature sensor
* to the IDE's debug window
* For more details on this circuit:
temperature = (temperature - .5) * 100;//converting from 10
//TMP36 Pin Variables
mv
int temperaturePin = 0;//the analog pin the TMP36's
//per degree wit 500 mV offset to
//Vout pin is connected to
//degrees ((volatge - 500mV) times
//the resolution is
100)
//10 mV / degree centigrade
Serial.println(temperature); //printing the result
//(500 mV offset) to make
delay(1000); //waiting a second
//negative temperatures an
}
option
/*
void setup()
* getVoltage() - returns the voltage on the analog input
{
* defined by pin
Serial.begin(9600); //Start the serial connection
*/
//with the computer
float getVoltage(int pin){
//to view the result open the
return (analogRead(pin) * .004882814);//converting from a 0
//serial monitor
//to 1024 digital range
//last button beneath the file
// to 0 to 5 volts
//bar (looks like a box with an
//(each 1 reading equals ~ 5
//antenna)
millivolts
}
}
NOT WORKING? (3 things to try)
MAKING IT BETTER
CODE (no need to type everything in just click)
MORE, MORE, MORE: