Our blog

We built a small heat-sensitive fire alarm from what you can find in the Arduino Starter-kit. Took us about 10min to set up the wiring, another 4-5min to code the alarm, and another 30min(!) to create this video.

Feel free to play around with the source code:

const int tempPin = A0;
const int soundPin = 8;
const float baselineTemp = 20.0;
int oldTemp = 0;

void setup() {
    for (int pin = 3; pin <= 5; pin++) {
      pinMode(pin, OUTPUT);
      digitalWrite(pin, 0);
    }
    digitalWrite(5, 1);
}

void loop() {
    int sensorVal = analogRead(tempPin);
  
    float voltage = (sensorVal/1024.0) * 5.0;
    float temperature = (voltage - .5) * 100;
  
    digitalWrite(3, 0);
    digitalWrite(4, 0);

    if (temperature > 25.0) {
        digitalWrite(4, 1);
    }
  
    if (temperature > 27.0) {
        tone(soundPin, temperature * (temperature / 2), 50);
        digitalWrite(3, 1);
    }
}