Ask a parent, teacher, or trusted adult before building, powering a circuit, using tools or batteries, or buying parts. Purchases are optional and at your own cost. If anything gets hot, smells burnt, leaks, swells, sparks, or moves unexpectedly, switch off or disconnect power without touching the damaged or hot part, then tell an adult. Read safety rules

All projects
🚨🟢 Beginner 40 min

Temperature Alarm

A buzzer and flashing light that warn you when something gets too hot.

What You'll Build

This is an educational temperature indicator, not a certified alarm or safety device. It watches its surrounding air and sounds when the reading passes your chosen limit. Test it with warm hands or normal room-temperature changes, never against hot liquids, heaters, flames, people, pets, food, or anything where a missed warning could cause harm.

What You Need

  • ✓Arduino Uno
  • ✓TMP36 analog temperature sensor
  • ✓Piezo buzzer
  • ✓Red LED
  • ✓220Ω resistor

How It Works

A TMP36 sensor outputs a voltage that rises steadily with temperature — 10 millivolts per degree, offset by 500 millivolts at 0 °C. The Arduino reads that voltage on an analog pin, converts it to degrees, and compares it with a limit. If the reading is over the limit, the alarm code runs; otherwise everything stays quiet.

Before You Wire It

Ask a parent, teacher, or trusted adult before building, powering a circuit, using tools or batteries, or buying parts. Purchases are optional and at your own cost. If anything gets hot, smells burnt, leaks, swells, sparks, or moves unexpectedly, switch off or disconnect power without touching the damaged or hot part, then tell an adult. Read safety rules

Wiring

  1. 1Parts: TMP36 temperature sensor. This project uses a TMP36 only — do not substitute a DHT11. The TMP36 and DHT11 use different wiring and code; the TMP36 is an analog sensor read with analogRead, while the DHT11 is digital and needs the DHT library on a digital pin. Use the Weather Station project if you own a DHT11.
  2. 2TMP36 flat side facing you: left leg → 5V, middle → A0, right → GND.
  3. 3Passive piezo disc: one lead → pin 8 and the other → GND. If your buzzer is marked + and −, it is polarized: + → pin 8 and − → GND. Check its current rating; use a transistor driver if it needs more than an Arduino pin can supply.
  4. 4LED → pin 7 through a 220Ω resistor to GND.

Step-by-Step Instructions

  1. 1

    Wire the sensor the right way round

    TMP36 pinouts can differ from similar-looking sensors, so check the exact part marking and datasheet with an adult. A reversed sensor can get hot quickly. If you smell burning or notice heat, unplug power immediately and let the part cool before touching it.

  2. 2

    Convert volts to degrees

    Multiply the reading by 5.0 and divide by 1024 to get volts, then subtract 0.5 and multiply by 100 to get Celsius.

  3. 3

    Check against a real thermometer

    Compare your value with a room thermometer. If it is consistently off by a degree or two, add a small correction.

  4. 4

    Add the alarm

    Use tone() for the buzzer so you can choose the pitch, and flash the LED in the same rhythm.

  5. 5

    Set your limit

    Pick a threshold that makes sense for your test. 30 °C is easy to reach with warm hands.

Arduino Code

temperature-alarm.ino
const int SENSOR = A0;
const int BUZZER = 8;
const int LED = 7;
const float LIMIT = 30.0;   // degrees C

void setup() {
  pinMode(BUZZER, OUTPUT);
  pinMode(LED, OUTPUT);
  Serial.begin(9600);
}

float readCelsius() {
  float volts = analogRead(SENSOR) * 5.0 / 1024.0;
  return (volts - 0.5) * 100.0;
}

void loop() {
  float t = readCelsius();
  Serial.println(t);

  if (t > LIMIT) {
    tone(BUZZER, 1200);
    digitalWrite(LED, HIGH);
    delay(250);
    noTone(BUZZER);
    digitalWrite(LED, LOW);
    delay(250);
  } else {
    noTone(BUZZER);
    digitalWrite(LED, LOW);
    delay(500);
  }
}

Understanding the Code

float volts = analogRead(...) * 5.0 / 1024.0

Turns the 0–1023 number back into the actual voltage the sensor produced.

(volts - 0.5) * 100.0

The TMP36's own formula: remove the half-volt offset, then scale to degrees.

tone(BUZZER, 1200)

Plays a 1200 Hz note. Higher numbers sound more urgent.

noTone(BUZZER)

Stops the sound. Without it the buzzer would scream forever.

Challenges & Upgrades

Add a button that silences the alarm for one minute.
Show the temperature on an LCD alongside the alarm.
Add a second, lower threshold that warns when it gets too cold.

Troubleshooting

😖 Sensor reads about 500 °C

Fix: Your maths order is wrong, or the sensor is reversed. Check the wiring first.

😖 Buzzer is very quiet

Fix: Passive buzzers need tone(); active buzzers just need digitalWrite. Check which one you have.

Helpful Resources

Want extra help? Build a virtual circuit in Tinkercad or watch a video guide for this project. These are optional external resources.

Try it in Tinkercad

Open Tinkercad Circuits to recreate and test the circuit online before using real parts.

Open Tinkercad

Watch video guides

Browse video tutorials for this exact project and compare how each part is connected.

Find videos

Outside examples may use different pins or parts. Follow this page’s wiring and safety instructions if they do not match. Ask a trusted adult before following an outside guide or buying anything; external parts, advice, and costs are your responsibility.

Up next

🏠 Mini Smart Home

Build This