Freezer / fridge alarm

A DS18B20 probe inside the freezer; a buzzer and a message if the temperature rises or the door stays open.

Safety Board: ESP32 DevKit V1 (WROOM-32) Level: ●○○ ⏱ 1–2 h

Save the food, not the data

A freezer that stops during a long outage is worth a lot of money in food. This node tells you early, while you can still move things to a neighbour or add ice. A closed, full freezer usually stays cold for roughly a day or two without power, a half-empty one for less.

Avoiding false alarms

A bare probe reacts to every opening of the door and sends a warning each time. Put the tip into a small jar of glycerin or salty water: the thermal mass smooths short spikes. Then alert on a condition, such as "warmer than −10 °C for 45 minutes", not on a single reading. The thin cable of a DS18B20 passes under the door gasket; a flat cable seals better.

  • Send a second kind of message when the power goes: the sketch can watch the mains-detect input too.
  • Check the probe in a glass of ice water: it should show about 0 °C.
  • A small buzzer is useful, but the message is what you will actually notice when you are away.

Components

  • ESP32 DevKit V1 (30 pin, WROOM-32)
  • DS18B20 waterproof probe
  • Active buzzer module 5V
  • Resistor kit 1/4W (1k, 2k, 4.7k, 10k, 22k, 100k)

Wiring

Module Module pin ESP32 pin Note
DS18B20 DATA 1-Wire GPIO4 4.7 kΩ pull-up to 3V3
Buzzer signal GPIO25

Libraries

  • OneWire
  • DallasTemperature

Code

#include <WiFi.h>

const char* WIFI_SSID = "YOUR_WIFI";
const char* WIFI_PASS = "YOUR_PASSWORD";

bool connectWiFi(uint32_t timeoutMs = 20000) {
  WiFi.mode(WIFI_STA);
  WiFi.begin(WIFI_SSID, WIFI_PASS);
  uint32_t t0 = millis();
  while (WiFi.status() != WL_CONNECTED && millis() - t0 < timeoutMs) {
    delay(250);
    Serial.print(".");
  }
  Serial.println();
  if (WiFi.status() == WL_CONNECTED) {
    Serial.print("IP: ");
    Serial.println(WiFi.localIP());
    return true;
  }
  return false;
}
#include <WiFiClientSecure.h>
#include <HTTPClient.h>

const char* TG_TOKEN = "123456:ABC-YOUR-BOT-TOKEN";   // from @BotFather
const char* TG_CHAT  = "YOUR_CHAT_ID";

// Keep the text free of double quotes and line breaks (it is inserted into JSON).
bool telegramSend(const String& text) {
  if (WiFi.status() != WL_CONNECTED) return false;
  WiFiClientSecure client;
  client.setInsecure();   // simple; pin the certificate for production
  HTTPClient http;
  String url = String("https://api.telegram.org/bot") + TG_TOKEN + "/sendMessage";
  if (!http.begin(client, url)) return false;
  http.addHeader("Content-Type", "application/json");
  String body = String("{"chat_id":"") + TG_CHAT + "","text":"" + text + ""}";
  int code = http.POST(body);
  http.end();
  return code == 200;
}
#include <OneWire.h>
#include <DallasTemperature.h>
OneWire ow(4);
DallasTemperature ds(&ow);
const float LIMIT_C = -12.0;                  // alarm above this temperature
const uint32_t HOLD_MS = 15UL * 60UL * 1000UL; // ... for this long (door openings are normal)
uint32_t warmSince = 0; bool sent = false;
void setup() {
  pinMode(25, OUTPUT);
  Serial.begin(115200);
  ds.begin();
  connectWiFi();
}
void loop() {
  ds.requestTemperatures(); float t = ds.getTempCByIndex(0);
  Serial.println(t);
  bool warm = (t > -100) && t > LIMIT_C;
  if (t < -100) warm = true;                   // sensor fault is also an alarm
  if (warm) { if (!warmSince) warmSince = millis(); } else { warmSince = 0; sent = false; }
  bool alarm = warmSince && millis() - warmSince > HOLD_MS;
  digitalWrite(25, alarm ? HIGH : LOW);
  if (alarm && !sent) sent = telegramSend(String("Freezer too warm: ") + t + " C");
  delay(5000);
}

Build tips

  • Route the probe cable through the door seal so the door still closes.
  • Power the ESP32 and the Wi-Fi router from a UPS or power bank.

What you need

Buy the parts kit · Estimated total: $7.50

ESP32 DevKit V1 (30 pin, WROOM-32) × 1
$4.00
Buy at AliExpress Buy at Amazon.com
DS18B20 waterproof probe × 1
$1.50
Buy at AliExpress Buy at Amazon.com
Active buzzer module 5V × 1
$0.50
Buy at AliExpress Buy at Amazon.com
Resistor kit 1/4W (1k, 2k, 4.7k, 10k, 22k, 100k) × 1
$1.50
Buy at AliExpress Buy at Amazon.com
🇺🇦 Ukraine🌍 Other countries

Ukraine: we buy and sell these parts ourselves, order them on this site.

Some links are affiliate links: we may earn a commission at no extra cost to you.

Related ideas

⚠ Caution

A hobby gas sensor is not a certified alarm and does not replace a real gas or smoke detector.

Gas / smoke alarm (hobby)

MQ-2 sensor with a buzzer and a web page. A hobby add-on, not a certified detector.

  • Board ESP32 DevKit V1 (WROOM-32)
  • Level ●●○ Intermediate
  • Build time 1–2 h
Pick parts / kit
⚠ Caution

A hobby gas sensor is not a certified alarm and does not replace a real gas or smoke detector.

Carbon monoxide (CO) guard (hobby)

An MQ-7 sensor with a buzzer and display for a garage, boiler room or generator shed. A hobby add-on, not a certified CO alarm.

  • Board ESP32 DevKit V1 (WROOM-32)
  • Level ●●○ Intermediate
  • Build time 1–2 h
Pick parts / kit
⚠ Caution

Mains 220–230 V can kill. Work with the power off, use certified isolated modules in an enclosure, fuse the line, and ask a qualified electrician if you are not sure.

Refrigerator health monitor

A current clamp and a temperature probe tell how often and how long the compressor runs, and warn about a door left open or a failing fridge.

  • Board ESP32 DevKit V1 (WROOM-32)
  • Level ●●○ Intermediate
  • Build time 2–3 h
Pick parts / kit

← All module ideas →

Comments

No comments yet. Share your experience or ask a question.

Comments are moderated.