STEP 1 / 6ESP + IOT

Control Sonoff Basic Switch with ESP Easy Firmware and Node- RED

432.Control Sonoff Basic Switch with ESP Easy Firmware and Node- RED You will gain the knowledge necessary to install the ESP Easy firmware on a Sonoff basic smart switch and utilize the…

Circuit Atlas themed schematic for Control Sonoff Basic Switch with ESP Easy Firmware and Node- RED
PROJECT#432
TRACKIoT
PARTS07
STAGES06
STEP 1 / 6 · Overview

Know the mission before touching a wire.

Understand what you are making, prepare the right tools, and make the workbench safe.

01

Project details

Control Sonoff Basic Switch with ESP Easy Firmware and Node- RED is a iot project. 432.Control Sonoff Basic Switch with ESP Easy Firmware and Node- RED You will gain the knowledge necessary to install the ESP Easy firmware on a Sonoff basic smart switch and utilize the…

Source pages
1050-1055
Named parts
7
Build goal
Working, tested prototype
02

Tools you need

  • Digital multimeter
  • Wire stripper and side cutters
  • Soldering iron with a fine tip
  • Current-limited bench supply
  • Computer with a data-capable USB cable

Use eye protection, good lighting, and a clean insulated surface throughout the build.

03

Safety precautions

  • Disconnect every power source before changing a connection.
  • Check component polarity, pinout, and supply voltage twice.
  • Use a current limit for the first power-up.
  • This project may involve hazardous voltage. Work only with qualified supervision and proper isolation.
Ready to continue?
STEP 2 / 6 · Parts library

Gather, identify, and understand every part.

Use the standardized inventory, then open What's this? to learn each part's role, advantages, limitations, handling, and specifications.

NAMED PROJECT INVENTORY7 PART LINES
PARTTYPEQTYREADY
PSmart Switch by Sonoff with Wi-FiPART1
What's this?Image, role, pros, cons, handling & specifications
Circuit Atlas themed schematic for Control Sonoff Basic Switch with ESP Easy Firmware and Node- REDPART LEARNING VIEW

Smart Switch by Sonoff with Wi-Fi

A named project component whose exact role is defined by the source circuit and build guide.

What it does here

It performs a documented electrical, control, interface, or construction function in this project.

Buy / compare this part

Advantages

  • Selected for this project
  • Can be checked independently
  • Supports modular troubleshooting

Limitations

  • Substitutes may differ
  • Generic names can hide variants
  • Pinouts and ratings vary

Handling

  • Compare the received part with the source
  • Keep it labelled
  • Do not force connectors or adjusters

Specifications to verify

  • Use the exact model, value, package, and rating listed for Smart Switch by Sonoff with Wi-Fi; similar-looking parts are not always interchangeable.
  • Confirm dimensions, ratings, connection method, polarity, and environmental limits.
PFTDI ProgrammerPART1
What's this?Image, role, pros, cons, handling & specifications
Circuit Atlas themed schematic for Control Sonoff Basic Switch with ESP Easy Firmware and Node- REDPART LEARNING VIEW

FTDI Programmer

A named project component whose exact role is defined by the source circuit and build guide.

What it does here

It performs a documented electrical, control, interface, or construction function in this project.

Buy / compare this part

Advantages

  • Selected for this project
  • Can be checked independently
  • Supports modular troubleshooting

Limitations

  • Substitutes may differ
  • Generic names can hide variants
  • Pinouts and ratings vary

Handling

  • Compare the received part with the source
  • Keep it labelled
  • Do not force connectors or adjusters

Specifications to verify

  • Use the exact model, value, package, and rating listed for FTDI Programmer; similar-looking parts are not always interchangeable.
  • Confirm dimensions, ratings, connection method, polarity, and environmental limits.
PRaspberry Pi Power Supply (Raspberry Pi) (5V 2.5A)POWER1
What's this?Image, role, pros, cons, handling & specifications
Circuit Atlas themed schematic for Control Sonoff Basic Switch with ESP Easy Firmware and Node- REDPOWER LEARNING VIEW

Raspberry Pi Power Supply (Raspberry Pi) (5V 2.5A)

A power component supplies, converts, stores, or regulates energy for the project.

What it does here

It must provide the documented voltage, polarity, isolation, and sufficient current safely.

Buy / compare this part

Advantages

  • Stable power improves reliability
  • Current limiting protects first tests
  • Regulation reduces resets and noise

Limitations

  • Wrong polarity can cause immediate damage
  • Underrated parts overheat
  • Mains circuits require qualified supervision

Handling

  • Measure output before connection
  • Use a fuse or current limit
  • Insulate exposed conductors

Specifications to verify

  • Use the exact model, value, package, and rating listed for Raspberry Pi Power Supply (Raspberry Pi) (5V 2.5A); similar-looking parts are not always interchangeable.
  • Confirm input/output voltage, current, polarity, connector, isolation, and thermal rating.
PAbout the SonoffPART1
What's this?Image, role, pros, cons, handling & specifications
Circuit Atlas themed schematic for Control Sonoff Basic Switch with ESP Easy Firmware and Node- REDPART LEARNING VIEW

About the Sonoff

A named project component whose exact role is defined by the source circuit and build guide.

What it does here

It performs a documented electrical, control, interface, or construction function in this project.

Buy / compare this part

Advantages

  • Selected for this project
  • Can be checked independently
  • Supports modular troubleshooting

Limitations

  • Substitutes may differ
  • Generic names can hide variants
  • Pinouts and ratings vary

Handling

  • Compare the received part with the source
  • Keep it labelled
  • Do not force connectors or adjusters

Specifications to verify

  • Use the exact model, value, package, and rating listed for About the Sonoff; similar-looking parts are not always interchangeable.
  • Confirm dimensions, ratings, connection method, polarity, and environmental limits.
Pseveral different brands of smart devices, including Sonoff products. ItPART1
What's this?Image, role, pros, cons, handling & specifications
Circuit Atlas themed schematic for Control Sonoff Basic Switch with ESP Easy Firmware and Node- REDPART LEARNING VIEW

several different brands of smart devices, including Sonoff products. It

A named project component whose exact role is defined by the source circuit and build guide.

What it does here

It performs a documented electrical, control, interface, or construction function in this project.

Buy / compare this part

Advantages

  • Selected for this project
  • Can be checked independently
  • Supports modular troubleshooting

Limitations

  • Substitutes may differ
  • Generic names can hide variants
  • Pinouts and ratings vary

Handling

  • Compare the received part with the source
  • Keep it labelled
  • Do not force connectors or adjusters

Specifications to verify

  • Use the exact model, value, package, and rating listed for several different brands of smart devices, including Sonoff products. It; similar-looking parts are not always interchangeable.
  • Confirm dimensions, ratings, connection method, polarity, and environmental limits.
MESP8266 - controller board / ICMODULE1
What's this?Image, role, pros, cons, handling & specifications
Circuit Atlas themed schematic for Control Sonoff Basic Switch with ESP Easy Firmware and Node- REDMODULE LEARNING VIEW

ESP8266 - controller board / IC

A programmable controller that reads inputs, makes decisions, and drives the project's outputs.

What it does here

It is the control centre and must use the documented board, pin map, supply, and logic level.

Buy / compare this part

Advantages

  • Reprogrammable and reusable
  • Large learning ecosystem
  • Complex behaviour remains changeable

Limitations

  • GPIO voltage and current are limited
  • Some pins affect boot or communication
  • Loads normally need a driver

Handling

  • Disconnect power before rewiring
  • Avoid static discharge
  • Never power motors, relays, or pumps directly from GPIO

Specifications to verify

  • Use the exact model, value, package, and rating listed for ESP8266 - controller board / IC; similar-looking parts are not always interchangeable.
  • Confirm operating voltage, logic level, pinout, memory, USB interface, and maximum GPIO current.
MESP32 - controller board / ICMODULE1
What's this?Image, role, pros, cons, handling & specifications
Circuit Atlas themed schematic for Control Sonoff Basic Switch with ESP Easy Firmware and Node- REDMODULE LEARNING VIEW

ESP32 - controller board / IC

A programmable controller that reads inputs, makes decisions, and drives the project's outputs.

What it does here

It is the control centre and must use the documented board, pin map, supply, and logic level.

Buy / compare this part

Advantages

  • Reprogrammable and reusable
  • Large learning ecosystem
  • Complex behaviour remains changeable

Limitations

  • GPIO voltage and current are limited
  • Some pins affect boot or communication
  • Loads normally need a driver

Handling

  • Disconnect power before rewiring
  • Avoid static discharge
  • Never power motors, relays, or pumps directly from GPIO

Specifications to verify

  • Use the exact model, value, package, and rating listed for ESP32 - controller board / IC; similar-looking parts are not always interchangeable.
  • Confirm operating voltage, logic level, pinout, memory, USB interface, and maximum GPIO current.
Ready to continue?
STEP 4 / 6 · Source code

Confirm the hardware-only control path.

This project does not include firmware in the source. The circuit itself provides the required behaviour.

01

How to connect

  1. Match every controller label to the circuit view and source pin map.
  2. Join grounds before signal wires when separate low-voltage supplies are used.
  3. Keep motors, relays, pumps, and other loads on a suitable driver and external supply.

Common mistakes

Reversed VCC/GND, board-label versus GPIO-number confusion, missing common ground, and charge-only USB cables.

Troubleshoot

Disconnect loads, continuity-test one path at a time, then test with a current limit.

02

Software preparation

No IDE, board package, library, or firmware upload is required for this project.

If you add a programmable controller as an extension, document its pin map separately.

03

How to upload code

The original design is implemented entirely in hardware, so proceed after verifying the circuit and supply.

Ready to continue?
STEP 5 / 6 · Build

Assemble, deploy, test, and troubleshoot.

Use the complete source notes in build order, then pass the final checks before calling the project finished.

ASSEMBLY

Build in functional stages

  • Power and regulation
  • Controller or processing stage
  • Inputs and sensors
  • Outputs and loads
  • Enclosure and strain relief
TEST

Power up safely

  • Inspect unpowered continuity first
  • Apply the lowest safe current limit
  • Measure supply rails before signals
  • Add one load at a time
  • Record expected and actual results
TROUBLESHOOT

Work from simple to complex

  • Confirm power, ground, polarity, and orientation
  • Compare each pin with the source
  • Test inputs separately from outputs
  • Replace only one variable at a time
  • Power off before every correction
PROJECT-SPECIFIC BUILD NOTES

Follow the documented instructions.

These notes come from this project's source and remain in their original order.

01

Project overview

Project build note

432.Control Sonoff Basic Switch with ESP Easy Firmware and Node- RED You will gain the knowledge necessary to install the ESP Easy firmware on a Sonoff basic smart switch and utilize the Node-RED dashboard to exercise control over the switch. On a Raspberry Pi, the Node-RED software is currently being executed. The ESP Easy firmware can also be coupled with various other home automation platforms, such as Home Assistant, Domoticz, openHAB, and so on.

02

Figure: Diagram provides a high-level summary of how the project is carried out.

Project build note

You will finish this project with a Sonoff that is loaded with the ESP Easy firmware and that can be controlled with HTTP GET requests made from a web browser or another Wi-Fi capable device. You will be able to integrate it with the majority of home automation platforms once you have finished configuring it on the ESPEasy web interface. In this demonstration, I'll be utilizing Node-RED, which will be running on a Raspberry Pi. After connecting a few nodes, you will see a button appear on your Node-RED dashboard that you can use to control the Sonoff.

03

Parts Required

Project build note

Smart Switch by Sonoff with Wi-Fi FTDI Programmer

Read more about the Raspberry Pi Board in our article about the Best Raspberry Pi Starter Kits. MicroSD Card with at least 8 GB and Class 10 speed Raspberry Pi Power Supply (Raspberry Pi) (5V 2.5A) About the Sonoff The Sonoff is a device that is connected in series with your home's power lines and gives you the ability to control any electronic appliance from a distance. The app platform known as Sonoff eWeLink is compatible with several different brands of smart devices, including Sonoff products. It enables connections between various types of smart hardware and integrates popular smart speakers like Google Home and Amazon Alexa. To explain it more simply, a Sonoff device consists of an ESP8266 chip that is connected to a relay. Through this method, you will be able to connect to the Sonoff via Wi-Fi in order to operate the relay. The eWeLink app can be used to take control of the Sonoff thanks to the firmware that comes preinstalled on the device. On the other hand, the majority of people favor flashing the Sonoff device with their own personal firmware, just as we will do in this project.

04

Safety warning

Project build note

During the process of uploading a new firmware, you need to ensure that your Sonoff is unplugged from the voltage supplied by the mains. When a Sonoff component is linked to mains voltage, you should never touch it in any way. After everything has been removed and disconnected, the plastic box enclosure of the Sonoff should be opened. Sonoff Pinout The Sonoff is supposed to be hacked, and you can see plainly that some connections were left out, so that you can solder some pins and install a modified firmware. The figure below depicts the pinout. Preparing 3.3V FTDI Programmer You need an FTDI programmer to upload a new firmware to your Sonoff. Use the schematics provided as a reference.

Warning: downloading a custom firmware is irrevocable and you’ll no longer be able to utilize the app eWeLink. I’ve placed a toggle switch in the power line, so that I can easily turn the Sonoff on and off to flash a new firmware without having to remove the FTDI programmer. I used hot glue to connect the ends of the wires together. This stops you from establishing erroneous connections between the FTDI programmer and the Sonoff in the future. Boot your Sonoff in Flashing Mode To flash a new firmware to your Sonoff, you have to boot your Sonoff in flashing mode. To accomplish this, proceed with the following four steps: 1. Establish a connection between your computer and the 3.3V FTDI programmer. 2. Keep your finger on the button for the Sonoff. 3. Keep your finger on the button for the Sonoff. 4. After that, you are free to let off of the button on the Sonoff. Now that your Sonoff ought to be in flashing mode, you should be able to transfer a fresh firmware onto it. ESP Easy Firmware

Read more about it on their wiki page, but the ESP Easy is a firmware that can be installed in any ESP module, whether it be an ESP-01, an ESP8266- 12E, an ESP32, or something else entirely. You won't need to write any code if you use this firmware because it gives you an easy way to configure your ESP module. After the firmware has been loaded, all of the setups, such as designating GPIOs as inputs, outputs, etc., are done in your browser using a graphical interface that is friendly to users.

Ready to continue?
PROJECT ACHIEVED

You built Control Sonoff Basic Switch with ESP Easy Firmware and Node- RED.

You followed the full workflow from understanding the mission to testing the finished project. That is a real engineering achievement - well done.

ESP8266 Daily Task - Publish Temperature Readings to ThingSpeak project thumbnail featuring ESP8266: for more information, see the article titled Best ESP8266, Wi-Fi Development Boards, humidity sensor
NEXT IOT ADVENTURE

ESP8266 Daily Task - Publish Temperature Readings to ThingSpeak

Ready to reuse what you learned in another project from the same track?

Start this project
Browse all 500 projects