EasyManuals Logo

Arduino uno User Manual

Arduino uno
311 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #105 background imageLoading...
Page #105 background image
To use it, we only have to determine the current temperature t in Celsius. We
will use the TMP36 voltage output temperature sensor from Analog Devices.
3
Its cheap and easy to use.
To connect the TMP36 to the Arduino, connect the Arduinos ground and
power to the corresponding pins of the TMP36. Then connect the sensors
signal pin to the pin A0that is, the analog pin number 0:
As you mightve guessed from its vendors name, the TMP36 is an analog
device: it changes the voltage on its signal pin corresponding to the current
temperature. The higher the temperature, the higher the voltage. For us, its
an excellent opportunity to learn how to use the Arduinos analog IO pins.
So, lets see some code that uses the sensor:
InputDevices/Temperature/SensorTest/SensorTest.ino
const unsigned int TEMP_SENSOR_PIN = A0;
Line 1
const float SUPPLY_VOLTAGE = 5.0;
-
const unsigned int BAUD_RATE = 9600;
-
-
void setup() {
5
Serial.begin(BAUD_RATE);
-
}
-
-
void loop() {
-
const float tempC = get_temperature();
10
const float tempF = (tempC * 9.0 / 5.0) + 32.0;
-
Serial.print(tempC);
-
Serial.print(" C, ");
-
Serial.print(tempF);
-
Serial.println(" F");
15
delay(1000);
-
}
-
-
const float get_temperature() {
-
const int sensor_voltage = analogRead(TEMP_SENSOR_PIN);
20
const float voltage = sensor_voltage * SUPPLY_VOLTAGE / 1024;
-
return (voltage * 1000 - 500) / 10;
-
}
-
3.
http://tinyurl.com/msard-analog
report erratum discuss
Increasing Precision Using a Temperature Sensor 87
www.it-ebooks.info

Table of Contents

Other manuals for Arduino uno

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Arduino uno and is the answer not in the manual?

Arduino uno Specifications

General IconGeneral
Form factorArduino
CertificationRoHS, FC, CE
Processor model-
Processor frequency- MHz
Microcontroller modelATmega328
Microcontroller frequency16 MHz
DC input voltage7-12 V
Operating voltage5 V
DC current per I/O pin40 mA
Flash memory0.032 MB
Maximum internal memory- GB
SRAM (Static Random Access Memory)2 KB
EEPROM (Electrically Erasable Programmable Read-Only Memory)1 KB
Wi-FiNo
Number of analog I/O pins6
Number of digital I/O pins14
Weight and Dimensions IconWeight and Dimensions
Board dimensions53.4 x 68.6 mm

Related product manuals