Dimmable Switch Tutorial using YYAC-3S for ESP32

In this section we’ll walk through creating a Dimmable Switch using ESP32 and then control the light brightness via Amazon Alexa, GoogleHome or SmartThings.

Prerequisites :

  1. ESP32.
  2. YYAC-3S.
  3. Dimmable Light Bulb.
  4. Jumper Wires.

Not all the light bulbs are dimmable. Please check the manufacturer’s label to see if the bulb is dimmable.

Quick introduction to YYAC-3S

YYAC-3S module can used to control the supply of AC electricity using PWM from an Arduino, ESP8266, ESP32 or Pico W. It can be used to control the speed of AC motors and the brightness of dimmable light bulbs. The circuit consists of an SCR and an optocoupler on the input side. This prevents current from flowing back to the MCU and also separates it from ground, making it safe to use. The module supports a PWM input of 0-255 and can control AC voltage up to 220V with a maximum current of 3A.

Wiring

High Voltage Connectors

Connect the YYAC-3S module to the microcontroller as follows:

MCU YYAC-3S PWM Pin
ESP32 16

Let’s verify that YYAC-3S module is wired correctly and working.

Arduino IDE Serial Monitor will show light bulb dimming like this:

Step 1 : Create a new device in Sinric Pro

Sinric Pro create device alexa

Sinric Pro copy device id

Step 2 : Connect to Sinric Pro

Step 2.1 Install Sinric Pro Library

Sinric Pro install SinricPro library

2.2 Complete Code

Now you should be able to control the the brightness level via Alexa, Google Home and SmartThings apps

Sinric Pro dimmer with Alexa, SmartThings

Troubleshooting

dimmable light bulb example

Sinric Pro dimmer YYAC-3S via Alexa, SmartThings

Above LED lights up when the module recevice the PWM signal from MCU.

This document is open source. See a typo? Please create an issue