Components :
Tmp36 Temprature Sensor
Arduino Uno Board
Jumper Wires
Bread board
Theory: We will use the Arduino’s 5VDC power for this tutorial. Start by connecting a jumper wire from the Arduino’s 5VDC pin and running it to the sensor’s “pin 1”. Next, run another jumper wire from one of the Arduino’s ground pins to the sensor’s “pin 3”.
We are going to be using one of the Arduino’s analog input pins for this tutorial. Run a jumper wire from the sensor’s “pin 2” (the middle pin) to an analog input.
23o’s 5VDC power for this tutorial. Start by connecting a jumper wire from the Arduino’s 5VDC pin and running it to the sensor’s “pin 1”. Next, run another jumper wire from one of the Arduino’s ground pins to the sensor’s “pin 3”.. We are going to be using one of the Arduino’s analog input pins for this tutorial. Run a jumper wire from the sensor’s “pin 2” (the middle pin) to an analog input.
Connection:
Code:
int sensePin = A0; //This is the Arduino Pin that will read the sensor output int sensorInput; //The variable we will use to store the sensor input double temp; //The variable we will use to store temperature in degrees. void setup() { // put your setup code here, to run once: Serial.begin(9600); //Start the Serial Port at 9600 baud (default) } void loop() { // put your main code here, to run repeatedly: sensorInput = analogRead(A0); //read the analog sensor and store it temp = (double)sensorInput / 1024; //find percentage of input reading temp = temp * 5; //multiply by 5V to get voltage temp = temp - 0.5; //Subtract the offset temp = temp * 100; //Convert to degrees Serial.print("Current Temperature: "); Serial.println(temp); }