Objective
This experiment uses the TMP36 temperature sensor to measure the ambient temperature.
Required Components
- TMP36 Temperature Sensor
- Arduino Board (e.g., Arduino Uno)
- Jumper wires
- Breadboard
Working Principle
The TMP36 sensor provides an analog voltage output that corresponds to the temperature, which can be read by the Arduino and converted to temperature in Celsius.
Wiring Instructions
Follow these steps to connect the UV sensor to the Arduino board:
- Locate the pins on your UV sensor: VCC, GND, and OUT.
- Connect the VCC pin of the UV sensor to the 5V pin on the Arduino to supply power to the sensor.
- Connect the GND pin of the UV sensor to any GND pin on the Arduino to complete the circuit.
- Connect the OUT pin of the UV sensor to the analog input pin A0 on the Arduino. This allows the Arduino to read the analog signal from the sensor.
Ensure all connections are secure and avoid reversing the pins, as this could damage the components. Double-check your wiring before powering the circuit.
Pro Tip: Use a breadboard for a more organized and stable setup, especially during prototyping.
Arduino Code
/*
* Temperature Measurement with TMP36
* This code reads the temperature from the TMP36 sensor.
*/
const int sensorPin = A0; // TMP36 sensor connected to analog pin A0
void setup() {
Serial.begin(9600); // Initialize serial communication
}
void loop() {
int sensorValue = analogRead(sensorPin); // Read the sensor value
float voltage = sensorValue * (5.0 / 1023.0); // Convert to voltage
float temperature = (voltage - 0.5) * 100; // Convert voltage to temperature
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
delay(1000); // Wait for 1 second before the next reading
}
Results
The serial monitor will display the temperature readings in Celsius.
Applications
- Environmental monitoring
- Weather stations
- Home automation systems
Conclusion
The TMP36 sensor is a reliable tool for measuring ambient temperature, with applications in environmental monitoring, weather stations, and home automation systems.