Arduino Flame Sensor Fire Alarm with Relay
Level 24 · Level 24 — Too Hot · 25 minutes
A threshold that closes a relay and sounds an alarm — switching a load the board cannot drive itself.

Preview the project free; a course seat is required to run and submit. No hardware kit needed.
Your project challenge
Sound the alarm on a flame, not a warm room. Wire it up: - Flame sensor: VCC to 5V, GND to GND, AOUT to A0 - Relay: VCC to 5V, GND to GND, IN to D7 - Buzzer: pin1 to D8, pin2 to GND Pick a threshold: 350 to 800. Past it: IN LOW, 1000Hz. Below: IN HIGH, silent.
Components you’ll use
- Arduino Uno
- Flame Sensor
- Relay Module
- Piezo Buzzer
What you’ll build
A fire alarm that clicks a relay on a flame. The relay’s switch side stays empty. The buzzer runs off a pin.
How it works
- A pin gives 20mA safely, 40mA before it dies.
- A relay is a coil your board can afford, plus a switch the coil moves.
- The flame sensor puts a voltage on A0.
analogRead()makes it0to1023. Nothing in it says “fire”.
The key idea
You draw the line. The warm room reads 307, the flame reads 870.
Pick anything from 350 to 800.
Where you put it is the difference between an alarm that ignores a candle across the room and one that goes off every time the sun moves.
⚠ Watch out
- The relay is ACTIVE LOW: LOW pulls the coil in, HIGH releases it. Your first sketch feels backwards.
- Forget the relay’s VCC and the pin toggles perfectly while the contact never moves.
- A fresh OUTPUT pin is LOW, and LOW is ON. Write HIGH before
pinMode(), or it clicks at boot. On a lamp that is a flicker. On a pump it is a burst of water.
The interactive editor includes the wiring guide, code editor and simulation controls.