how to dim an ac led light bulb using AC Light Dimmer Module For PWM Controller

hi im new here at using arduino but i know some basics .. so we have our AC Light Dimmer Module For PWM Controller 1 Channel 3.3V/5V Logic AC 50hz 60hz 220V 110V (here is the connection and image (https://sea.banggood.com/RobotDyn-AC-Light-Dimmer-Module-For-PWM-Controller-1-Channel-3_3V5V-Logic-AC-50hz-60hz-220V-110V-p-1244351.html?cur_warehouse=CN )) , arduino uno and a light sensor module (here also the connection and image of the sensor module (https://tutorial.cytron.io/2017/07/10/getting-started-light-sensor-module-sn-light-mod/))

so our goal is to control the ac dimmable led bulb automaticaly to dim itself using the light sensor module as the potentiometer so that as the light varies, the ac dimmable led bulb will dim as the light start to increase or decrease.

our problem is we could not dim the ac dimmable led bulb using this program : int ldrPin=A0; int ledPin=3; int ldrVal; float LedVal; void setup () { pinMode (ldrPin, INPUT); pinMode (ledPin, OUTPUT); Serial.begin(9600);

void loop () { ldrVal=analogRead (ldrPin); LedVal=(255./1023.)*(ldrVal); analogWrite (ledPin,LedVal);

unsigned int AnalogValue; AnalogValue = analogRead(A0); Serial.println("sensor value is =");

Serial.println(AnalogValue); Serial.println("Potentionmeter value or the LDR value is"); Serial.println(LedVal); }

we combine the connections that i put here (the 2 links ) and the result is we cannot dim the ac led dimmable bulb (it flickers as we try to control using light sensor module ) ... so is my connection correct or our program is wrong ?

Your technical question is off-topic in the tutorial section. Thread moved.

Follow the tutorial for using the product here. To dim AC signals correctly you need to wait until the AC sign wave is at zero and then turn on the Triac for the length of time you need for the brightness level your wanting. Just using the Arduino PWM signal will be turning on and off the Triac at random points in the AC sign wave causing flickering.

Is https://robotdyn.com/ac-light-dimmer-module-1-channel-3-3v-5v-logic-ac-50-60hz-220v-110v.html your module? If so, read the description and theory of operation.

If so, https://github.com/RobotDyn/AC-Light-Dimmer-Module-1-Channel-3.3V-5V-logic-AC-50-60hz-220V-110V seems to be the library that goes with it.

Note that there is more to it than just setting the PWM value. Looking at the library, zero-cross detection needs to be done as well in code and the library handles that for you.

Traditional light bulbs behave very different from LED bulbs. Please verify that your LED bulb is phase-controllable at all!

Dimmable LEDs typically have a PWM or analog control input, do not normally work with phase control.