Home IoT Hub Series · 09
[Part 9] Did I leave the gas stove on? Burner-temperature safety node
Detect gas stove usage by measuring burner-side heat with a thermocouple.
This part detects gas-stove usage by measuring heat around the burner with a thermocouple module. It does not control gas; it only reports whether heat is present.
Keep the electronics away from direct flame and high heat. The thermocouple tip can be near the hot area, but the Wemos and MAX6675 module should stay protected.
![[Part 9] Did I leave the gas stove on? Burner-temperature safety node hero image](/iot-lab/assets/gas-stove-thermocouple-hero.png)
This article is part of the Home IoT Hub system connected to the central NodeMCU server built in Part 2: Building the Brain. A K-type thermocouple and MAX6675 module report whether the stove is in use based on burner-area temperature. The collected data is sent over the local
IoT_Hub_Net network and updates slot 6 for gas-stove use state on the central server (/set?no6=value), becoming part of the decision pipeline for the 20-channel smart-home controller.Parts and cost
| Part | Qty | Unit price |
|---|---|---|
| Wemos D1 Mini | 1 pc | $1.50 |
| K-type thermocouple + MAX6675 module | 1 set | $2.20 |
| Jumper wires | 5 pc | — |
| Total | $3.60 |
Pin wiring
Full code
#include <ESP8266WiFi.h> #include <ESP8266HTTPClient.h> #include <max6675.h> const char* ssid = "IoT_Hub_Net"; const char* password = "iothub1234"; const char* hubURL = "http://192.168.1.1"; #define SCK 14 // D5 #define CS 12 // D6 #define SO 13 // D7 #define SLOT_NO 6 #define THRESHOLD 50 // 50℃ note= note #define INTERVAL 5000 MAX6675 thermo(SCK, CS, SO); void setup() { Serial.begin(115200); WiFi.mode(WIFI_STA); WiFi.begin(ssid, password); Serial.print("Connecting to IoT_Hub_Net"); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println("\nConnected!"); } void loop() { float temp = thermo.readCelsius(); if (isnan(temp)) { Serial.println("Read error"); delay(2000); return; } int inUse = (temp > THRESHOLD) ? 1 : 0; Serial.print("Stove: "); Serial.print(temp); Serial.print(" C -> "); Serial.println(inUse ? "ON" : "OFF"); WiFiClient client; HTTPClient http; String url = String(hubURL) + "/set?no" + String(SLOT_NO) + "=" + String(inUse); http.begin(client, url); http.GET(); http.end(); Serial.println("HTTP -> " + url); delay(INTERVAL); }
Upload and check
Connect the Wemos D1 Mini to the PC with a USB data cable, select the ESP8266 board and port in the Arduino IDE, upload the sketch, then open Tools → Serial Monitor and set the baud rate to 115200.
Serial Monitor
After uploading, open Tools → Serial Monitor in the Arduino IDE and set the baud rate to 115200. The following is an example Serial Monitor flow for checking normal operation. This is not a real screenshot. It is an example output for checking MAX6675 readings and slot 6 updates.
[BOOT] Home IoT Node #09 - Gas stove thermocouple [SPI] MAX6675 ready, sample_avg=3 [SENSOR] burner_temp=36.4C [STATE] stove=OFF, spike_filter=PASS [HTTP] GET /set?no6=0 [HUB] 200 OK - slot no6=OFF [WARN] if burner_temp > 80C while away, send alert
- If
Connectedorconnectedappears, the Wi-Fi step passed. - If
HTTP 200or200 OKappears, the value reached the brain server. - If the value does not update, check both the slot number in the URL and the sensor wiring.
Build notes
- Test with a short heating period and watch the temperature rise. Decide your own threshold after seeing the normal idle and cooking values.
- Power on the hub brain first so the node can join
IoT_Hub_Net. - Use the same slot number written in the source code.
- Open the serial monitor at 115200 baud and confirm
HTTP 200. - If the value does not appear on the hub, recheck wiring, GPIO number, and Wi-Fi connection.
Uses for Gas-Stove Detection
Reading burner temperature with a K-type thermocouple and MAX6675, then treating above 50°C as 'cooking', turns a plain thermometer into a home-safety tool.
- Left-on-while-away detection: If 'cooking' stays active while the door sensor opens and no presence is detected, the hub sends a 'stove left on, you went out' alert.
- Cooking-time alerts: Log the moment 50°C is crossed; if it persists over 20-30 minutes, push a 'still simmering, please check' reminder to prevent scorching.
- Elderly / single-person safety: If no cooking signal appears all day, notify family as a wellbeing-check trigger.
- Automatic scenarios: If the threshold holds beyond 60 minutes, switch on the kitchen fan via a smart plug or voice-warn through a smart speaker.
Recommended Placement
- Never in the flame: A tip in the flame exceeds 800°C, past the MAX6675 range, and oxidizes the wire fast. Mount it 3-5cm to the side or above the burner, at the trivet (grate) edge so it catches pot radiation and rising hot air.
- Fixing: Clamp it firmly to a trivet leg with a stainless band or ceramic insulating tube so the tip cannot swing into the flame.
- Clearance from combustibles: Keep the lead at least 10cm from the burner and use heat-resistant insulation (fiberglass, PTFE). Place plastic connectors at a cool spot behind the countertop.
Troubleshooting checkpoints
The node code can look short, but real home installation is affected by placement, power, Wi-Fi quality, and sensor noise. Check these points before letting the node become a decision input for the brain server.
| Symptom | Likely cause | Field fix |
|---|---|---|
| The stove remains marked in use after flame-off | Residual heat in metal parts stays above the threshold | Use separate on/off thresholds and report off only after 3-5 minutes below the off threshold. |
| Temperature spikes randomly | MAX6675 SPI wiring picks up noise from ignition or power lines | Separate sensor and power wires and apply an average or median filter over at least three samples. |
| Cable insulation gets damaged | The thermocouple cable is too close to the burner or pot bottom | Expose only the sensor tip near heat and clip the cable away from direct heat. |
| Detection varies by cooking style | Low flame, residual heat, and covered pots create different heat patterns | Log serial values for the first few days and tune thresholds to the actual kitchen. |
Practical Tips and Cautions
- Threshold tuning: A summer kitchen can hit 35°C ambient, risking false positives. If 50°C is too low, raise it to 55-60°C or also watch the rising slope.
- Residual-heat lag: After the flame is off, the trivet and pot stay above threshold for minutes. Declare 'cooking done' only when temperature falls steadily for 5+ minutes.
- Resolution and noise: The MAX6675 has 0.25°C resolution and about a 0.22s SPI update. Smooth jitter with a 3-5 sample moving average and keep signal wires away from appliance power lines.
- Polarity and extension: K-type has (+)chromel/(-)alumel polarity; reversing it reads backwards. Always extend with K-type compensating cable, not plain copper.
- Burn safety: Install and inspect only with the flame off and everything cooled, and never touch the metal tip barehanded.
FAQ
Q. Does it work on induction? Induction heats the pot itself, so you catch the pot's radiant heat but response is slow. Gas-flame detection is far more accurate.
Q. Must the thermocouple touch the pot? No. Air and radiant heat alone suffice for a 50°C decision; direct contact damages the tip and hinders cooking.
Q. Readings look wrong after a power cut. The MAX6675 needs a few seconds for cold-junction settling. Discard the first few samples after restart.
This article is part of the 20-channel Home IoT system built from the Part 2 central brain server and the distributed edge nodes in Parts 3-19. Use this map to check the slot and sensor flow across the series.
[Part 1] Home IoT Hub overview[Part 2] Central brain server · slots 1-20[Part 3] Stop guessing room comfort · slots 1/2[Part 4] Did I close the door? · slots 9[Part 5] Is the fridge really cooling? · slots 12[Part 6] Should I open the window? · slots 3[Part 7] Stop bathroom mold before it starts · slots 19[Part 8] Is the boiler actually running? · slots 5/17[Part 9] Did I leave the gas stove on? · slots 6[Part 10] Get warned before gas smell becomes obvious · slots 7[Part 11] Catch flame signs while away from home · slots 8[Part 12] Is bad air making you foggy? · slots 13/14[Part 13] Why is the power bill so high? · slots 15[Part 14] Is water leaking, and how much are we using? · slots 16[Part 15] Do not leave windows open in the rain · slots 18[Part 16] Are the lights off and the door locked? · slots 11/10[Part 17] Control the air conditioner from the IoT hub · slots 4[Part 18] Is the dog bowl empty? · slots 20[Part 19] Cool the room only when someone is there · slots 1/4[Part 20] The house finally fits on one screen · slots all