How to build a ARDUINO controlled low temperature alarm with optional relay control

This ARDUINO beginners tutorial will show you how to build a simple circuit that will trigger a alarm if the temperature gets to low, you can also use the optional relay to control a fan or other device.

Click on the video below for full tutorial.

Check us out on Facebook!

Parts List:

#affiliate links#

ARDUINO Board

Thermistor

speaker

2N2222 Transistor

Resistors

Bread Board

jumper Wires

Project Box

Schematic:

low_temp_alarm_schem

ARDUINO Code:

#define thermistor A2 // thermistor on analog pin 2
int temp; // for storing the temp reading
#define alarm 715 // if temp falls below this number alarm will go off
#define relay 5

void setup() {
Serial.begin(9600); // start the serial for monitoring the temp value when configuring
pinMode(relay, OUTPUT);
}

void loop() {
temp = analogRead(thermistor); // read the thermistor
Serial.println(temp); // print reading to serial monitor for testing
delay(5000); // delay between readings

while (temp < alarm) // check for low temp
{
digitalWrite(relay, HIGH);
tone(3, 500, 500);
delay(500);
tone(3, 800, 500);
delay(500);
temp = analogRead(thermistor); // read the thermistor
Serial.println(temp); // for testing
}

digitalWrite(relay, LOW);
}