you can control it also with potentiometer 10k ohm and with 555 ic, I but a simple Arduino code to control the brightness of the light by writing the value in the serial port.
Demonstration
The elements you need- 4 pieces Diode number 1N5408
- resistors: 220 Ω , 22k Ω , 33kΩ /1 watt, 33kΩ /1 watt
- Zener diode 10 V / 1.4 watt
- capacitors: 220nf / 275V , 2.2uf / 36V
- N-Channel MOSFET BUZ91
- Very High Isolation Voltage Optocoupler CNY65
Warning
This voltage level is lethal so please wear protective gloves and don't but the circuit on a contact surface.The circuit works with a low current application like a light so it will be not working with an AC motor ... may it work with a motor but not for a long time either the circuit damage or the motor.

Arduino code
int dim=0;
String converter;
void setup() {
Serial.begin(9600);
pinMode(3,OUTPUT);
}
void loop() {
while(Serial.available()==0);
converter=Serial.readString();
Serial.println(converter);
dim=converter.toInt();
analogWrite(3,dim);
}