Close Menu
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
Facebook X (Twitter) Instagram
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us
Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
How To Electronics
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
How To Electronics
Home » Wireless AC Light Dimmer with Bluetooth & Arduino
Arduino Projects

Wireless AC Light Dimmer with Bluetooth & Arduino

Mamtaz AlamBy Mamtaz AlamUpdated:February 2, 20257 Mins Read
Share Facebook Twitter LinkedIn Telegram Reddit WhatsApp
AC Dimmer Bluetooth Arduino
Share
Facebook Twitter LinkedIn Pinterest Email Reddit Telegram WhatsApp

In this tutorial we will design a circuit using TRIAC and optocoupler to make a 220V Wireless AC Light Dimmer with Android Bluetooth & Arduino.

WARNING: This circuit is connected directly to the mains AC voltage. You must care about all safety precautions before using the device. If you are a beginner and without having the idea of using electronics appliances. Please avoid!


Overview

We have AC loads everywhere around us. And most of the home appliances are supplied with the AC mains power. There is plenty of situations that we want to have full control over an AC load such as a dimming of a lamp, speed control of AC motor/Fan, Vacuum Cleaner Control and so many other applications. The proper way to control dimming 230v AC is through phase control with a Triac: the Triac then is fully opened, but only during a part of the sinus AC wave.

AC TRIAC Waveform



But the controlling an AC load is not as easy as controlling a DC load. The electronics circuit for both these applications is different. The AC mains with a sinusoidal wave has the frequency of 50Hz. To build an AC dimmer, the zero-crossing points (the points where the wave changes its polarity) are important. To detect these points, we have to build a zero-crossing detector first. Similarly, we have to control the phase and cycle of the waveform. Since every component can’t tolerate 220V AC, so we need to isolate the circuit from 220V AC using some other component. The whole process is explained below.

Before moving ahead you can check our previous AC Dimmer Project and also the simple PWM Lamp Dimmer project.

.


Bill of Materials

Following are the components required to make the AC Dimmer Project. All the components can be easily purchased from Amazon.

S.N.Components NameQuantityPurchase Links
1Arduino Nano Board1Amazon | AliExpress
2Optocoupler IC EL817/PC8171Amazon | AliExpress
3Optoisolator MOC30201Amazon | AliExpress
4TRIAC BTA161Amazon | AliExpress
5Diode 1N40074Amazon | AliExpress
6Bluetooth Module HC-051Amazon | AliExpress
7 Resistors 47K2Amazon | AliExpress
8 Resistor 1K1Amazon | AliExpress
9 Resistor 100-ohm1Amazon | AliExpress
10Bulb 100W1-

Circuit: Wireless AC Light Dimmer with Bluetooth TRIAC & Arduino

Here is a circuit diagram for 220V Wireless AC Light Dimmer with Android Bluetooth, TRIAC & Arduino. The schematic has been designed using EasyEDA online PCB Designing tool.

BLuetooth AC Dimmer Arduino

The circuit is divided into 4 parts:
1. Zero Cross Detector Circuit
2. Phase/Angle Control Using Triac
3. Bluetooth to Control the Dimming
4. The Arduino Code for changing delay in mS


1. Zero Cross Detector Circuit

The AC voltage that we get from home supply is around 310 volts peak to peak or 220V RMS. The frequency is usually between 50 – 60 HZ. We have a positive part and a negative one so there will be a zero-crossing. So we will have to detect that zero-cross since our pulse needs to be in phase with the AC voltage

Zero Cross Detector Circuit

So, we have to detect when the voltage passes from positive to negative or from negative to positive and synchronize our pulse with that so it will fire always in the same spot. For that, we will use a full bridge rectifier. This will give the output both the positive and negative curves of the AC wave.

Zero Cross Detector waveform

There are two 47 kilo-ohms resistors to limit the current. And to separate the high voltage side from the low voltage side, we will use an EL817 optocoupler. In this way, there is no direct connection between 220V high voltage and 5V of the Arduino.

2. Phase/Angle Control Using Triac

Using a component called TRIAC, we will control the amount of time that this power is ON and OFF. But before that, we need to understand the working of TRIAC.

We are aware of the diode. When we put a single diode to an AC signal, we get a half-wave rectifier. With just one diode, the positive part of AC waveform remains & the negative part is chopped.


So we want to control the diode by activating it or deactivating it. So this can be done by using a THYRISTOR, which basically is a controlled diode that will be activated when the gate receives a current trigger and continuing to conduct while the voltage across the device is not reversed.

Thyristor

So here we have our AC signal. The negative part won’t pass if we use a diode and on the positive part, if we don’t switch the THYRISTOR there won’t be the positive part either. Suppose if we have to activate the gate of the THYRISTOR with a pulse in the middle position and let the remaining part of the positive side of the AC wave. So we get the only positive part as a rectified output. But if we want to do this with both positive and negative sides, we should use two THYRISTORS in an antiparallel configuration. But we already have that component which can do this work, that’s called TRIAC. The TRIAC will remain deactivated until it receives a pulse at its gate. Once received, it will remain activated until the main input will change its polarity. So we will use BTA16 TRIAC to control AC voltage.

TRIAC BTA16

First we have to detect the zero-cross since the pulse needs to be in phase with the AC voltage. So, we have to detect when the voltage passes from positive to negative or from negative to positive and synchronize our pulse with that so it will fire always in the same spot. For this full-bridge rectifier is used which will give the output both the positive and negative curves of the AC wave.

3. Bluetooth to Control the Dimming

In order to control power, all we have to do is to control the time between the zero-cross and when we fire the pulse at the TRIAC gate. So we will use UART Communication through Bluetooth HC-05/HC-06 to change the delay timing. The android app that is designed through MIT App Inventor has a slider in it. Sliding the slider is like changing the value of delay serially though Arduino. The Arduino code will read the value from Android app and map that value to a delay between 1 and 10 milliseconds.




Source Code/Program

The Arduino Program for Wireless AC Light Dimmer with Android Bluetooth & Arduino is given below with comments to understand the AC Dimmer working. Simply upload this code to your Arduino board.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
int mydelay = 0;
int myvalue=0;
int last_CH1_state = 0;
 
void setup() {
  /*
   * Port registers allow for lower-level and faster manipulation of the i/o pins of the microcontroller on an Arduino board.
   * The chips used on the Arduino board (the ATmega8 and ATmega168) have three ports:
     -B (digital pin 8 to 13)
     -C (analog input pins)
     -D (digital pins 0 to 7)  
  //All Arduino (Atmega) digital pins are inputs when you begin...
  */  
  
  PCICR |= (1 << PCIE0);    //enable PCMSK0 scan                                                
  PCMSK0 |= (1 << PCINT0);  //Set pin D8 trigger an interrupt on state change. Input from optocoupler
  pinMode(3,OUTPUT);        //Define D3 as output for the DIAC pulse
  Serial.begin(9600);       //Start serial com with the BT module (RX and TX pins)
}
 
void loop() {
   //Read the value of the pot and map it from 10 to 10.000 us. AC frequency is 50Hz, so period is 20ms. We want to control the power
   //of each half period, so the maximum is 10ms or 10.000us. In my case I've maped it up to 7.200us since 10.000 was too much
   if(Serial.available()>0)
   {
      myvalue = map(Serial.read(),0,255,10000,10);
      //In my case I've used myvalue = map(Serial.read(),0,255,7000,10); for better results
   }
    if (mydelay)
    {
      delayMicroseconds(myvalue); //This delay controls the power
      digitalWrite(3,HIGH);
      delayMicroseconds(100);
      digitalWrite(3,LOW);
      mydelay=0;
    }
}
 
 
 
 
//This is the interruption routine
//----------------------------------------------
 
ISR(PCINT0_vect)
{
  /////////////////////////////////////               //Input from optocoupler
  if(PINB & B00000001){                               //We make an AND with the pin state register, We verify if pin 8 is HIGH???
    if(last_CH1_state == 0){                          //If the last state was 0, then we have a state change...
      mydelay=1;                                    //We haev detected a state change!
    }
  }
  else if(last_CH1_state == 1){                       //If pin 8 is LOW and the last state was HIGH then we have a state change      
    mydelay=1;                                      //We haev detected a state change!
    last_CH1_state = 0;                               //Store the current state into the last state for the next loop
    }
}


PCB Designing, Gerber File & PCB Ordering Online

The PCB for AC Dimmer has been designed in EasyEDA online PCB making tool. Below is the front view and Back View of the PCB.

AC Dimmer PCB

The Gerber File for the PCB is given below. A quick way to prototype this PCB project is to use ALLPCB. This company has this limited-time sale offering 5 pieces of PCB for only 1$. You can simply download the Gerber File and upload it in ALLPCB.

Download Gerber File: Gerber File AC Dimmer

You can use this Gerber file to order high-quality PCBs for this project. To do that visit the ALLPCB official website by clicking here: https://www.allpcb.com/.

You can now upload the Gerber File by choosing the Quote Now option. You can choose the Material Type, Dimensions, Quantity, Thickness, Solder Mask Color, and other required parameters from these options.

After filling all details, select your country and shipping method. Finally you can place the order.

So after almost 5 days, I got the PCB from ALLPCB.

The PCB quality from ALLPCB is superb with very high quality.

I have been using ALLPCB for my project for two years now. They have been very consistent on quality and I never had any unsatisfactory board with them.

After that you can solder all the necessary components as per circuit diagram and make the final product ready.

Bluetooth Wireless AC Dimmer

Now you can power ON the circuit and start testing the working by sliding the slider in the Android App. You can use CFL Bulb or simply Filament Bulb to do the testings. I got the result from zero brightness to full brightness.

AC Dimmer

AC Dimmer


AC Dimmer Android App

The Android App for dimming the Bulb/Lamp has UI given below. The slider button on the App is used to Control the brightness.

AC Dimmer Android App

The App is designed using MIT App Inventor 2. You can directly download the app from the below link or you may import the .aia file and modify the app according to your requirements.

MIT App Inventor

AC Dimmer Android App: Download

AC Dimmer .aia File: Download

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Reddit Telegram WhatsApp
Previous Article220V AC Light/Fan Dimmer using TRIAC & Arduino
Next Article How 433 MHz RF Module Works & Interfacing with Arduino

Related Posts

DC Energy Meter using Arduino

Build a DC Energy Meter using Arduino – 32V/5A

Updated:August 26, 20252K
Interfacing ADXL375 Accelerometer with Arduino

Interfacing ADXL375 Accelerometer with Arduino (±200g)

Updated:June 28, 2025
PZEM-004T Arduino Energy Meter

DIY AC Energy Meter using PZEM-004T & Arduino

Updated:March 6, 20258K
Interfacing BMI160 Accelerometer & Gyroscope with Arduino

Interfacing BMI160 Accelerometer & Gyroscope with Arduino

Updated:February 2, 20259K
Password Based Door Lock Security System Using Arduino & Keypad

Password Based Door Lock Security System Using Arduino & Keypad

Updated:February 2, 20252436K
Earthquake Detector Alarm with with Accelerometer & Arduino

Earthquake Detector Alarm with Accelerometer & Arduino

Updated:February 2, 2025661K
Add A Comment

CommentsCancel reply

Latest Posts
ESP32 Fingerprint Attendance System with Live Web Dashboard

ESP32 Fingerprint Attendance System with Live Web Dashboard

June 16, 2026
IoT Based PM & Air Quality Monitoring System using ESP32

IoT Based PM & Air Quality Monitoring System using ESP32

June 14, 2026
DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

May 10, 2026
IoT Activity Tracker with ESP32 & Accelerometer Gyroscope

IoT Activity Tracker with ESP32 & Accelerometer/Gyroscope

May 2, 2026
A Guide to Sourcing Obsolete ICs for Vintage Projects

Beyond AliExpress: A Guide to Sourcing Obsolete ICs for Vintage Projects

April 21, 2026

ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL

April 27, 2026
Building a Smart Sensor Node with a BLE Microcontroller

Building a Smart Sensor Node with a BLE Microcontroller

February 26, 2026
High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

April 27, 2026
Top Posts & Pages
  • IoT Based PM & Air Quality Monitoring System using ESP32
    IoT Based PM & Air Quality Monitoring System using ESP32
  • How to use LDR Sensor Module with Arduino
    How to use LDR Sensor Module with Arduino
  • 12V DC to 220V AC Inverter Circuit & PCB
    12V DC to 220V AC Inverter Circuit & PCB
  • Buck Converter: Basics, Working, Design & Application
    Buck Converter: Basics, Working, Design & Application
  • IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
    IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
  • How to use Modbus RTU with ESP32 to read Sensor Data
    How to use Modbus RTU with ESP32 to read Sensor Data
  • ECG Graph Monitoring with AD8232 ECG Sensor & Arduino
    ECG Graph Monitoring with AD8232 ECG Sensor & Arduino
  • Silicon Controlled Rectifier (SCR): Construction, Working & Applications
    Silicon Controlled Rectifier (SCR): Construction, Working & Applications
Categories
  • Arduino Projects (197)
  • Articles (60)
    • Learn Electronics (19)
    • Product Review (15)
    • Tech Articles (28)
  • Electronics Circuits (46)
    • 555 Timer Projects (21)
    • Op-Amp Circuits (7)
    • Power Electronics (13)
  • IoT Projects (205)
    • ESP32 MicroPython (7)
    • ESP32 Projects (82)
    • ESP32-CAM Projects (15)
    • ESP8266 Projects (76)
    • LoRa/LoRaWAN Projects (22)
  • Microcontrollers (38)
    • AMB82-Mini IoT AI Camera (4)
    • BLE Projects (18)
    • STM32 Projects (19)
  • Raspberry Pi (93)
    • Raspberry Pi Pico Projects (57)
    • Raspberry Pi Pico W Projects (12)
    • Raspberry Pi Projects (24)
Follow Us
  • Facebook
  • Twitter
  • Pinterest
  • Instagram
  • YouTube
About Us

“‘How to Electronics’ is a vibrant community for electronics enthusiasts and professionals. We deliver latest insights in areas such as Embedded Systems, Power Electronics, AI, IoT, and Robotics. Our goal is to stimulate innovation and provide practical solutions for students, organizations, and industries. Join us to transform learning into a joyful journey of discovery and innovation.

Copyright © How To Electronics. All rights reserved.
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us

Type above and press Enter to search. Press Esc to cancel.

Ad Blocker Enabled!
Ad Blocker Enabled!
Looks like you're using an ad blocker. Please allow ads on our site. We rely on advertising to help fund our site.