0% found this document useful (0 votes)
27 views7 pages

Table of Contents Example

Uploaded by

MD Imran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views7 pages

Table of Contents Example

Uploaded by

MD Imran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Contents

1 Introduction 2
1.1 Brief Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 Materials and Equipment 2


2.1 List of Components . . . . . . . . . . . . . . . . . . . . . . . . . . 2

3 Circuit Connection 2
3.1 Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
3.2 Explanation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

4 Arduino Code 4
4.1 Code Explanation . . . . . . . . . . . . . . . . . . . . . . . . . . 4

5 Testing and Results 5


5.1 Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
5.2 Interpretation of Results . . . . . . . . . . . . . . . . . . . . . . . 6

6 Conclusion 7
6.1 Summary of Key Points . . . . . . . . . . . . . . . . . . . . . . . 7

7 Future Enhancements 7

8 References 7

1
1 Introduction
1.1 Brief Overview
This assignment demonstrates the interfacing of a TMP36 temperature sensor
with an Arduino microcontroller. The TMP36 sensor provides analog voltage
output proportional to temperature, which is converted and displayed on the
Serial Monitor using Arduino.

1.2 Objectives
To interface a temperature sensor with an Arduino board and measure temper-
ature readings accurately.

2 Materials and Equipment


2.1 List of Components
• Arduino board (e.g., Arduino Uno) 1

• TMP36 temperature sensor 1


• Jumper wires 3
• Breadboard 1

• USB cable (for powering the Arduino) 1

3 Circuit Connection
3.1 Diagram

2
Figure 1: Circuit Diagram

3
3.2 Explanation
The circuit connection involves connecting the TMP36 temperature sensor to
the Arduino as follows:
• Connect the TMP36’s left pin (VCC) to the Arduino’s 5V.

• Connect the TMP36’s middle pin (Vout) to an analog pin on the Arduino,
e.g., A0.
• Connect the TMP36’s right pin (GND) to the Arduino’s GND.
The Arduino is powered via USB connection to a computer.

4 Arduino Code

void setup() {
Serial.begin(9600);
pinMode(A0, INPUT);

void loop() {
float sensorValue = analogRead(A0);
float voltage = sensorValue * (5000.0 / 1024.0);
float tempCelsius = (voltage - 500.0) / 10.0;

Serial.print("Temperature in Celsius: ");


Serial.println(tempCelsius);

delay(1000);

4.1 Code Explanation


In the setup() function:

• Serial.begin(9600); initializes the serial communication at a baud rate


of 9600 bits per second. This allows us to communicate with and send
data to the computer via the Arduino’s USB connection.

• pinMode(A0, INPUT); sets analog pin A0 as an input. This pin will be


used to read analog voltage values from an external sensor.

4
In the loop() function:

• float sensorValue = analogRead(A0); reads the analog voltage from


pin A0 and stores it in the sensorValue variable. The analogRead()
function returns a value between 0 and 1023, representing the voltage
between 0 and 5 volts.
• float voltage = sensorValue * (5000.0 / 1024.0); calculates the volt-
age in millivolts (mV) by converting the analog value using the formula
(analog value * 5000 mV) / 1024. This formula scales the analog read-
ing to the actual voltage range.
• float tempCelsius = (voltage - 500.0) / 10.0; calculates the tem-
perature in degrees Celsius using the TMP36 temperature sensor’s linear
relationship between voltage and temperature. The sensor generates 10
mV per degree Celsius, and it has an offset of 500 mV when the temper-
ature is 0°C.
• Serial.print("Temperature in Celsius: "); sends a label to the Se-
rial Monitor, indicating that the following value is the temperature in
Celsius.

• Serial.println(tempCelsius); sends the temperature value (in Cel-


sius) to the Serial Monitor, followed by a line break.
• delay(1000); introduces a 1-second delay to control the rate at which
temperature readings are displayed. This delay prevents rapid and con-
tinuous output and makes it easier to read the data on the Serial Monitor.

5 Testing and Results


5.1 Output

5
Figure 2: Output

5.2 Interpretation of Results


The code successfully reads the analog voltage from the TMP36 sensor, converts
it into both Celsius and Fahrenheit temperature values, and displays these values
on the Serial Monitor. The displayed temperatures correspond to the ambient
temperature detected by the sensor.

6
6 Conclusion
6.1 Summary of Key Points
This Experiment demonstrated the successful interfacing of a TMP36 temper-
ature sensor with an Arduino microcontroller. By applying the appropriate
formula, the sensor’s analog voltage output was accurately converted into tem-
perature values in both Celsius and Fahrenheit. The results were displayed on
the Serial Monitor, providing a straightforward method for monitoring temper-
ature.

7 Future Enhancements
To further enhance this Experiment, the following improvements could be con-
sidered:

• Integration with an LCD display for standalone temperature monitoring.


• Data logging capabilities to record temperature values over time.
• Implementing temperature-based control systems for various applications.

8 References
• TMP36 Datasheet (Manufacturer’s Documentation)
• Arduino Official Website (https://www.arduino.cc/https://www.arduino.cc/)

You might also like