Wifi Two Triac Dimmer Board





Introduction: Wifi Two Triac Dimmer Board

This instructable is for ARMTRONIX WIFI Two Triac Dimmer Board V0.1

Armtronix Wifi two triac dimmer is an IOT board. It is designed for home automation. The features of the board are:

  1. Wireless control
  2. Small form factor
  3. On board AC to DC power supp1y 230VAC to 5V DC.
  4. DC virtual switch
  5. Two channels(one for on and off another for dimming)

The size of the board is 84mmX39mm and with box size 114 mmX44mm, as shown in diagram1, it has a capacity to drive upto 1 Amp load. The board has a Wifi module(Esp 12F) and microcontroller (atmega328p) same as that used in Arduino Uno , which is used to control the triac through HTTP or MQTT mode . The board has two DC virtual switches which can be used to control the two Triacs.

The board also has a Power module (AC to DC converter) capable of handling 100-240 VAC as input and gives an output of 5V 0.6A. There are two triac( BT136) and Terminal connector. There is Zero cross detection also available which is used for dimmig. There are two triac used one for dimming and another for on /off purpose.

Step 1: Header Details

The diagram2 gives the details of the headers and terminal blocks.

To board 230VAC is applied to the input terminal block and load is applied to the output terminal block.

On the board J3 header is used for the dc virtual switch the header details can be referred form the diagram4. First pin is vcc-3.3v, second pin is atmega328p gpio pin for arduino programming we need to use A4 (ON&OFF), third pin is atmega gpio pin for arduino programming we need to use A5(DIMMING) and fourth pin is ground. For dc virtual switch we are using only second and third pin i.e A4, A5 and Fourth pin i.e ground, this is mentioned in the diagram3 for connection of virtual switch.

Step 2: Programming Details

J1 Header is

used to upload the firmware to ESP-12F or atmega328p through the FTDI Module, details of headers can be found in the diagram4. To upload the new firmware to esp using FTDI

Make the following connection for ESP12E

1]Connect the RX of FTDI to TXDE pin of J1

2]Connect the TX of FTDI to RXDE pin of J1

3]Connect the RTS of FTDI to RTSE pin of J1

4]Connect the DTR of FTDI to DTRE pin of J1

5]Connect the Vcc5V of FTDI to VCC5v pin of J1

6]Connect the GND of FTDI to GND pin of J1

Please refer the fallowing link for code


In this code commonly used HTTP port is 80, we can change port number, whichever user needs to use based on his application , refer below

//##### Object instances #####

MDNSResponder mdns;

ESP8266WebServer server(80);

WiFiClient wifiClient;

PubSubClient mqttClient;

Ticker btn_timer;

Ticker otaTickLoop;

After making connection, connect to the USB port, initial we need to install the driver to detect it detect the com port , in this way user can program upload the firmware.

Similarly to upload the firmware to the atmega328p follow the connection

1]Connect the RX of FTDI to TXDA pin of J1

2]Connect the TX of FTDI to RXDA pin of J1

3]Connect the DTR of FTDI to DTRA pin of J1

4]Connect the Vcc5V of FTDI to VCC5v pin of J1

5]Connect the GND of FTDI to GND pin of J1

Please refer the fallowing link for code


we are using 6gpios to control two triac dimmer board, two for controlling triac, two for controlling LED, anther two for controlling virtual switch. Gpios are

//Triac no.

#define NON_DIMMABLE_TRIAC 8 //Gpio 8

#define DIMMABLE_TRIAC 9 //Gpio 9

/*Dual colour LED*/

#define DLED_RED 3

#define DLED_GREEN 4

//manual switch

#define SWITCH_INPIN1 A5 //switch 1

#define SWITCH_INPIN2 A4 //switch 2

After making the connection user can able to upload the firmware to atmega. After programming both ESP and Atmega we have to establish connection between ESP and Atmega by shorting pins 3-4 of J1 header and 5-6 of J1 header using jumpers setting.

Step 3: Block Diagram

Web browser/MQTT

We can control this device through HTTP/MQTT. Http client sends an http request to esp8266 according to http standard, specifying the information the client like to retrieve from the esp8266. MQTT stands for MQ Telemetry Transport. It is a nice lightweight publish and subscribe system where you can publish and receive messages as a client. It makes it really easy to establish a communication between multiple devices. It is a simple messaging protocol, designed for constrained devices and with low-bandwidth.


The ESP8266 WiFi Module is a self contained SOC with integrated TCP/IP protocol stack that can give any microcontroller access to your WiFi network. The ESP8266 is capable of either hosting an application or offloading all Wi-Fi networking functions from another application processor. WiFi is a technology that uses radio waves to provide network connectivity. A WiFi connection is established using a wireless adapter to create hotspots areas in the vicinity of a wireless router that are connected to the network and allow users to access internet services. Programming to esp8266 is explained above and configuration details explained below.


This is 32 pin controller, Applications low-powered, low-cost micro-controller is needed. Perhaps the most common implementation of this chip is on the popular Arduino development platform, namely the Arduino Uno and Arduino Nano models. We used 6 gpios from this controller two for triac controlling other two for LED another two gpios are DC 5v gpios to control virtual switch.


Home appliances like light and fan, this board provides two channels one for switching and other for dimming , you can also be use two channels as switching, for this application we already build the code, you can also be use two channels as dimming for this application you need modify our code. For code please refer this link https://github.com/armtronix/Wifi-Two-Dimmer-Board

Step 4: Configuration Details

_Power the board with Input with 230V AC the device will host the access point as shown in diagram5, connect the mobile to access point with Armtronix-(mac) EX: Armtronix-1a-65-7 as shown in diagram6. After connecting open browser and type IP address in the browser,it will open the web server as shown in the diagram7, fill the SSID and password and select http, if user wants to connect to mqtt then it has to be mqtt radio button and enter mqtt broker IP address and enter mqtt publish topic and mqtt subscribe topic and submit.

After configuring the submit the ESP 8266 will connect to the router and router assigns IP address to the ESP. Open that IP address in the browser to control the relay for https mode and for mqtt u will need to use R13_On ,R13_OFF, Dimmer:xx(xx here is the dimmer value ranging from 0 to 99 ), R14_On, R14_OFF will be the commands to be sent to the board via the topic you have assigned while configuring the device.

Without configuring the SSID and Password we can control the Triac by connecting to the access point of the device and open the IP address of device i.e the web server page will show the link with the name Control GPIO as shown in the diagram7 by clicking this link also we can control the relay but the response will be slow.

Step 5: Wiring

The wiring diagram is shown in the diagram3 to input terminal block 230VAC Phase(P) and Neutral(N) is given .The output can be used as dimmer to the dimmable light to control the intensity of light and also to control the speed of fan. The output also be controlled via DC virtual switch as shown in the diagram3 Gpio A4,A5 of second and third pin of J3 header of atmega is used for virtual switch and J3 header fourth pin Ground is also used to connect virtual switch. For best dimming output use 10K pot.

Step 6: Box and PCB Board

How to insert PCB board in box ,please refer here. outer look of two dimmer board box please refer this image.

Step 7: Safety Warnings

If you are considering buying this item, you probably already know all this but in the interest of your safety, we feel compelled to state all this clearly. So take a few minutes to read it carefully before buying.

AC mains are very dangerous -- Even a 50 V AC supply is more than enough to kill you.

Please switch off the mains before making or changing connections, be very very careful. If you are not sure of anything related to the Ac supply lines please call an electrician ask him to help you out with it.

Do not attempt to interface to mains unless you have adequate training and access to appropriate safety equipment.

Never work on high voltages when you are alone by yourself. Always ensure that you have a friend/partner who can see and hear you and who knows how to quickly turn off power in case of an accident.

Use a 1A Fuse in series with the input to the board as a safety measure.

Basic Wiring diagram is available on our instructables page and github. Please go through it

Fire Hazard: Making wrong connections, drawing more than rated power, contact with water or other conducting material, and other types of misuse/overuse/malfunction can all cause overheating and risk starting a fire. Test your circuit and the environment in which it is deployed thoroughly before leaving it switched on and unsupervised. Always follow all fire safety precautions.



    • Trash to Treasure

      Trash to Treasure
    • Paper Contest 2018

      Paper Contest 2018
    • Pocket-Sized Contest

      Pocket-Sized Contest

    We have a be nice policy.
    Please be positive and constructive.




    Nice but I do not see the point of the atmega. The esp chip is actually a lot more powerful as a cpu!

    1.Esp8266 interrupts for ZCD is more on the firmware side not hardware so it some times misses it which leads to improper dimming

    2. In case there is an issue with wifi connection you may have to reboot esp(using soft reboot function or gpio hardware reboot ) which will turn the light/fan off probably for a second or so which some people may find it annoying

    3. Virtual switch /POT as shown in the video are not effected even if esp is stuck /hangs /or is trying to connect to the network which makes manual switching easy and hassel free