WI-Fi Controlled 4CH Relay Module for Home Automation

2,218

26

1

Introduction: WI-Fi Controlled 4CH Relay Module for Home Automation

About: Hobbyist

I have been using a many WI-FI Based on off Switches Previously. But those are not suit with my Requirement. That’s why I wanted to build my own, which can replace normal Wall Switch sockets without any Modifications. The ESP8266 Chip is Wifi enabled IoT platform for everyone. What I have done is created a four Channel relay board for it and the coolest part is that board also has a 100-240V-AC to 5V-DC Power supply on board so you will be able to connect it directly to AC mains while creating a Wifi enabled switch board. It also has a header where you will be able to connect Tx-RX based devices (Something like a Nextion Dispalys).

A brief specification of the board is as mentioned below

  • It comes with a header where you can plug TX-RX based devices & Connect TTL-USB Programmer for programme the ESP12E WI-FI chip.
  • Four Relays to connect four AC/DC loads and both NC/NO connectors of the relay are provided
  • Can be pre-programmed with Home automation integration.
  • 100-240VAC or 5VDC select able input.
  • Power : 3W
  • LED for Testing which is connected to a GPIO and also as indicator when the relay go on /off
  • Dimensions of the board are 76 x 76 mm

Supplies

1x Hi-Link HLK-PM01 (230V-5 VDC 3W)

1x ESP12E/ESP12F

4x PC817 Opt coupler

4x 5V Relay

4x D400 Transistor or any NPN Switching Transistors

1x AMS1117 - 3.3v

4x LED Yellow (SMD 1206)

1x LED RED (SMD 1206)

8x 10KΩ Resistor (SMD 1206)

4x 330Ω Resistor (SMD 1206)

1x 120Ω Resistor (SMD 1206)

2x Micro Switch

3x Screw Terminal 5mm pitch 2pin

Step 1: Selecting the Hardware

In addition, you should have a suitable soldering and measure set, which consists of a soldering iron, solder, (hot air soldering device), Multimeter and so on.

Tools:

  • Soldering Iron or better to use Hot air Gun
  • De soldering Pump
  • Wire Cutter and Stripper
  • Screw Driver
  • USB TTL Programmer (To upload program you have to use TTL converter or you can use Arduino UNO by removing Atmega328 as same as TTL convertor.)

Step 2: Design and Testing the Circuit

The first step after understanding how ESP12E work. I started by gathering all of the components I needed: 10K and 330 ohm resistors, NPN Transistors, Breadboard, Jumper wires. I followed along with a printout of the ESP12E. The process was tedious but I was able to get a working circuit diagram for the ESP Chip Stand Alone mode. I would tie the inputs high or low and used a multimeter to test the outputs. Now I was ready to translate the breadboard and schematic into to a PCB.

To design the PCB I used Autodesk EAGLE exclusively. There are other great programs like EasyEDA and Fritzing available to help design a PCB.

Step 3: Turn the Project Into an Actual PCB (Assembly and Soldering)

You can etch the PCB yourself at home. But I ordered the PCB with a professional manufacturer, which offer affordable prices and high quality manufacturing. Therefore, there is no reason to do so at home. Plus you will have a professional looking PCB created by you! The assembly and soldering of this project is quite simple.

First you solder all components (as in the pictures) on the board, but make sure that the SMD components are soldered in the correct orientation. You can recognize the correct direction by the white dots on the board. When you have finished soldering, do not under any circumstances connect the circuit board with current, as this could damage the components!
Started by placing and soldering the LEDs, then the resistors and the pin headers. I use a bit of solder flux paste to make the work easier. Solder paste makes the PCB dirty. To clean it, I use a cotton swab with acetone.

Step 4: Hardware Connection

To upload program you have to use TTL converter (showing below) or you can use Arduino UNO by removing Atmega328 as same as TTL convertor.

Make connection between WiFi Relay 4CH and TTL converter.

PCB ->TTL Converter Pin

VCC -> 3v3

GND->GND

DTR ->GND

RXD->TXDTXD->RXD

Step 5: Required Files

Step 6: Upload the Program

You have to install ESP boards to Arduino IDE before use ESP8266. So, please follow these steps.

  • Run Arduino IDE Go to File > Preference to Open preference window.
  • Paste https://arduino.esp8266.com/stable/package_esp8266com_index.json URL into the board manager URLs.

Step 7: Device in Action

Final Wiring & Trial of PCB

After upload the program, remove all TTL connection and power up by 100-240 V AC. Now your own Smart Switch is ready to use.

Hope this can be helpful for someone and learned as much as I did. You can use all the files shared here and have a go yourself.

Any comments are welcome, if you if you enjoyed it share your feedback or any improvements that may be done. Thanks everyone and see you soon.

Happy making!

PCB Design Challenge

Participated in the
PCB Design Challenge

Be the First to Share

    Recommendations

    • Fandom Contest

      Fandom Contest
    • Fruit and Veggies Speed Challenge

      Fruit and Veggies Speed Challenge
    • Summer Fun: Student Design Challenge

      Summer Fun: Student Design Challenge

    Comments

    0
    blackbird.0360
    blackbird.0360

    7 months ago

    Bonjour, Tres bel article merci; mais je crois que le programme ne traite que 2 relais (app1 et app2); je n'ai pas testé mais en lisant le programme je ne vois que 2 "OUTPUT".
    Encore merci