กลับไปหน้ารวมไฟล์
smart-plug-66c89f-en.md

Over-The-Air Grid Execution: The IoT Smart Plug

A bare Arduino blinking an LED on a desk is harmless. Taking an ESP8266, encasing it into a totally enclosed plastic wall box, and commanding it to physically intercept and switch 120 Volts / 15 Amps of terrifying AC Wall Power via Wi-Fi elevates engineering into extremely dangerous commercial territory. The IoT Smart Plug controls massive appliances (Space Heaters, Air Conditioners) using pure HTTP/MQTT packets!

stock_counter_lcd_setup_1772706693516.png

Enclosed Architecture Physics

When you build a device that plugs straight into a wall, you can't have a massive USB cable dangling out to power the tiny 3.3V Wi-Fi chip.

  1. The Smart Plug requires a deeply specialized, microscopic AC-to-DC Switch Mode Power Supply Module (SMPS) e.g., HLK-PM01.
  2. This terrifying little module solders directly to the 120V AC live wires and outputs a mathematically stable, flawlessly isolated 5V DC logic stream specifically to power the ESP8266!
  3. The Current Intercept: The AC Live wire is spliced completely in half. It runs straight through an enclosed 5V Electromechanical Relay Module (e.g., SRD-05VDC-SL-C).
  4. The ESP8266 simply sets its Digital Pin to HIGH! The relay loudly clicks, the magnetic coil engages the metal armature, and the 120V wall current violently rushes out into the plugged-in Heater Appliance!

Overriding Cloud Control LOCALLY

If the Smart Plug is running a blender, and the Internet goes down during a hurricane, the user must still be able to turn the blender off!

  • The design features a physical, local Tactile Push Button (Often a slick TTP223 Capacitive Touch Sensor under the plastic housing!).
  • The Arduino code executes critical "State Toggle" redundancy logic!
// The loop must check BOTH the Wi-Fi MQTT packet AND the Local Hardware array!
if (digitalRead(LocalTouchSensor) == HIGH || mqttCommand == "TOGGLE") {
  relayState = !relayState; // Physically invert the hardware state!
  digitalWrite(RelayPin, relayState); 
  delay(300); // Massive Debounce block so the touch sensor doesn't flicker!
}

Advanced Wall Requisites

  • ESP8266 NodeMCU or ESP-01S (ESP-01S is massively preferred here due to its microscopic size, fitting entirely inside the wall plug!).
  • Massive 5V Optically Isolated Relay Module (10-Amp / 250V AC Rated Minimum!).
  • HLK-PM01 5V AC/DC Power Supply Module.
  • (DANGER: This project directly manipulates lethal 120V/240V Mains Power. Any loose wire or poorly insulated trace touching the 3V logic side will literally explode the Wi-Fi chip and catch the wall on fire! DO NOT attempt without advanced high-voltage theory capability).

ข้อมูล Frontmatter ดั้งเดิม

title: "Smart Plug"
description: "High-Voltage Relay Architectures! Overcome terrifying ESP8266 logic-level routing explicitly commanding massive 10A / 120V AC Power Relays securely via encrypted Wi-Fi Web Dashboards and local capacitive touch logic arrays."
category: "Home Automation"
difficulty: "Advanced"