📜 ⬆️ ⬇️

Homemade dimmers for home automation systems

Hello to all! This article is about how to build and apply dimmers for lighting control. The schemes are the simplest. Designed for mains 220 volts AC, control - analog signal 0-5 volts (arduino) or 0-3.3 volts (esp8266).



1. Dimmer for incandescent lamp, transistor:

Scheme:



Composition:

Q1 - IGBT transistor IRG4BC30UD (radiator required)
D1 - rectifier diode
D2 - diode bridge
Z 10V - Zener diode at 10 volts
4N25 - optocoupler
R 100K and R 10K - resistors
C 4.7 - capacitor

Principle of operation: amplification of the pwm signal with an arduino transistor.

Work example:


2. Dimmer on a simistor, suitable for incandescent lamps and LED dimmable lamps:

Scheme:



Composition:

BT 139 - Triac
MOC 3021 and 4N25 - optocouplers
R300, R10K, R50K - Resistors

Principle of operation: INT0 - input to arduino (pin2) set to interrupt, it receives a phase transition signal through zero (zero detector).
OUT is the output from arduine (pin3) from which a signal arrives at the triac through a delay.

The dimming parameter is set via the serial port (0-255 #)
Example: 99 #

Program for arduino UNO
//#include <EEPROM.h>
int dimming=100,ac_dimm;
char incomB='0';
String openhab="";


void setup()
{
	Serial.begin(9600);
	Serial.println("Setup...");
	pinMode(3,OUTPUT);                        // Set AC Dimmer
	delay(1000);
	Serial.println("Start 0-255#");
	attachInterrupt(0, start_dimming, RISING); //pin 2
	myPrint();
}

void loop()
{
	myIncoming();

}

void myIncoming()
{
	if(Serial.available()>0)
	{
		incomB=Serial.read();
		if(incomB=='\n' || incomB=='#')
		{
			if(openhab.toInt()>=0 && openhab.toInt()<256)
			{
				dimming=openhab.toInt();
			}
			openhab="";
			myPrint();
		}
		else
			openhab+=incomB;
	}
}


void start_dimming()
{
	if(dimming>ac_dimm)
		ac_dimm++;
	if(dimming<ac_dimm)
		ac_dimm--;
	if(ac_dimm>1)
	{
		delayMicroseconds(999);
		delayMicroseconds(31*(256-ac_dimm));
		digitalWrite(3, HIGH);
		delayMicroseconds(20);
		digitalWrite(3, LOW);
		//Serial.println("test");
	}
}

void myPrint()
{
	Serial.print("dimming = ");
	Serial.println(dimming);
}



Для более стабильной работы (например ложные сигналы прерывания) желательно добавить RC фильтр.

На этом все, спасибо за внимание, будте осторожны с электричеством.

Вдогонку еще схема
Симистор - бесконтактное реле


Source: https://habr.com/ru/post/410467/