กลับไปหน้ารวมไฟล์
connect-sonoff-basic-switch-to-the-arduino-iot-cloud-e62051-en.md

Hardware Hacking: Reprogramming Sonoff

The Sonoff Basic is a ubiquitous, $5 Wi-Fi smart switch that controls 220V mains power. Most people use the default "eWeLink" app. However, under the plastic casing, the Sonoff is secretly just an ESP8266 chip—which means you can completely erase its memory and install your own Arduino code!

invisible_mess_glasses_relay_schema_1772681179521.png

The Flashing Process (Overwriting Firmware)

To regain control of the hardware:

  1. Open the Case: You solder four header pins (3.3V, RX, TX, GND) onto the Sonoff's circuit board.
  2. The FTDI Adapter: You connect those pins to a USB-to-TTL Serial adapter plugged into your PC. Never plug the Sonoff into mains AC power during this process!
  3. Bootloader Mode: You hold down the physical button on the Sonoff while plugging in the USB to put the ESP8266 into "Flash Mode."
  4. The Upload: You hit "Upload" in the Arduino IDE, writing your custom code completely over the factory software.

Connecting to Arduino Cloud

Once flashed, the Sonoff works exactly like a NodeMCU.

  • You configure it on the Arduino IoT Cloud dashboard.
  • You link a digital cloud button to digital pin 12 (the pin connected to the Sonoff's internal relay).
  • Now, you have a globally controlled smart switch that runs your secure code, totally free from third-party server tracking!

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

title: "Connect Sonoff Basic to Arduino IoT Cloud"
description: "Hack your home appliances! Learn how to flash custom Arduino firmware onto a commercial Sonoff smart switch to bypass proprietary eco-systems."
category: "Home Automation"
difficulty: "Advanced"