Introduction: Home Automation Board With NODEMCU Six Outputs

About: Hello world;

Hello and welcome back!

This is a Home Automation Board that is based around the NODEMCU ESP8266 Board and Six Relays neatly packed in a nice form factor.

We can attach AC or even DC loads with this setup as each relay's NO and NC ports are connected to a screw terminal, which we can connect loads in series with. This DIY home automation system uses an ESP8266 to operate six separate relays to switch six outputs or loads.

Every relay is controlled via a web application that may be accessed through any local network browser.

This device is version 2 of my earlier home automation board, which featured an esp07S module and only had two outputs. Version 2's use of nodemcu makes it simpler for the user to reprogram the board.

https://www.instructables.com/Home-Automation-Board-With-ESP8266-Dual-Output/

The goal of this project is to make an easy and simple Home Automation System that anyone can make and learn by following a few simple steps.

let's get started.

Supplies

Following were the components used in this built-

  • Custom PCB
  • Relays
  • Nodemcu
  • AO3400 Mosfets
  • M7 Diodes
  • 10K resistors
  • SMD LEDs
  • AC to DC Isolated SMPS
  • Screw Terminal connectors

Step 1: PCB Design

PCB The design of this board consists of eight parts, six of which have a relay connected to an N-channel mosfet, whose gate is coupled to the NODEMCU of another section.

A LED is also attached to the relay along with the Mosfet; this LED serves as an indicator and will turn on when the relay is switched.

NODEMCU is located in one portion, and it is connected to six Mosfets and six LED pins.

Then, an isolated 240V AC to 5V DC SMPS is also attached to the board and connected with a screw terminal connector in order to power the entire arrangement with 240V AC. We will connect an AC cord to the SMPS's screw terminal in order to do this.

We prepare the board design and neatly organize all the components in a 120mm x 70mm form factor after the schematic is complete.

For isolation purposes, slots were inserted between the AC pins and the DC components.

A relay with a mosfet as a switch configuration and leds are located on the bottom half of the PCB, which also houses the SMPS on the right side.

Step 2: PCBWAY Service

After the PCB Design was completed, Gerber data was generated and then sent to PCBWAY for samples.

An order was placed for the PCBs with white soldermask and black silkscreen, as it looks pretty cool in general.

In terms of overall quality, it was outstanding. Each of the 10 boards I bought was flawless.

Really love the quality of PCBs made by PCBWAY. There are other manufacturers available, but their service is always on another level.

check out PCBWay service for getting great PCB service at less cost.

Step 3: Solderpaste and PNP Process

  • Board Assembly Process begins by first adding solder paste to each component pad one by one.
  • Next, using a tweezer, we pick and position each SMD component in its designated location.

Step 4: Hotplate Reflow

Following that, we carefully lifted the entire circuit board and set it down on the SMT Hotplate, which heats the PCB from below up to the solder paste melting temperature. As soon as the PCB reaches that temperature, the solder paste melts, and all the components are connected to their pads.

Step 5: THT Components

Next, we add THT components to their locations and solder the pads by using a soldering iron.

The board assembly is now complete.

Step 6: Result So Far

Here is the final result of the board assembly process: a rectangular, soldered Home Automation board with six relays and an SMPS power supply that can be connected to any setup (AC or DC) to make it into a smart controllable load.

Step 7: Adding Nodemcu to the Home AUT Board

The board is complete but is missing one of its most crucial components, which is the NOCEMCU board.

We add NODEMCU in its place through female header pins soldered onboard.

Step 8: Test Sketch

The test sketch, which is actually a chaser sketch, is uploaded to the ESP Board. Its main function is to sequentially toggle each output pin to show how the board functions.

Relays are connected with D0 to D5 and LED are connected with D6, D7, D8, TX, RX and GPIO8 of the Nodemcu.

The chaser sketch makes sure that each output is operational, allowing us to move on to the next step, which is attaching an AC cord to this arrangement and running the main code into it.

Step 9: Adding AC Cord

We connect the live and neutral ends of an AC cord to the screw terminals on the SMPS supply in order to power the board using an AC source.

Step 10: Main Sketch

Check out the main sketch, which is attached in the code section.

  • We first edit the SSID and PASSWORD in the sketch
  • next we upload the code into the NODEMCU and open the serial monitor.
  • We then copy the IP Address shown when the ESP gets connected to WiFi and paste the IP Address into any browser.
  • WEB APP will open up which can be used to toggle six outputs.

The web app is completely customized and is made completely from a single sketch without using any third-party tools.

This sketch is a fusion of classic embedded C language and HTML with a little bit of CSS.

We set up the HTML page in this sketch by the below lines.

// Display the HTML web page
client.println("<!DOCTYPE html><html>");
client.println("<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">");
client.println("<link rel=\"icon\" href=\"data:,\">");
// CSS to style the on/off buttons
// Feel free to change the background-color and font-size attributes to fit your preferences
client.println("<style>html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: center;}");
client.println(".button { background-color: #5B196A; border: none; color: white; padding: 16px 40px;");
client.println("text-decoration: none; font-size: 30px; margin: 2px; cursor: pointer;}");
client.println(".button2 {background-color: #5B196A;}</style></head>");

// Web Page Heading
client.println("<body><h1>HOME AUTOMATION DUAL OUTPUT</h1>");

// Display current state, and ON/OFF buttons for OUTPUT1
client.println("<p>LOAD1 - State " + output1State + "</p>");

Please note that this setup will only work if the ESP8266 and the device that you're browsing the APP on the same network.(LOCAL NETWORK OPERATION)

Step 11: Conclusion

This device can be connected to the MCB Box in our home to regulate a particular region or close to any lighting switch that controls at least six light outputs by using the wiring diagram that is included.

The way it works is also simple, relays are like physical switches, and we can add them in series with any light source or output. By changing the state of RELAY to HIGH or LOW, it can break or connect the circuit and control the load connected to it.

This is it for today, folks, Do leave a comment if you have any trouble setting up this project.

Check out my previous home automation projects if you're interested in this topic.

https://www.instructables.com/Home-Automation-Board-With-ESP8266-Dual-Output/

https://www.instructables.com/Home-Automation-Getting-Started-Guide/

Special thanks to PCBWAY for providing components that I've used in this project, check them out for getting all sorts of PCB or PCBA-related services for less cost.

Thanks and I will be back with a new project soon.